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
vb
Entity 구별
2015. 12. 12. 23:00
포인트 정렬2
2015. 12. 10. 22:37
Imports System.Drawing Imports System.Collections.Generic Module Module1 Public Structure Man Dim Name As String Dim Age As Integer End Structure Sub Main() Dim dict As New Dictionary(Of PointF, Man) For i As Integer = 0 To 2 Dim pt As PointF = New PointF(i * 2, i * 3) Dim aMan As Man = New Man() aMan.Name = "Sam " + i.ToString aMan.Age = (i + 1) * 10 dict.Add(pt, aMan) Next Dim sortDict = (From pair In dict Order By pair.Key.Y Descending Select pair) For Each kvp As KeyValuePair(Of PointF, Man) In sortDict Dim key As PointF = kvp.Key Dim value As Man = kvp.Value Dim str As String = String.Format("{0} / {1} / {2}", key.ToString, value.Name, value.Age.ToString) Console.WriteLine(str) Next Console.WriteLine() Console.ReadKey() End Sub End Module포인트를 정렬할 수 있는 샘플입니다. 테스트 문장입니다.