Question for the specialists ?
We can determine the number of modelspace objects using a selection set and this is acceptable fast for up to 100 000 entities.
But is in't it possible to get the count using the old c style way of getting the first and the last of the linked list divided by the pointer size ?
Currently this is myWay:
<CommandMethod("SelectAll")> _
Public Sub SelectAll()
Dim Ed As Editor = DocumentManager.MdiActiveDocument.Editor
Dim selRes As PromptSelectionResult = Ed.SelectAll
If selRes.Status = PromptStatus.OK Then
Dim allEnts As SelectionSet = selRes.Value
MsgBox(allEnts.Count)
End If
End Sub
But i am looking for something like this:
..
Dim mS As BlockTableRecord = theBT(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForRead)
' hypothetical
dim count as integer = (ms.getLast-ms.getfirst)/sizeof(integer)
thanks for any comment on this.
Solved! Go to Solution.
Wow, nice one liner for C#, however wherer is this property for the MS Tablerecord in VB, or is the one reason to switch to C ?!
<CommandMethod("SelectAll2")> _
Public Sub SelectAll2()
Dim theDWG As Document = DocumentManager.MdiActiveDocument
Using tr As Transaction = theDWG.TransactionManager.StartTransaction
Dim btS As BlockTable = theDWG.Database.BlockTableId.GetObject(OpenMode.ForRead)
Dim ms As BlockTableRecord = btS(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForRead)
End Using
End Sub
Can't find what you're looking for? Ask the community or share your knowledge.