.NET

Reply
*Genoud Alain
Message 1 of 4 (140 Views)

How to count entyties with .NET

140 Views, 3 Replies
07-09-2005 10:10 PM
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
*Frank Oquendo
Message 2 of 4 (140 Views)

Re: How to count entyties with .NET

07-10-2005 08:32 AM in reply to: *Genoud Alain
Is there any reason you can't just use the SelectAll ActiveX method and
query the count?

--
http://www.acadx.com
*Tony Tanzillo
Message 3 of 4 (140 Views)

Re: How to count entyties with .NET

07-10-2005 12:15 PM in reply to: *Genoud Alain
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
*Alan
Message 4 of 4 (140 Views)

Re: How to count entyties with .NET

07-10-2005 09:32 PM in reply to: *Genoud Alain
"Genoud Alain" a écrit dans le message de
news:4897264@discussion.autodesk.com...

Danks !

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community