Hi Dears,
I have a simple question: how to programatically in AutoLisp GET and SET the drawing descriptions from Drawing Properties (Description 1, 2 and 3) in AutoCAD Electrical 2012 ?
I need change this values through a script in LISP.
Thanks in advance!
I don't use Electrical, but if it is the same as AutoCAD, the properties will be found under the SummaryInfo Object.
The SummaryInfo Object is a property of the ActiveDocument:
(setq acsum (vla-get-summaryinfo (vla-get-activedocument (vlax-get-acad-object)) ) )
This Object has the following properties and methods:
; IAcadSummaryInfo: IAcadSummaryInfo Interface ; Property values: ; Author = "" ; Comments = "" ; HyperlinkBase = "" ; Keywords = "" ; LastSavedBy = "" ; RevisionNumber = "" ; Subject = "" ; Title = "" ; Methods supported: ; AddCustomInfo (2) ; GetCustomByIndex (3) ; GetCustomByKey (2) ; NumCustomInfo () ; RemoveCustomByIndex (1) ; RemoveCustomByKey (1) ; SetCustomByIndex (3) ; SetCustomByKey (2)
Hence you can set / retrieve the standard properties using such functions as:
(vla-get-author acsum) (vla-put-author acsum "Me") (vla-get-title acsum) (vla-put-title acsum "My Title") (vla-get-comments acsum) (vla-put-comments acsum "My Comments") (vla-get-subject acsum) (vla-put-subject acsum "My Subject") (vla-get-revisionnumber acsum) (vla-put-revisionnumber acsum "1") (vla-get-lastsavedby acsum) (vla-put-lastsavedby acsum "Me") (vla-get-hyperlinkbase acsum) (vla-put-hyperlinkbase acsum "My HyperlinkBase") (vla-get-keywords acsum) (vla-put-keywords acsum "My Keywords")
The Custom Drawing Properties can be accessed using the various Methods of the SummaryInfo Object, for example to retrieve an association list of all Custom Drawing Properties, consider the following function:
(defun LM:GetCustomProperties ( summaryinfo / i key value result ) (repeat (setq i (vla-NumCustomInfo summaryinfo)) (vla-GetCustomByIndex summaryinfo (setq i (1- i)) 'key 'value) (setq result (cons (cons key value) result)) ) result ) (LM:GetCustomProperties acsum)
Or to get or set a specific Custom Property using the name (or key) of that property, consider the methods:
(vla-getcustombykey acsum "My Key") (vla-setcustombykey acsum "My Key" "My Value")
Note that the above methods will error should the key not be found in the Custom Drawing Properties.
Finally, to add a new Custom Drawing Property, use the vla-addcustominfo function:
(vla-addcustominfo acsum "My Custom Prop" "My Custom Value")
Lee,
Thank you for answer!
But, I need have access others drawing descriptions specific of the Electrical.
For example: This is default properties from AutoCAD (Electrical too) :
But, I need access another page/information, specific of AutoCAD Electrical:
Did you understand ?
Can't find what you're looking for? Ask the community or share your knowledge.