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.
Solved! Go to Solution.
Solved by dennis. Go to Solution.
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é
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.
Thanks folks for the directions. I will be able to study this later today and hopefully i will be well on my way.