AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Single Attribute Retrieve

7 REPLIES 7
Reply
Message 1 of 8
upscale
283 Views, 7 Replies

Single Attribute Retrieve

I have been trying to get this to work, but with no luck, I still keep getting a nil value. The block is there, the attribute is there but no luck. Has anyone been able to do this?

Example: (c:wd_getattrval titleblock "31003.1")

Retrieve an attribute value from a block insert:
(c:wd_getattrval ( comp_en attrname )

comp_en = entity name of block insert
attrname = attribute name to find and retrieve
RETURN = attribute value (or nil if attribute not found)
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: upscale

upscale Try it on an attribute that does not contain a decimal ( . ) point and see if it will work then. Let us know...... -- Regards, Jared Bunch Technical Support Specialist Autodesk, Inc "upscale" wrote in message news:8708197.1074630155961.JavaMail.javamailuser@localhost... > I have been trying to get this to work, but with no luck, I still keep getting a nil value. The block is there, the attribute is there but no luck. Has anyone been able to do this? > > Example: (c:wd_getattrval titleblock "31003.1") > > Retrieve an attribute value from a block insert: > (c:wd_getattrval ( comp_en attrname ) > > comp_en = entity name of block insert > attrname = attribute name to find and retrieve > RETURN = attribute value (or nil if attribute not found)
Message 3 of 8
Anonymous
in reply to: upscale

For a quick test, type this in at the AutoCAD command line: (c:wd_getattrval (car (entsel)) "31003.1") [Enter] You're prompted to pick an object. Pick on the block insert. See if it returns the value of attribute with a tag name of "31003.1"
Message 4 of 8
upscale
in reply to: upscale

I tried it and it works. What I would like to do is to be able to is put in the block name and the attribute in the expression without having to manually pick the block. I have a project here where I have about 500 drawings from an outside vendor to put into our drawing system. I have to place another block on the drawings that is a vendor identification tag that contains our drawing number formats. I am using the title block update features to do this and would like to be able to read the existing titleblock information into this new block, using lisp routines.
Message 5 of 8
upscale
in reply to: upscale

I tried it without the decimal point, but it still gives me the same results.
Message 6 of 8
Anonymous
in reply to: upscale

If there is only one instance of your title block on the drawing, the following expression should return the target attribute value. In this example, your title block name is "TBLOCK" and the attribute you want to grab is called "31003.1". You can make this a lot fancier and safer (adding some error checking), I've just encoded the simplest version into a single line as an example. (setq value (c:wd_getattrval (ssname (ssget "_X" '((2 . "TBLOCK"))) 0) "31003.1")) "upscale" wrote in message news:6641623.1074690203813.JavaMail.jive@jiveforum1.autodesk.com... > I tried it and it works. What I would like to do is to be able to is put in the block name and the attribute in the expression without having to manually pick the block. I have a project here where I have about 500 drawings from an outside vendor to put into our drawing system. I have to place another block on the drawings that is a vendor identification tag that contains our drawing number formats. I am using the title block update features to do this and would like to be able to read the existing titleblock information into this new block, using lisp routines.
Message 7 of 8
upscale
in reply to: upscale

Thanks for the quick reply, there seems to be a glitch in it somewhere. I get a error "malformed list on input".
Message 8 of 8
upscale
in reply to: upscale

My mistake, I copied it directly as it looked on the screen and it had the extra wrap around line in it. It works fine. Thanks for the help.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost