Adding custom metadata to Documents
https://forums.autodesk.com/t5/net/adding-cu ... #100;ocuments/td-p/3840044
'AddProp
<CommandMethod("TcAddProp")> _
Public Sub TcAddProp()
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim infoBuilder As New DatabaseSummaryInfoBuilder()
infoBuilder.CustomPropertyTable("key1") = "value1"
infoBuilder.CustomPropertyTable("key2") = "value2"
doc.Database.SummaryInfo = infoBuilder.ToDatabaseSummaryInfo()
doc.Database.SaveAs("C:/test.dwg", DwgVersion.Current)
End Sub
'ReadProp
<CommandMethod("ReadProp")> _
Public Sub TcReadProp()
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim db As Database = doc.Database
Dim info As DatabaseSummaryInfo = db.SummaryInfo
Dim cust As System.Collections.IDictionaryEnumerator = info.CustomProperties
While cust.MoveNext()
Dim key As String = TryCast(cust.Entry.Key, String)
Dim value As String = TryCast(cust.Entry.Value, String)
End While
End Sub
[本日志由 tiancao1001 于 2018-09-17 01:51 PM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |