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
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: [ -> ]<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
(2021-12-15, 8:09)David Manley Wrote: [ -> ]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
Thank you for your reply ,i'll try hard to learn more about lua and math