creating an object and applying attributes in LISP
creating an object and applying attributes in LISP
(OP)
Hi,
I have created a few pipework components in R14 and now need to add attributes the code is as follows:
(DEFUN ELBOW ()
(setvar "cmdecho" 0) ; stops the code showing on the screen
(setq d$ (getreal "Enter diam:")) ; get size from user
(setq pos$ (getpoint "Probe position to start :"))
(setq r1$ d$) ; r1$-r3$ is the points required to produce a circle
(setq r2$ (* d$ 1.5))
(setq r3$ (* d$ 2))
(setq sp$ (polar pos$ (dtr 180) d$))
(setq ep$ (polar pos$ (dtr 270) d$))
(setq spps$ (polar pos$ (dtr 180) r3$))
(COMMAND "ARC" sp$ "C" POS$ "A" "90")
(COMMAND "LINE" ep$ (POLAR ep$ (DTR 270) D$) "") ; draw line
(COMMAND "ARC" spps$ "C" POS$ "A" "90")
(COMMAND "LINE" sp$ (POLAR sp$ (DTR 180) D$) "")
(COMMAND "ARC" (POLAR sp$ (DTR 180) (/ r2$ 2)) "C" POS$ "A" "90")
(setvar "cmdecho" 1)
(COMMAND "ATTDEF" ............what goes here)
How do I add the attributes in Lisp and then eventually build up a library of more pipeconnectors and when one is created that matches another, it informs the user.
Eventually what Im supposed to have is a library pipe fittings with all attributes including things like price etc....
I have created a few pipework components in R14 and now need to add attributes the code is as follows:
(DEFUN ELBOW ()
(setvar "cmdecho" 0) ; stops the code showing on the screen
(setq d$ (getreal "Enter diam:")) ; get size from user
(setq pos$ (getpoint "Probe position to start :"))
(setq r1$ d$) ; r1$-r3$ is the points required to produce a circle
(setq r2$ (* d$ 1.5))
(setq r3$ (* d$ 2))
(setq sp$ (polar pos$ (dtr 180) d$))
(setq ep$ (polar pos$ (dtr 270) d$))
(setq spps$ (polar pos$ (dtr 180) r3$))
(COMMAND "ARC" sp$ "C" POS$ "A" "90")
(COMMAND "LINE" ep$ (POLAR ep$ (DTR 270) D$) "") ; draw line
(COMMAND "ARC" spps$ "C" POS$ "A" "90")
(COMMAND "LINE" sp$ (POLAR sp$ (DTR 180) D$) "")
(COMMAND "ARC" (POLAR sp$ (DTR 180) (/ r2$ 2)) "C" POS$ "A" "90")
(setvar "cmdecho" 1)
(COMMAND "ATTDEF" ............what goes here)
How do I add the attributes in Lisp and then eventually build up a library of more pipeconnectors and when one is created that matches another, it informs the user.
Eventually what Im supposed to have is a library pipe fittings with all attributes including things like price etc....





RE: creating an object and applying attributes in LISP
"Everybody is ignorant, only on different subjects." — Will Rogers
RE: creating an object and applying attributes in LISP
This is my second assignment using autocad but first using lisp. My requirements for this assignment are draw the shape(pipe connectors), create attributes, gather the attrubutes and shape(wblock) and insert into drawing.
There are more requirments due but for now this is where im stuck. Being very new to List and autocad I was wondering if you could all put down any ideas so that I can try and grasp what Im meant to be doing.
The code above is what I have and a few other shapes but Ive not managed to get any further, perhaps I dont understand the concept, any thought?
RE: creating an object and applying attributes in LISP
however, "command" is not a terribly efficient way to create lisps, especially now that Vlisp has been around for a few years and has methods like vla-addattribute available. If you have the time, you would benefit greatly from exploring the vla functions