.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

fast methode to detect the modelspace count

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
739 Views, 2 Replies

fast methode to detect the modelspace count

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.

 

 

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

mS.Cast(Of Object)().Count()
Message 3 of 3
Anonymous
in reply to: Anonymous

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.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report