LDraw.org Discussion Forums

Full Version: Seeking a ldcad animation script method
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
我想制作曲柄摇杆机构的动画,但一直没有合适的方法。我希望你能我。最好有脚本模板,帮助像附件。

非常感谢您
(2021-09-24, 2:12)belle Wrote: [ -> ]我想制作曲柄摇杆机构的动画,但一直没有合适的方法。我希望你能我。最好有脚本模板,帮助像附件。

非常感谢您

This is a closed triangle problem, there are examples of that in some of the sample model animations.

Assuming the red beam has a known angle for A you can calculate the others using the trianglePlacementAngles function from the genTools module.

For each frame this would give you the red/green and blue/yellow angles, which are needed to close the BCD triangle.

[attachment=6893]


ps: I think most people would prefer English text even when using a translator.
(2021-09-24, 21:45)Roland Melkert Wrote: [ -> ]This is a closed triangle problem, there are examples of that in some of the sample model animations.

Assuming the red beam has a known angle for A you can calculate the others using the trianglePlacementAngles function from the genTools module.

For each frame this would give you the red/green and blue/yellow angles, which are needed to close the BCD triangle.




ps: I think most people would prefer English text even when using a translator.

Thank you for your answer. Could you please tell me where I can find similar script files for reference?
(2021-09-25, 7:33)belle Wrote: [ -> ]Thank you for your answer. Could you please tell me where I can find similar script files for reference?

The 8071, 8852 and 8860 samples included with LDCad use closed triangle math.
I've written a script to animate a four bar linkage. The script and accompanying examples can be downloaded in a zip file from bricksafe. There's a (quick-and-dirty) video illustrating how to use the script:



This is a preliminary release of the script. It should work with uncrossed bars (refer to https://link.springer.com/content/pdf/bb...-4%2F1.pdf) but does not yet handle crossed bars.

I will take a look at some point in the future for handling crossed bars.

Regards,

David
Hmmm, something is not quite right

[Image: bad_linkage.gif]
(2021-09-28, 23:13)David Manley Wrote: [ -> ]I've written a script to animate a four bar linkage. The script and accompanying examples can be downloaded in a zip file from bricksafe. There's a (quick-and-dirty) video illustrating how to use the script:



This is a preliminary release of the script. It should work with uncrossed bars (refer to https://link.springer.com/content/pdf/bb...-4%2F1.pdf) but does not yet handle crossed bars.

I will take a look at some point in the future for handling crossed bars.

Regards,

David
Thank you for your information. I will study hard and get it done
(2021-09-25, 19:05)Roland Melkert Wrote: [ -> ]The 8071, 8852 and 8860 samples included with LDCad use closed triangle math.

Thank you for your reply. I will continue to study it.
(2021-09-29, 4:52)David Manley Wrote: [ -> ]Hmmm, something is not quite right

Looks fun though Big Grin

There is also a problem when you play the animation fast or slow.

This is because you based your calculations on frame rate which isn't guaranteed to stay constant during playback.

Fast will skip frames, and slow will increase the number of frames (super slowmo).

Very promising project non the less.
(2021-09-29, 18:10)Roland Melkert Wrote: [ -> ]Looks fun though Big Grin

There is also a problem when you play the animation fast or slow.

This is because you based your calculations on frame rate which isn't guaranteed to stay constant during playback.

Fast will skip frames, and slow will increase the number of frames (super slowmo).

Very promising project non the less.

So presumably I should be using ani:getFrameTime() and ani:getLength() instead of ani:getFrameNr() and ani:getFrameCount()?

If so, is may be worth reflecting the same approach in your Scripting examples page? I used getFrameNr() and getFrameCount() on the basis of the sample examples page. Or is your suggestion something else altogether?

David
Pages: 1 2