Tutorial: Modeling and Animating a 4-bar Linkage with AutoCAD
HTML-код
- Опубликовано: 23 авг 2024
- How to model a 4-bar linkage in AutoCAD using blocks and parametric constraints. A VLISP program is used to animate the end result. Here's a listing of the animationrotation vlisp program. Note that RUclips does not permit the use of the "less than" symbol (left point "V" ). Be sure to edit the line with the WHILE statement by changing ??? to the less than symbol.
(defun c:animaterotation (/)
; L. Minardi 12/22/2017 v1.0
; Animates a group about a specified point. User may specify:
; - center point of rotation
; - group name
; - rotation angle step size
; - delay factor for each step
; - number of steps in the animation
(setq ctr (getpoint "
Indicate center of rotation."))
(setq AngStep (getreal "
Enter angle step size (10): "))
(if (= AngStep nil) (setq AngStep 10))
(setq d (getint "
Enter delay factor (100): "))
(if (= d nil) (setq d 100))
(setq gname (getstring "
Enter group name (g1): "))
(if (= gname "") (setq gname "g1"))
(setq nSteps (getint "
Enter number of steps (20): "))
(if (= nSteps nil) (setq nSteps 20))
(setq i 0 )
(while (??? i nSteps) ; -------------------------------------- replace ??? with the "less than" symbol.
(command "rotate" "g" gname "" ctr AngStep nSteps)
(setq i (1+ i))
(command "delay" d)
) ; end while
(princ)
)
Genius! Precisely what I needed!
B R A V O!!! (standing ovation)
Excellent work!
Thank you! Excellent video tutorial!!
Very good video, thanks
Thank you for you video it helped me very much
Thank you so much. Big help.
Thank you so much, it help me alot..
Hey Lee, this works great, thanks so much! I can use it for training my aviation maintenance students on flight controls and ???. One bug so far, when trying different parameters for smoother action such as step size 1 degree, time delay 20 and steps 360 (a full circle) it sometimes crashes and becomes nonresponsive. Any ideas? Are there limits beyond which we should not push those parameters
Hi Barry, I'm glad you found the program useful. It's possible to create 4 bar linkages where the crank cannot rotate 360 degrees. Could that be the issue? What were the dimensions for the linkage that caused the program to crash? Please state: the distance between the pivots, the length of the crank located at one of the pivots, the length of the link connected to the other pivot and the length of the couple link.
How can I connect the lines with the object itself. When I merge the moving lines, the object does not move?
As noted in the tutorial each link is a block. Are you familiar with AutoCAD blocks? Each of the blocks have a line on the xy plane whose ends are referenced when applyng the coincident constraint. The 3D solid part of the link is a solid object on a different layer of the same block as the lines. Since the reference lines are part of the same block as the "object" they move together.
Please let me know if you require further explanation with specifics about what is unclear.
Hey. For the AnimateRotation programme what sofiware do you have to use? Or it is just a notepad?
In AutoCAD go to the Manage tab then click Visual LISP Editor, File, New File and type in the program. Save the file as AnimateRotation (.scr will be appended automatically).
Click Tools, Load text in Editor or give the Script command in AutoCAD to load the program. After it is loaded you can run the AnimateRotation command like any other command.
Thank you Sir!
Thank you 💕💕💕💕 boss
Hello,
The bars you made are blocks or you simply used press pull to get the bars?
Regards
AutoCAD’s parametric features can only reference point, lines, arcs, circles, and splines on a 2D plane. It cannot reference solids. I therefore created the links as individual block objects. Each block includes lines on the XY plane and, on a separate layer, a solid representation of the link (0:20 in video). When adding a coincident parametric constraint the line ends in the block are referenced.
The solid objects that are in a block were created by making a 2D outline drawing of the link with circles (holes) for the “pivot” points (the center of the holes line up with the ends of the lines). The 2D shape of the link was created by converting the outline and holes to regions and then subtracting the holes. The resulting region was then extruded into a solid.
If possible, can you share the CAD file in which you are working....?
@@mohsin160 I've posted it on the AutoCAD forum in response to your original post.
can you make small video, how you link the lines to solids, ore this seams to by the only missing info. couple of seconds for the video beginning
Yeah, I'm totally confused on that as well.
Did you find answer? Sir
nice
I'm trying apply constraints to prove how a set of joints will operate.
I have 2 lines, both at 0 on the Z axis, and I have the ucs positioned on one of the lines. When I try to apply a coincident restraint I'm getting the following messages.
GCCOINCIDENT
Select first point or [Object/Autoconstrain] :
Select second point or [Object] :
The constraint cannot be applied. The two objects must reside in the same plane.
Can you suggest a solution?
First, set the UCS to World
UCS [Enter][Enter]
Give the list command and select the first line and check that the z coordinate for both ends are = 0.0
Do the same for the other line. This will validate that the two lines lie on the z = 0 plane (not axis as you state).
If you want to work with two lines that are on the same plane but the plane is skewed in space then set the UCS such that the XY plane of the UCS contains the two lines.
could you pls do more animation in autocad . By the way, thanks for this video
You are welcome AC 3DCad. What kind of AutoCAD animation would you like to see? Unlike 3ds Max where I do most of my animations, AutoCAD is quite limited but there are workarounds.
@@LeeMinardiwheels rotating on a circular track
Hi! When I try to do the "Coincident" part, only the line moves to the fixed point but the solid remains on its position. What am I doing wrong? :c
Each link is an AutoCAD BLOCK with a solid object on one layer and a line on another layer. The line is referenced for applying the coincident constraint. I mention this at 0:16 in the video. Since the line and the solid are components of the same block they will move together. Does this answer your question?
@@LeeMinardi YES! Thank you. I didn't know what a BLOCK was hahaha I appreciate it ;)
@@LeeMinardi But, do you have a video to learn how to link a solid with a line. Even if they are circles with some kind or rounded solids, how can I know how? Please, help me!
how you converted these
lines into solid part
Each link in the mechanism is a separate AutoCAD block that contains a line on the xy plane and a solid model representation of the link on a separate layer of the block.
Are you asking how to create solid objects in AutoCAD?
ANIMATEROTATION is unknown command? How can i use that on autocad2015? Thanks IDOL! LODI!
animaterotation is a vlisp program. You must load it before using it. Below is a listing for the program that is shown at the end of the video. Save this program as a text file with the filename extension .lsp. In AutoCAD give the command _appload and then you will be able to give the command animaterotation.
(defun c:animaterotation (/ ctr AngStep d gname nSteps i)
; L. Minardi 1/11/2018 v1.0
; Animates a group about a specified point. User may specify:
; - center point of rotation
; - group name
; - rotation angle step size
; - delay factor for each step
; - number of steps in the animation
(setq ctr (getpoint "
Indicate center of rotation."))
(setq AngStep (getreal "
Enter angle step size (10): "))
(if (= AngStep nil) (setq AngStep 10))
(setq d (getint "
Enter delay factor (100): "))
(if (= d nil) (setq d 100))
(setq gname (getstring "
Enter group name (g1): "))
(if (= gname "") (setq gname "g1"))
(setq nSteps (getint "
Enter number of steps (20): "))
(if (= nSteps nil) (setq nSteps 20))
(setvar "CMDECHO" 0)
(setq i 0 )
(while (< i nSteps)
(command "rotate" "g" gname "" ctr AngStep nSteps)
(setq i (1+ i))
(command "delay" d)
) ; end while
(setvar "CMDECHO" 1)
(princ)
) ; end defun
Please enlighten me the steps to load this program. How do I save it, which directory to save it? I badly need this. Please help.
Successfully loaded it. Thanks.
Is it possible to rotate chain and gears sir?
A chain wrapped around a gear like on a bicycle would be difficult as each individual link of the chain would need to be animated individually. A few gears could be done.
How did you make the bars attach on top of one another?
Each block of the different bars of the mechanism has a line on the xy plane that was used for applying the coincident constraint. The solid objects of the bars was created at different z values so that the bars do not interfere with each other. The bottom of the solid objects for the crank and follower have a z value of 0 while the coupler has a z value equal to the thickness of the bars. The pivots are just below the xy plane. I mention this at 0:34 in the video.
@@LeeMinardi oh, I get it now, thanks for the fast response
Is this possible to get the lsp file to do this rotation?
I've added a listing of the program to the description paragraph. Before using it be sure to make the noted change for the "less than" symbol.
@@LeeMinardi Thanks a lot!
how did you attach a line to a object in Autocad ??? ref : 0:25
I created a different block for each of the links and the pivot. The lines you see at 0:25 are part of the blocks but on a different layer. The lines are all on the zero XY plane (Z=0) to ensure a planar mechanism. If all your geometry were 2D the lines would not be necessary as you could add the coincident constraint between links by snapping to the center of the circles that define the link ends.
Lee Minardi thank you !!! 👍👍
@@LeeMinardi I have a solid and a line. How to apply constrain to them.. like you did. I am unable to lock them together. Please reply early and help me finish my project🥺
@@dwaraganathanrengasamy6169 The line and solid for each link are part of the same block as explained at about 20 seconds into the video. The lines for each block lie on the XY plane (z = 0). The solid component of the block lies above or below the Z = 0 plane. The lines and solids are on different layer. Parametric constraints only work in 2D. You are really constraining the lines of the blocks not the solids. The solid object are there to make the final mechanism look good!
I hope this answers your question. Good luck!
Thanks.