-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Refactor] Allow both solving and animation #5
Comments
I definitely agree that the iterate() function should simply call calculate(). I wrote this code during my getting the feet wet part of learning python, so I was still pretty new to everything. Now then, I think you can still do what you're asking as it is. Let me whip up an example maybe tomorrow. I think I need to add better documentation, but there is a way to clear the mechanism for following calls of iterate() and calculate(). I think I at least had this in mind as I was coding this. |
Thanks for your prompt reply! I forgot to add another operation that would be nice -- plotting an individual configuration, i.e. some kind of |
This definitely exists. Check the plot_at_instant example in the examples folder. This is the distinguishing factor between |
@mooomooo There's another feature that I haven't really advertised very well, but you can play/pause and go frame by frame in an animation with the arrow keys and space bar. This is available only on the latest 1.1.8 version, which I just published to pypi a few minutes ago. So, you can do I am planning on making a YouTube video on this repository tomorrow. |
@mooomooo This script below will perform what I believe you are asking. The only thing that you are mentioning that it does not address is the multiple uses of both iterate and calculate. I do not intend on adding that specifically because I cannot think of an instance where this is necessary and/or worth the added effort. I think the play pause in the animation is more than able to accomplish your specific needs. If I am wrong about this, then please let me know. If not then I am ready to close the issue. Check out this script of a four bar linkage to address your specific question about plotting with no animation and at multiple positions without the need to reinstantiate the mechanism object. The only gotcha is to call the
|
Thanks @gabemorris12, these examples are super helpful! It addresses part of my hopeful use case, and being able to step through an animation is definitely a nice touch.
The main point of this would be for non-interactive scripting use, e.g. preparing a design report on a particular mechanism (probably after you're done playing around in real time). Once you've settled on the final design, you could run a script to generate and save all the necessary outputs at once to be able to say "See attached movie 1 to show moving the slider only, movie 2 for turning the knob only, figure 1 for both widgets at position 0, figure 2 for slider at 0 and knob at 11, ..." |
@mooomooo I think the main issue with this is the storing of information. The way things are set up now, I am just modifying attributes of the vector instances. So in the above example, I am overwriting the attributes of the vectors with each call of |
It currently appears that the same
Mechanism
object cannot support bothcalculate()
anditerate()
operations simultaneously --Mechanism.pos
is assumed to be unchanging (or at least always of the same type). It would be helpful if the class object itself left the independent variables unspecified, so that the same object could be used to solve for multiple specific configurations, or looped to make an animation / result table, and so on back and forth.example proposed use case:
(This may also help with some DRY -- the iterate code could call
calculate()
rather than doing its own math)The text was updated successfully, but these errors were encountered: