Jump to content

New to AUtoLISP, trying to insert a block and rotate it


Recommended Posts



I'm very new to Autolisp, and I am having some trouble with my code. Here's a description of what I am trying to do:


I have a drawing consisting of two pipes, bottom pipe and upper pipe. They will be inclined in reference to the paper, represented by the square. I need to insert at the end of these pipes a block (inside the block will be a leader), which then will be rotated to align itself with the paper orientation.

Somehow, the code i've written so far is not working, I believe it's because i'm not getting the correct syntax of the commands i'm using. Would anyone be willing to take a look? Help is much appreciated.


See attached files for my code and the drawing (containg the desired block)



Link to comment
Share on other sites

Welcome to CADTutor .


Suppose that you know the rotation angle and it is assigned to variable rot in the following example .


(if (and (tblsearch "BLOCK" "test2")
        (setq rot 45.0)
        (setq p (getpoint "\n Specify insertion point :"))
 (command "_.-insert" "test2" "_non" p "1" "1" rot)

Link to comment
Share on other sites

Under ;Calculations

You have not set anything for angpt uppercurvepoint or bottomcurvepoint. Move your defuns above this section.


Additionally, I would be more apt to use an entmod.

Link to comment
Share on other sites

Be careful to that if you change the units accidently setting rot to 45 is what degrees or radians look into the setvars before doing angles



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...