.NET

Reply
Distinguished Contributor
Patrick Johnson
Posts: 229
Registered: ‎04-26-2005
Message 1 of 3 (117 Views)

Custom properties

117 Views, 2 Replies
11-03-2006 11:36 AM
How do you go about updating customproperties?
I see you can use the IDictionaryEnumerator and loop thru the collection, however this is only read only.

thanks


pat
Distinguished Contributor
dmarcotte4
Posts: 195
Registered: ‎04-02-2005
Message 2 of 3 (117 Views)

Re: Custom properties

11-03-2006 12:12 PM in reply to: Patrick Johnson
I have always used com for this
I would like to learn a .net way though

AcadDocument doc = (AcadDocument)AcadApp.DocumentManager.MdiActiveDocument.AcadDocument;

doc.SummaryInfo.SetCustomByKey(key, val)
doc.SummaryInfo.AddCustomInfo(key, val) Message was edited by: Danielm
Distinguished Contributor
Patrick Johnson
Posts: 229
Registered: ‎04-26-2005
Message 3 of 3 (117 Views)

Re: Custom properties

11-03-2006 12:23 PM in reply to: Patrick Johnson
I did figure it out, here is a snapshot of the code
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click

Dim DB As Database = Application.DocumentManager.MdiActiveDocument.Database
Dim objSumBuilder As New DatabaseSummaryInfoBuilder

Try
objSumBuilder.Author = txtDrafter.Text
objSumBuilder.Title = txtCustomer.Text
objSumBuilder.CustomProperties.Item("Office") = "test"
objSumBuilder.CustomProperties.Item("Checker") = "test1"
DB.SummaryInfo = objSumBuilder.ToDatabaseSummaryInfo
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Exception")
Finally
objSumBuilder = Nothing
End Try

the custom properties I just called the key and set the value.
It worked, I did learn something - it writes over the top so if there is information there you need to make sure you add it back in.


pat


End Sub
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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