View Full Version : Arc to Polyline
theald
2008-12-08, 09:13 PM
Hi All!!!
This is the first time I have attempted to code in Lisp and a would like to create a command, parc, that draws an arc, converts it to a polyline and gives it a width of .75. This is what I have so far:
(setq C:PARC ()
(command "arc")
(ENTLAST (command "pedit" "y" "w" ".75" "")
)
I am having trouble with the arc command as i don;t know how to get user input. Any Thoughts?
'gile'
2008-12-08, 09:24 PM
Hi,
(command "_.arc")
(while (not (zerop (getvar "CMDACTIVE")))
(command pause)
)
theald
2008-12-08, 09:37 PM
Thanks!
But now I have another problem. When I load it up through VLIDE I get:
Command: 'VLIDE *Cancel*
malformed list on input
Command: parc
Unknown command "PARC". Press F1 for help.
Does anyone know what that means and how to fix it?
So I found a missing parenthesis and now I have:
(setq C:parc ()
(command "_.arc")
(while (not (zerop (getvar "CMDACTIVE")))
(command "pause")
)
(ENTLAST (command "_.pedit" "y" "w" ".75" ""))
)
But I get an error:
; error: bad variable name in SETQ: (COMMAND "_.arc")
Any help?
lpseifert
2008-12-08, 10:23 PM
(defun c:parc ()
(setq pa (getvar "peditaccept"))
(setvar "peditaccept" 1)
(command "arc")
(while (> (getvar 'CmdActive) 0) (command pause))
(command "pedit" (entlast) "w" "0.75" "")
(setvar "peditaccept" pa)
(princ)
)
another way could be like this since the arc command has 3 inputs
(defun c:parc ()
(setq pa (getvar "peditaccept"))
(setvar "peditaccept" 1)
(command "arc" pause pause pause)
(command "pedit" (entlast) "w" "0.75" "")
(setvar "peditaccept" pa)
(princ)
)
theald
2008-12-08, 10:36 PM
Lifesaver!!
As a test to myself, here i want to prompt the user for the lineweight...
(defun c:parc ()
(setq pa (getvar "peditaccept")
lw (getstring "\nEnter Arc Lineweight: ))
(setvar "peditaccept" 1)
(atof pa)
(command "arc")
(while (> (getvar 'CmdActive) 0) (command pause))
(command "pedit" (entlast) "w" pa "")
(setvar "peditaccept" pa)
(princ)
)
Is this right?
Moderator Note:
Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)
lpseifert
2008-12-08, 11:54 PM
I'd use getreal or getdist instead of getstring... the (atof pa) does nothing. You're trying to use the variable set by the peditaccept... pa... as your line width.
If you're interested in learning lisp, this is a good site to help you get started.
http://afralisp.net/
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.