LDraw.org Discussion Forums
Seeking a ldcad animation script method - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: Rendering Techniques (https://forums.ldraw.org/forum-20.html)
+--- Thread: Seeking a ldcad animation script method (/thread-25300.html)

Pages: 1 2


Seeking a ldcad animation script method - belle - 2021-09-24

我想制作曲柄摇杆机构的动画,但一直没有合适的方法。我希望你能我。最好有脚本模板,帮助像附件。

非常感谢您


RE: Seeking a ldcad animation script method - Roland Melkert - 2021-09-24

(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.


.png   angles.png (Size: 18.91 KB / Downloads: 111)


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


RE: Seeking a ldcad animation script method - belle - 2021-09-25

(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?


RE: Seeking a ldcad animation script method - Roland Melkert - 2021-09-25

(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.


RE: Seeking a ldcad animation script method - David Manley - 2021-09-28

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/bbm%3A978-3-319-31970-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


RE: Seeking a ldcad animation script method - David Manley - 2021-09-29

Hmmm, something is not quite right

[Image: bad_linkage.gif]


RE: Seeking a ldcad animation script method - belle - 2021-09-29

(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/bbm%3A978-3-319-31970-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


RE: Seeking a ldcad animation script method - belle - 2021-09-29

(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.


RE: Seeking a ldcad animation script method - Roland Melkert - 2021-09-29

(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.


RE: Seeking a ldcad animation script method - David Manley - 2021-09-29

(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