AutoCAD 2004 Drawing Properties

Nick Schuckert

Usenet Archive
Joined
Dec 16, 2003
Messages
2
Reaction score
0
I want to use the SetCustomByIndex and SetCustomByKey ActiveX Methods to write Custom Property Names and Values to the AutoCAD 2004 Drawing Property Sheet. Would someone please post a Visual Lisp example that shows the syntax of these two methods.

Based on my AutoCAD 2004 Drawing Properties investigation, I have not found many examples on this topic. Here is what I have compiled thus far. Hope it's of value...

(vl-load-com)
(setq acadObject (vlax-get-acad-object))
(setq acadDocument (vla-get-ActiveDocument acadObject)) (setq DWGPROPS (vlax-get-Property acadDocument 'SummaryInfo)) ; ; Write Summary Info... ; (vlax-put-Property DWGPROPS 'Title "Some Title") (vlax-put-Property DWGPROPS 'Subject "Some Subject") (vlax-put-Property DWGPROPS 'Author "Some Author") (vlax-put-Property DWGPROPS 'Keywords "Some Keywords") (vlax-put-Property DWGPROPS 'Comments "Some Comments") (vlax-put-Property DWGPROPS 'HyperlinkBase "Some Hyperlink") (vlax-put-Property DWGPROPS 'LastSavedBy "Some Name") (vlax-put-Property DWGPROPS 'RevisionNumber "1") ; ; Write Custom Info... ; (vla-addCustomInfo DWGPROPS "Some Name" "Some Value")

Thanks In Advance!
 
Nick,

You need to add the custom data fields before you can (later) set them using those methods. Note this sample doesn't check for existing matching custom fields.

(defun C:Test (/ App Doc DwgProps)
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
DwgProps (vla-Get-SummaryInfo Doc))
(vla-AddCustomInfo DwgProps "Sample1" "No Data")
(vla-AddCustomInfo DwgProps "Sample2" "No Data")
(vla-SetCustomByIndex DwgProps 0 "Sample1" "Some data") (vla-SetCustomByKey DwgProps "Sample2" "More data")
(princ))

--
R. Robert Bell, MCSE
www.AcadX.com

| I want to use the SetCustomByIndex and SetCustomByKey ActiveX Methods to | write Custom Property Names and Values to the AutoCAD 2004 Drawing Property | Sheet. Would someone please post a Visual Lisp example that shows the syntax | of these two methods. | | Based on my AutoCAD 2004 Drawing Properties investigation, I have not found | many examples on this topic. Here is what I have compiled thus far. Hope | it's of value... | | (vl-load-com) | (setq acadObject (vlax-get-acad-object)) | (setq acadDocument (vla-get-ActiveDocument acadObject)) | (setq DWGPROPS (vlax-get-Property acadDocument 'SummaryInfo)) | ; | ; Write Summary Info... | ; | (vlax-put-Property DWGPROPS 'Title "Some Title") | (vlax-put-Property DWGPROPS 'Subject "Some Subject") | (vlax-put-Property DWGPROPS 'Author "Some Author") | (vlax-put-Property DWGPROPS 'Keywords "Some Keywords") | (vlax-put-Property DWGPROPS 'Comments "Some Comments") | (vlax-put-Property DWGPROPS 'HyperlinkBase "Some Hyperlink") | (vlax-put-Property DWGPROPS 'LastSavedBy "Some Name") | (vlax-put-Property DWGPROPS 'RevisionNumber "1") | ; | ; Write Custom Info... | ; | (vla-addCustomInfo DWGPROPS "Some Name" "Some Value") | | | Thanks In Advance! | |
 
Robert, Thanks!

Your example was a big help. I didn't realize that I needed to initially add the custom data fields. I thought setting the custom data fields was just another choice for me.

Nick
 
How would I do a check for existing matching custom fields? I keep getting error messages when I check and I can't compensate.

David
 

Latest threads

Back
Top