Autodesk.AutoCAD.DatabaseServices.ImpCurve
程序代码: |
<CommandMethod(ns, "type", CommandFlags.Modal)> _
Public Sub ShowType()
Dim dwg As Document = acad.DocumentManager.MdiActiveDocument
Dim result As PromptEntityResult = ed.GetEntity(vbLf & "Select entity: ")
If result.Status = PromptStatus.OK Then
Using t As Transaction = dwg.TransactionManager.StartTransaction()
Dim x As DBObject = t.GetObject(result.ObjectId, OpenMode.ForRead)
Dim type As Type = x.[GetType]()
ed.WriteMessage(String.Format(vbLf & "Type: '{0}'", type.ToString()))
ed.WriteMessage(String.Format(vbLf & "IsPublic: '{0}'", type.IsPublic))
ed.WriteMessage(String.Format(vbLf & "Assembly: '{0}'" & vbLf, type.Assembly.FullName))
ed.WriteMessage(New String("*"C, 30))
ed.WriteMessage(vbLf)
Dim props As PropertyInfo() = type.GetProperties().OrderBy(Function(n) n.Name).ToArray()
Dim dict As New Dictionary(Of String, Object)()
For Each item As PropertyInfo In props
Dim value As Object
Try
value = item.GetValue(x, Nothing)
Catch e As System.Exception
value = String.Format("Exception: '{0}'", e.Message)
End Try
dict.Add(String.Format("{0} [{1}]", item.Name, item.PropertyType), value)
ed.WriteMessage(String.Format(vbLf & vbTab & "Property: '{0}';" & vbTab & "Type: '{1}';" & vbTab & "Value.ToString: '{2}'", item.Name, item.PropertyType, value))
Next
End Using
End If
End Sub
[本日志由 tiancao1001 于 2019-05-23 12:17 AM 编辑]
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |