- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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)
)
Solved! Go to Solution.