.NET

Reply
Valued Mentor
dennis
Posts: 732
Registered: ‎07-29-2005
Message 1 of 4 (165 Views)
Accepted Solution

Iteration through the Summary Information

165 Views, 3 Replies
06-13-2014 12:07 PM

I have VB.NET code that will create the Summary Info for the Drawing Properties.  Even can create Custom Info.  However, what I want to do is capture the existing names/values and then change just certain ones.  I also want to do this with FIELDS.  I am not having much success so thought I would ask if anyone has some code to share or insights that would help me.

Thanks folks for the directions.  I will be able to study this later today and hopefully i will be well on my way.

Valued Contributor
andred
Posts: 89
Registered: ‎10-17-2003
Message 2 of 4 (127 Views)

Re: Iteration through the Summary Information

06-16-2014 10:03 AM in reply to: dennis

Hi,

 

I attached a document containing two functions:

 

AddDocumentCustomField: To add or update Drawing Custom Properties

GetDocumentCustomField: To get Drawing Custom Properties  value

 

I didn't found how to update only one value, so  I update all SummaryInfo.

 

About FIELDS, what are you questions exactly?

 

Regards,

 

André

 

ADN Support Specialist
philippe.leefsma
Posts: 649
Registered: ‎06-02-2009
Message 3 of 4 (114 Views)

Re: Iteration through the Summary Information

06-16-2014 11:57 AM in reply to: andred

You have to set the whole SummaryInfo as André mentioned:

 

[CommandMethod("SetDbProperties")]
static public void SetDbProperties()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

    Database db = new Database(false, true);
    db.ReadDwgFile("c:\\Temp\\Drawing1.dwg", System.IO.FileShare.ReadWrite, true, "");
         
    DatabaseSummaryInfoBuilder builder = new DatabaseSummaryInfoBuilder();

    builder.Author = "Felipe";
    builder.CustomPropertyTable.Add("Department", "Purchase");

    db.SummaryInfo = builder.ToDatabaseSummaryInfo();

    db.SaveAs(db.Filename, DwgVersion.Current);
}

[CommandMethod("GetDbProperties")]
static public void GetDbProperties()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

    Database db = new Database(false, true);
    db.ReadDwgFile("c:\\Temp\\Drawing1.dwg", System.IO.FileShare.Read, true, "");

    DatabaseSummaryInfo props = db.SummaryInfo;

    ed.WriteMessage("\n------------- Drawing Properties -------------");
    ed.WriteMessage("\n- Title      : " + props.Title);
    ed.WriteMessage("\n- Author     : " + props.Author);
    ed.WriteMessage("\n- LastSavedBy: " + props.LastSavedBy);

    System.Collections.IDictionaryEnumerator custProps = props.CustomProperties;

    while (custProps.MoveNext())
    {
        ed.WriteMessage("\n- Custom Prop: " + custProps.Key + " = " + custProps.Value);
    }
}

 Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Valued Mentor
dennis
Posts: 732
Registered: ‎07-29-2005
Message 4 of 4 (94 Views)

Re: Iteration through the Summary Information

06-17-2014 05:48 AM in reply to: philippe.leefsma

Thanks folks for the directions.  I will be able to study this later today and hopefully i will be well on my way.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.