Public Sub EntityType() Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim db As Database = ed.Document.Database Dim promptSelectionResult As PromptSelectionResult = ed.GetSelection() If promptSelectionResult.Status = PromptStatus.OK Then Dim selectionSet As SelectionSet = promptSelectionResult.Value Using acTrans As Transaction = ed.Document.TransactionManager.StartTransaction For Each selectedObj As SelectedObject In selectionSet Dim id As ObjectId = selectedObj.ObjectId Using entity As Entity = acTrans.GetObject(id, OpenMode.ForRead) ed.WriteMessage(vbLf & "GetType: " & entity.GetType.ToString) ed.WriteMessage(vbLf & "Handle: " & entity.Handle.ToString) ed.WriteMessage(vbLf & "Layer: " & entity.Layer.ToString) ed.WriteMessage(vbLf & "Color: " & entity.Color.ToString) ed.WriteMessage(vbLf & "Linetype: " & entity.Linetype.ToString) If TypeOf (entity) Is Circle Then Dim circle As Circle = CType(entity, Circle) ed.WriteMessage(vbLf & "Radius: " & circle.Radius.ToString) End If End Using Next acTrans.Commit() End Using End If End Sub
GetObject
- Entity 구별 2015.12.12
Entity 구별
2015. 12. 12. 23:00