• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Electrical

    Reply
    Contributor
    Posts: 11
    Registered: ‎09-24-2012

    VBA: Set Descriptions (1, 2, 3) in drawing properties

    332 Views, 7 Replies
    09-24-2012 04:42 AM

    Hello,

     

    I have a VBA script for AutoCAD Electrical and I want to write something to the drawing propertie 'Description 1', see picture. But, I can't find out how to acces this specific propertie. I can acces properties like 'Project Code' and 'Sheet'. I can acces those properties with 'IEC_PROJ'  and 'SHEET' in my VBA code (Example: If .TagString = "SHEET" Then). They are members of the 'WD_M' block?!

     

    So, can someone please tell me how I can acces the propertie 'Description 1' with a VBA script??

     

    Thank you very much.

     

    Drawing_Properties.jpg

    Please use plain text.
    *Expert Elite*
    Posts: 977
    Registered: ‎03-09-2004

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    09-24-2012 06:17 AM in reply to: 110000474593

    This information resides in the .wdp file.

     

    It is not stored in the WD_M block like the other items you mentioned. If you want to modify the DESC# values, you will need to somehow access the .wdp and then force a titleblock update to "push" the data to the drawings.

     

    I wrote a .lsp program to comcatentate these values in the drawing which required that I add 3 new attributes to the titleblock for DESC storage. I was thinking about writing a program to access the .wdp and extract the DESC values from the drawing and put them into the .wdp but never got around to it.

     

    http://forums.autodesk.com/t5/AutoCAD-Electrical/Concatenating-DD-values-on-a-titleblock/m-p/3517902...

     

    Maybe this might help you...

    Bob Hanrahan
    Ace User since 1998
    Please use plain text.
    Contributor
    Posts: 11
    Registered: ‎09-24-2012

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    09-24-2012 11:31 PM in reply to: 110000474593

    Thank you for your answer and .lsp program.

     

    Do you think/know this is the only way to do this? What do you mean with: 'Force a titleblock update'? I mean, which titleblock do I have to update?

     

    If I understand you, all the descriptions for each drawing must be stored in the .wdp file? And what about the 'default.wdt'  file?  It is possible to mapping some attributes there isn't it?

    Please use plain text.
    *Expert Elite*
    Posts: 977
    Registered: ‎03-09-2004

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    09-25-2012 06:11 AM in reply to: 110000474593

    The data from the .wdp does not automatically get inserted into a drawing when the .wdp is editted. YOu have to do a Titleblock update. WHen I say "force" I just mean that whatever program you create will have to do a titleblock update to push the changes to the drawings.

     

    I do not use the default. wdt file. I have a WD_TB attribute in each drawing that hold this info.

     

    Either format controls how information is sent to the drawing from the project and drawing properties windows.

    Bob Hanrahan
    Ace User since 1998
    Please use plain text.
    Contributor
    Posts: 11
    Registered: ‎09-24-2012

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    10-01-2012 04:16 AM in reply to: 110000474593

    I've managed to add the descriptions to the drawing properties. In the Autodesk API Reference, section G - Project Management, there is a 'ace_add_dwg_to_project' function. With this function you can set 'Drawing Descriptions'.

    Please use plain text.
    *Expert Elite*
    Posts: 977
    Registered: ‎03-09-2004

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    10-01-2012 06:41 AM in reply to: 110000474593

    I will definitely have to check that out. I often want to be able to set Rev values on the sheet on a per drawing basis and this sounds like what I need.

    Bob Hanrahan
    Ace User since 1998
    Please use plain text.
    *Expert Elite*
    Posts: 977
    Registered: ‎03-09-2004

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    10-01-2012 12:17 PM in reply to: testsubject

    I misread this. I thought I would be able to add more DESC lines to an existing drawing, not fill in the 3 DESC lines.

     

    Back to the drawing board...

    Bob Hanrahan
    Ace User since 1998
    Please use plain text.
    Distinguished Contributor
    CAD-ICE
    Posts: 243
    Registered: ‎02-21-2009

    Re: VBA: Set Descriptions (1, 2, 3) in drawing properties

    10-01-2012 01:28 PM in reply to: 110000474593

    Hi there,

    I´m not sure what version of ACADE you are using but I think that from version 2011 you can export the drawing settings to an Excel file and edit the description for each drawing and then re-import them back to your project (see attached image) very appreciated feature indeed :smileyhappy:

    Regards, Gary

     

     

    Please use plain text.