DWGPROPS - lisp

DWGPROPS - lisp

Flies-Eyes
Advisor Advisor
411 Views
1 Reply
Message 1 of 2

DWGPROPS - lisp

Flies-Eyes
Advisor
Advisor

I have read a few articles on the forum that discuss how to add custom fields using the DWGPROPS command.  I can manage to get a script to create my custom fields, although I can't seem to automate the process without having to hit the enter key to confirm each of the new custom fields.  How do automate the process so I don't need to confirm each new entry?

 

 

 

 

(defun addCustomProperty (propName / acadDoc customProp)
(vl-load-com) ; Load the Visual LISP COM support

; Get the current document
(setq acadDoc (vla-get-ActiveDocument (vlax-get-acad-object)))

; Try to get the custom property
(setq customProp (vl-catch-all-apply 'vla-GetCustomByKey
(list (vla-get-SummaryInfo acadDoc) propName)))

; Add the custom field if it doesn't exist
(if (vl-catch-all-error-p customProp)
(vla-AddCustomInfo (vla-get-SummaryInfo acadDoc) propName "")
)
)

(defun c:CreateCustomFields ()
(addCustomProperty "Project Number" )
(addCustomProperty "Project Site" )
(addCustomProperty "Project Description" )
(addCustomProperty "Address 1" )
(addCustomProperty "Address 2" )
(addCustomProperty "Address 3" )
(addCustomProperty "Client Name" )
(addCustomProperty "Client Project Number" )
(princ "\nCustom field names added successfully." )
(princ)
)

0 Likes
Accepted solutions (1)
412 Views
1 Reply
Reply (1)
Message 2 of 2

paullimapa
Mentor
Mentor
Accepted solution

I didn't need to hit confirm. I just loaded and ran the CREATECUSTOMFIELDS command and then I ran the DWGProps command and saw everything filled out:

paullimapa_0-1708232228515.png

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos