How to count entyties with .NET

How to count entyties with .NET

Anonymous
Not applicable
555 Views
3 Replies
Message 1 of 4

How to count entyties with .NET

Anonymous
Not applicable
Hi,

How to count Entyties in MODELSPACE with .NET ?

_

Public Sub GetInfos()

Dim db As Database = HostApplicationServices.WorkingDatabase

Dim Trans As Transaction = db.TransactionManager.StartTransaction()

Dim Bt As BlockTable = CType(Trans.GetObject(db.BlockTableId,
OpenMode.ForRead), BlockTable)

Dim Btr As BlockTableRecord = CType(Trans.GetObject(Bt(Btr.ModelSpace),
OpenMode.ForRead), BlockTableRecord)

???

Trans.Dispose()

End Sub
0 Likes
556 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Is there any reason you can't just use the SelectAll ActiveX method and
query the count?

--
http://www.acadx.com
0 Likes
Message 3 of 4

Anonymous
Not applicable
Here it is in C#:

int count = 0;
foreach( ObjectId id in SomeBlockTableRecord )
{
++ count;
}

That's essentially what AutoCAD does to get it,
and there is no simple way to do it.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com

"Genoud Alain" wrote in message news:4897264@discussion.autodesk.com...
Hi,

How to count Entyties in MODELSPACE with .NET ?

_

Public Sub GetInfos()

Dim db As Database = HostApplicationServices.WorkingDatabase

Dim Trans As Transaction = db.TransactionManager.StartTransaction()

Dim Bt As BlockTable = CType(Trans.GetObject(db.BlockTableId,
OpenMode.ForRead), BlockTable)

Dim Btr As BlockTableRecord = CType(Trans.GetObject(Bt(Btr.ModelSpace),
OpenMode.ForRead), BlockTableRecord)

???

Trans.Dispose()

End Sub
0 Likes
Message 4 of 4

Anonymous
Not applicable
"Genoud Alain" a écrit dans le message de
news:4897264@discussion.autodesk.com...

Danks !
0 Likes