GigaFHLS 发表于 2022-7-5 22:36:59

New to AUtoLISP, trying to ins

Hello,
 
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)
ttten.LSP
Drawing1.dwg

Tharwat 发表于 2022-7-5 23:13:39

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))

CheSyn 发表于 2022-7-5 23:23:43

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.

BIGAL 发表于 2022-7-5 23:44:15

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
 

(SETVAR "LUNITS" 2)(SETVAR "ANGBASE" 0.0)(SETVAR "ANGDIR" 0)(SETVAR "LUPREC" 0)(SETVAR "AUNITS" 0)(SETVAR "AUPREC" 0)
页: [1]
查看完整版本: New to AUtoLISP, trying to ins