12/13/2022 0 Comments Autocad lisp dwgprops as variableOur DevBlog for Infrastructure Modeling technology APIs. Our DevBlog for Cloud and Mobile technologies with a strong emphasis on the Autodesk Forge APIs. Our DevBlog for AutoCAD and other platform technology APIs. Our DevBlog for Revit, Navisworks, AEC and BIM technology APIs. Please enable JavaScript if you would like to comment on this blog. (princ (strcat "RevisionNumber = " dProp "\n")) (setq dProp (vlax-get-Property dProps 'RevisionNumber)) (princ (strcat "LastSavedBy = " dProp "\n")) (setq dProp (vlax-get-Property dProps 'LastSavedBy)) (princ (strcat "HyperlinkBase = " dProp "\n")) (setq dProp (vlax-get-Property dProps 'HyperlinkBase)) (princ (strcat "Comments = " dProp "\n")) (setq dProp (vlax-get-Property dProps 'Comments)) (princ (strcat "Keywords = " dProp "\n")) (setq dProp (vlax-get-Property dProps 'Keywords)) (setq dProp (vlax-get-Property dProps 'Author)) (setq dProp (vlax-get-Property dProps 'Subject)) (setq dProp (vlax-get-Property dProps 'Title)) Access the updated properties and print them to the command window (vla-addcustominfo dProps "test custom" "custom value") (vlax-put-Property dProps 'RevisionNumber "1") ![]() ![]() (vlax-put-Property dProps 'HyperlinkBase "\\\\(vlax-put-Property dProps 'LastSavedBy "Tester") (vlax-put-Property dProps 'Comments "This is a comment") (vlax-put-Property dProps 'Keywords "One Two Three") (vlax-put-Property dProps 'Author "Test Author") (vlax-put-Property dProps 'Subject "Test Subject") (vlax-put-Property dProps 'Title "Test Title") (setq dProps (vlax-get-Property acadDocument 'SummaryInfo)) (setq acadDocument (vla-get-ActiveDocument acadObject)) However, values which are set by the ActiveX methods are always immediately reflected in the user interface. If the drawing is saved and then reopened, the values previously changed in the user interface are returned by the ActiveX properties. Note: Values which are changed in the user interface are not immediately reflected in the ActiveX properties. Here is a Visual Lisp example that will update the Drawing Properties for the active drawing. 'my value 1 = is the left column and 'myvalue2 is the right one.Is there a lisp example that shows how to access Drawing Properties? Under the number dprops (in this case 5) the user-defined properties are listed starting from the top. (vla-getCustomByIndex dProps 5 'myValue1 'myValue2) For those of you who are looking for the same, here is the code: (setq prop (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))))Īlso (vla-put-keywords prop "structural") Sorry was trying to go step ahead this works and yes but you must know the property name. (princ (strcat "Field Book # = " myValue "\n")) (vla-getCustomByKey dProps "Field Book" 'myValue) (vla-setCustomByKey dProps "Field Book" fieldbook) the drawing properties, (which they will after running this one time) comment this vla-addCustomInfo if the entries already exist in (setq fieldbook (getstring T "Enter Field Book # ")) I have another that sets the CAD username as "Drawn by" and another with a drop-down dialog box to select the engineer for the signature box and this simple one for referencing the Field Book number the notes are in: (princ "\nPages")(princ (vla-GetCustomByKey SummaryInfo key 'pval)) This will return the custom drawing property named "Signature" in the variable pval (while (and (null KeyValue)(< Ke圜ount (vla-NumCustomInfo SummaryInfo))) ![]() (setq Ke圜ount 0 placeholder for CustProp position (if(=(vla-get-HyperlinkBase SummaryInfo) "")(vla-put-HyperlinkBase SummaryInfo "")) (if(=(vla-get-Subject SummaryInfo) "")(vla-put-Subject SummaryInfo "My Subject")) (if(=(vla-get-Title SummaryInfo) "")(vla-put-Title SummaryInfo (vl-filename-base (getvar "dwgname")))) (setq doc (vla-Get-ActiveDocument (vlax-Get-Acad-Object)) (defun C:CustomPropsLeon ( / doc SummaryInfo Ke圜ount KeyValue EngOfRec EOR dcl_id SIZ) Command line: (load "CustomPropsLeon.lsp") CustomPropsLeon Macro: ^P(or CustomPropsLeon (load "CustomPropsLeon.lsp")) CustomPropsLeon This macro sets up the custom properties for my drawings: I'd recomend using vla-GetCustomByIndex
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |