LDraw.org Discussion Forums

Full Version: looking for ldcad linkage animation help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
tried several hours couldn't sove it

https://youtu.be/QSMPZDEJ_H4

ldr file I'v upload to google drive  https://drive.google.com/drive/folders/1...sp=sharing

Could somebody help me?
Presumably you are wanting something like this for the linkages animation?



I did this using the linkages script as described in this forum post, tweaking your model a bit to try to illustrate how to set up the parts for the linkages animation. The modified LDraw file can be download here.

Hopefully this is enough to help but if not, you're welcome to post questions here.

Regards,

David
(2021-12-13, 7:26)大卫·曼利 Wrote: [ -> ]大概你想要这样的链接动画?



我使用本论坛帖子中描述的链接脚本完成了此操作,稍微调整了您的模型以尝试说明如何设置链接动画的部件。修改后的 LDraw 文件可以在这里下载。

希望这足以帮助,但如果没有,欢迎您在这里发布问题。

问候,

大卫
(2021-12-13, 7:26)David Manley Wrote: [ -> ]Presumably you are wanting something like this for the linkages animation?



I did this using the linkages script as described in this forum post, tweaking your model a bit to try to illustrate how to set up the parts for the linkages animation. The modified LDraw file can be download here.

Hopefully this is enough to help but if not, you're welcome to post questions here.

Regards,

David


Thank you very much ,this is exactly what i want
several days ago , i'v read your reply abou linkage in other place in  this forum ,but the program you code in lua is difficult for me . i can use it as the way you show in the video Thannk you very much 
by the way ,if I want to let the whole model rotate around Z-axis  and the wheel in the model near the motor to rotate 
How can I modify your program
Here's a video of the animation including the rotation of the lower axle assembly. My presumption is that the part "motor.ldr" in your model is some custom part as it is not a standard LDraw part, hence why there is a part gap in the video. The animation was created by making use of LDCad's POV-Ray animation capability.



I made the following additional refinements to your model;
  • the crank and coupler linkages were not quite rotated in the correct place to align. They are now.
  • I made the parts for the lower axle assembly into a sub-model. It made the animation script easier.

You can download the revised model from here. I also tweaked the linkages script specifically for your request. The modified script (download it from here) not only rotates the linkages (as per the video) but at the same time rotates the whole model too (as per your request but the model rotation is not included in the video above).

Note that the modified Lua script requires the lower axle assembly to be named "driver.ldr" for it to work. There are two blocks added to the linkages script; one towards the end of the function on4BarFrame and one at the end of the function on4BarStart. The blocks are commented with today's date so you should be able to see the difference to the normal linkages.lua script.

Regards,

David
Thank you very much for solving the problem
This program work well for that assembly,even i find how to change the speed of the assembly rotate around the Y axis
But yesterday i made another assembly and used gear to transmit power
The driver gear is 8 teeth ,next to it is a 40 teeth gear ,
Now ,I don’t know how to change the speed of the driver gear . it should be 5-times faster than the 40teeth gear next to it,at same tome it has the opposite rotation 



 i upload the files to GoogleDrive  check here 

Looking forward to your help
(2021-12-14, 16:18)liu Wrote: [ -> ]Thank you very much for solving the problem
This program work well for that assembly,even i find how to change the speed of the assembly rotate around the Y axis
But yesterday i made another assembly and used gear to transmit power
The driver gear is 8 teeth ,next to it is a 40 teeth gear ,
Now ,I don’t know how to change the speed of the driver gear . it should be 5-times faster than the 40teeth gear next to it,at same tome it has the opposite rotation 



 i upload the files to GoogleDrive  check here 

Looking forward to your help
(2021-12-14, 16:18)liu Wrote: [ -> ]<snip>

Now ,I don’t know how to change the speed of the driver gear . it should be 5-times faster than the 40teeth gear next to it, at the same time it has the opposite rotation 

In the function on4BarFrame, towards the end of the function, immediately after the line

Code:
driver_lo = ldc.subfile():getRef("driver.ldr")

insert this

Code:
    rotation_lo:setRotate
    (
      math.deg(rotation_angle_ln) * 5,
      (animation_rotation_axis_mn == 1 and -1 or 0),
      (animation_rotation_axis_mn == 2 and -1 or 0),
      (animation_rotation_axis_mn == 3 and -1 or 0)
    )

By way of an explanation, the code tweak I did for your "08" model leveraged that the angle of rotation of the crank was the same as the angle of rotation required by the driver. Since it was a 1:1 speed ratio and with the rotation in the same direction, it could use the same rotation matrix. This amendment is multiplying the angle by 5 and computing a different rotation matrix for the driver. The sign of the X, Y or Z axis is inverted (set to -1) so that the rotation is in the opposite direction.

Regards,

David
(2021-12-14, 19:35)David Manley Wrote: [ -> ]In the function on4BarFrame, towards the end of the function, immediately after the line

Code:
driver_lo = ldc.subfile():getRef("driver.ldr")

insert this

Code:
    rotation_lo:setRotate
    (
      math.deg(rotation_angle_ln) * 5,
      (animation_rotation_axis_mn == 1 and -1 or 0),
      (animation_rotation_axis_mn == 2 and -1 or 0),
      (animation_rotation_axis_mn == 3 and -1 or 0)
    )

By way of an explanation, the code tweak I did for your "08" model leveraged that the angle of rotation of the crank was the same as the angle of rotation required by the driver. Since it was a 1:1 speed ratio and with the rotation in the same direction, it could use the same rotation matrix. This amendment is multiplying the angle by 5 and computing a different rotation matrix for the driver. The sign of the X, Y or Z axis is inverted (set to -1) so that the rotation is in the opposite direction.

Regards,

David


Thank you very much
Now the final aninamtion is perfect
Thanks again

Here comes a new problem in a new assembly(i'm confussed at how to subfile the assembly,tried several times counld't make the right animation . at last , i find maybe it's not the matter about how to  subfile the assembly )

the left rocker should move follow the right rocker , but I tried , could't make it


i'v upload  the files to googledrive files

Looking forward to your help
(2021-12-15, 5:09)liu Wrote: [ -> ]the left rocker should move follow the right rocker , but I tried , couldn't make it

That is because the linkage animation script works only for a 4 (or 3) bar construction. By my counting, your "10" model is a 7 bar linkage construction. That requires calculations which do not exist in the linkages script. So I'm afraid I can't help you with this one.

Regards,

David
Pages: 1 2