AutoCAD 2004 Drawing Properties

Discussion in 'AutoCAD' started by Nick Schuckert, Dec 16, 2003.

  1. 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 Schuckert, Dec 16, 2003
    #1
  2. 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!
    |
    |
     
    R. Robert Bell, Dec 17, 2003
    #2
  3. 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
     
    Nick Schuckert, Dec 18, 2003
    #3
  4. Glad to have helped!

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


    | 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.
    |
     
    R. Robert Bell, Dec 18, 2003
    #4
  5. Nick Schuckert

    dlinford Guest

    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
     
    dlinford, Nov 22, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.