That helps. Thanks.
So let's start learning along the way. I will get you started. We can then add to it as needed.
We now need to know what points the user wants to place a beam in. So, let's ask the user for the info.
Code:
(setq StartPoint (getpoint "Specify first point: "))
(setq EndPoint (getpoint "Specify second point: "))
Here we have received the two points the user wants to work with. Now we can draw the line using the AutoCAD LINE command.
Code:
(command "LINE"
(polar StartPoint (angle StartPoint EndPoint) extension)
(polar EndPoint (angle EndPoint StartPoint) extension)
)
Now, let's put this all together.
Code:
(defun c:beam1 ()
(setq StartPoint (getpoint "Specify first point: "))
(setq EndPoint (getpoint "Specify second point: "))
(command "LINE"
(polar StartPoint (angle StartPoint EndPoint) 3.0)
(polar EndPoint (angle EndPoint StartPoint) 3.0)
"" ;_We need to end the line command
)
)
Depending on your running osnap settings, this may be in the correct location. Let's clean that up a bit to make certain any running osnaps do not hinder the routine. We can do that by specifying the NONE osnap when we are drawing our line. So, let's change change these two lines as noted in red.
Code:
"non" (polar StartPoint (angle StartPoint EndPoint) extension)
"non" (polar EndPoint (angle EndPoint StartPoint) extension)
Now, the code should draw a line. We can change the line to a pline by changing the command we call. Do you want to try it?