×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

creating an object and applying attributes in LISP

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

RE: creating an object and applying attributes in LISP

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

RE: creating an object and applying attributes in LISP

(OP)
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?

RE: creating an object and applying attributes in LISP

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources