neko_designer 发表于 2022-7-5 23:50:14

beginner - code help

hi, I just started reading about lisp and made my first "script", but it is giving me an error after drawing the first rectangle, and wont draw the next. can anyone tell me what am I doing wrong? thanks in advance
 

(defun c:pl()(command "_thickness" 1 "")(command "_circle" '(0 0 0) 1 "")(command "_circle" '(10 10 0) 1 "")(command "_rectangle" '(0 0 0) "_Dimension" 4 5 "")(command "_rectangle" '(10 10 0) "_Dimension" 4 5 "")(princ) ;;clean exit)

pBe 发表于 2022-7-6 00:05:49

(command "_rectangle" '(0 0 0) "_Dimension" 4 5 "")
 
command is waiting for input after "Specify width for rectangles : 5 prompt
Its either you replace the "" symbol with "\\" or pause for input
 

(command "_rectangle" '(0 0 0) "_Dimension" 4 5 "\\")
 
or provide a point list
 

(command "_rectangle" '(0 0 0) "_Dimension" 4 5 '(10 10 0) )
 
to place the rectangle of the first quadrant as coordinate '(10 10 0.0) is north east of the rectangles first point
 
or even
 

(command "_rectangle" '(0 0 0) "_Dimension" 4 5 (polar '(0 0 0)(* pi 0.25) 1))
 
HTH
 
And Welcome to the Forum neko_Designer

MSasu 发表于 2022-7-6 00:18:22

Please pay also attention that all your command calls have an extra(the "") at their end.

(command "_thickness" 1 "")(command "_circle" '(0 0 0) 1 "")(command "_circle" '(10 10 0) 1 "")(command "_rectangle" '(0 0 0) "_Dimension" 4 5 "")
 
Another potential source of errors will come from active OSNAP modes - need to disable them before inputting points:

(command "_non" "_circle" '(0 0 0) 1)

Tharwat 发表于 2022-7-6 00:22:55

 
I guess the OSNAP mode should be before the insertion point and not before the command name

neko_designer 发表于 2022-7-6 00:30:47

thanks everyone, you guys are great

neko_designer 发表于 2022-7-6 00:44:31

Any idea why this doesn't work either?
 
(command "_arc" "_Center" '(0 0 0) '(1 0 0) '(0 1 0) "")?
 
I'm trying to create an arc only on the first quadrant on this case. In general, I have two points as well as the center point where I want it located and want to generate the arc
 
I could also work with angles of beginning and end of the arc and the center point.
 
I really appreciate any suggestions.

Tharwat 发表于 2022-7-6 00:58:43

Try this ...

(command "_arc" "_C" "_none" '(0 0 0) "_none" '(1 0 0) "_none" '(0 1 0))
页: [1]
查看完整版本: beginner - code help