Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Arrows #5

Open
Popular-Matter opened this issue May 1, 2020 · 9 comments
Open

Issue with Arrows #5

Popular-Matter opened this issue May 1, 2020 · 9 comments

Comments

@Popular-Matter
Copy link

When I try to use ChemArrow class, I'm noticing that the arrow isn't showing up once the video is successfully created. I was wondering if this is a known issue with this class.

I've also been playing around with the chem_objects.py and constants.py file to see if I can fix this. On MiXTeX I'm able to see the arrow just fine, but when creating the video again, the arrow is just messing with things.

I was wondering if you have further insight on this. Thanks!

@Popular-Matter
Copy link
Author

Edit: So I realized what the issue may be. Whenever I try to use the Write function within self.play, apparently the arrow (and everything after it) cannot be written. Hope this makes sense. If you need clarification do let me know.

Curious to know why it's having that issue.

@kilacoda
Copy link
Owner

kilacoda commented May 1, 2020

I was having such problems with Reaction as well earlier but it somehow automatically worked after a few days. I have no idea whatsoever why.

@Popular-Matter
Copy link
Author

My guess is that it could be a rendering issue of some sort. I was digging deeper into other issues that could appear with using chemfig through manim and found this: malhotra5/Manim-Tutorial#10

I'm assuming that you hadn't modified the code in any way and that's why you're unsure as to why it suddenly works now haha.

@kilacoda
Copy link
Owner

kilacoda commented May 1, 2020

Haha. Though that should be fixed because everything in chanim is with stroke_width=2. That's why this thing works in the first place.

@Popular-Matter
Copy link
Author

Gotcha.

Well I'll still keep this issue open. I'll give you the code that I made and a video showing the issues:

from manimlib.imports import *
from chanimlib.imports import *

class ReactionScheme(Scene):
    def construct(self):
        molecule1 = ['O*3(---)']
        molecule2 = ['O*4(----)']
        reaction1 = Reaction(molecule1, molecule2, 'forward', 1, 0, 'white', 'heat', 'neat')
        reaction1.set_stroke(WHITE, 1)
        self.play(reaction1.shift, LEFT*1)
        self.play(Write(reaction1))

Link to video: https://vimeo.com/413870747

Let me know if you spot anything that's off. I'm also reusing the default chem_objects.py and constants.py (your version).

Also I'm curious to know if this issue happens if you were to reinstall manim/chanim.

Thanks!

@kilacoda
Copy link
Owner

kilacoda commented May 1, 2020

I guess I can rule out the possibility of this being an issue specific to my system then. And for some reason, this problem's occurring again for me.

@emonhossainraihan
Copy link

@kilacoda I was facing an issue with ChemArrow, like

CArrow(text_up="Upper text",length=2)

give me,

AttributeError: ChemArrow object has no attribute 'template_tex_file_body'

I was guessing the problem was there wasn't defined what template_tex_file_body is inside the ChemArrow class,

class ChemArrow(MathTex):
    ...
        self.template_tex_file_body = self.template_tex_file_body.replace(
            "\\setchemfig{atom sep=2em}", f"{set_chemfig}"
        )

        arrow = "\\arrow{%s[%s][%s]}" % (self.arrows[_type], text_up, text_down)
        MathTex.__init__(self, arrow, stroke_width=stroke_width, **kwargs)

@kilacoda-old
Copy link
Collaborator

Ah yeah, guess I missed that when I was moving to the TexTemplates. Will push a fix soon.

@kilacoda-old
Copy link
Collaborator

@emonhossainraihan fixed in 4c079c6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants