Adding custom metadata to Documents


按此在新窗口打开图片

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




一个面向.NET开发人员的AutoCAD OPM扩展模块

.Editor.WriteMessage

欢迎关注微信公众账号ByCAD