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

Custom properties

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
235 Views, 2 Replies

Custom properties

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
2 REPLIES 2
Message 2 of 3
dmarcotte4
in reply to: Anonymous

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
Message 3 of 3
Anonymous
in reply to: Anonymous

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

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