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

How to count entyties with .NET

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
288 Views, 3 Replies

How to count entyties with .NET

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
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

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

--
http://www.acadx.com
Message 3 of 4
Anonymous
in reply to: Anonymous

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
Message 4 of 4
Anonymous
in reply to: Anonymous

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

Danks !

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost