.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Iteration through the Summary Information

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
dennis
783 Views, 3 Replies

Iteration through the Summary Information

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.

3 REPLIES 3
Message 2 of 4
andre_adc-dao
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é

 

Message 3 of 4

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

Message 4 of 4
dennis
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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost