Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating an object and applying attributes in LISP

Status
Not open for further replies.

warriorwarren

Computer
Nov 5, 2004
4
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....
 
Replies continue below

Recommended for you

Not to overlook an option..., but have you looked at creating a library of blocks with attributes attached and then inserting and defining the atts then?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
The library has to be dynamic. The basic shape looks the same, but the user has to input dimensions. It depends what size pipe they are using etc..

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?
 
if you're using the "Command" option to create the attribute then you really need to look at the prompts that are issued with that command.~ those are the prompts you need to answer in your 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor