Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Value of custom field name in the Drawing Properties using Autolisp

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
iharper
2587 Views, 5 Replies

Get Value of custom field name in the Drawing Properties using Autolisp

 

I have a simple Autolisp question, similar to this if anyone can answer. I am writing a routine, and in the routine I want to be able to get (and Store with a Setq if needed) the value from a custom field in the drawing from the Drawing Properties. (for example: FLRLEVEL would be the custom field name in the Drawing Properties and the Value may be something like  02, for the second floor). This field is not really tied to any particular object in the drawing, so I am not sure if it can be done without an Object ID? (Which is what all of the examples have been of) I know I could have the lisp prompt for the floor number, but this routine will be ran multiple times in each DWG and I was hoping to have it stored with the DWG rather than the LISP routine; I have tried GETVAR but it is not found as a system variable. If anyone can assist me I will be forever grateful. Thank you in advance.

5 REPLIES 5
Message 2 of 6
paullimapa
in reply to: iharper

This thread may give you a good start...not sure if it covers custom fields but it covers that standard ones:

http://www.cadtutor.net/forum/showthread.php?87345-Useing-LISP-to-Populate-Drawing-Properties-Fields


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 6
dale_fugier
in reply to: paullimapa

Message 4 of 6
Shneuph
in reply to: iharper

Be sure you have vla functions loaded (vl-load-com)

 

(setq tlv-docSummary (vla-get-summaryinfo (vla-get-activedocument (vlax-get-acad-object))))
(vla-getcustombykey tlv-docSummary "Floor" 'tlv-propname))

 "Floor" is your custom property name (string value) used as KEY to custom property value

 

GetCustomByKey Help

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 5 of 6
iharper
in reply to: Shneuph

Thank you everyone, I was under a tight deadline and was able to figure it out a a few hours after I made the cry for help. Sorry this is the first chance I have had time to reply. I am glad that I know that you are all out there to help me in the future though. Thank you again everyone!

Message 6 of 6
scot-65
in reply to: iharper

In addition to what Pli provided:

Look into VLAX-LDATA-PUT / VLAX-LDATA-GET.
This method hides the information inside the drawing as a
Dictionary and it cannot be edited outside by another program
(such as explorer -> properties dialog).

If you need to store more than one value, under one "key", look into LIST.

Access the information by doing the following:
(VL-LOAD-COM)
(setq a (VLAX-LDATA-GET "MyMenu" "ThisProgram"))

Had you PUT the information as a LIST:
(if (= (nth 0 a) "02")...

One good thing about LIST in LISP is that data types can be mixed
together without issues (LIST, STRING, REAL, INTEGER, ETC.).
(VLAX-LDATA-PUT "MyMenu" "ThisProgram" (list "02" "E2-170" 120.45 65 (getvar "CDATE") '(0.0 1.0) (get_tile "Edi101"))

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


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

Post to forums  

Autodesk Design & Make Report

”Boost