• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    *Genoud Alain

    How to count entyties with .NET

    133 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
    Please use plain text.
    *Frank Oquendo

    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
    Please use plain text.
    *Tony Tanzillo

    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
    Please use plain text.
    *Alan

    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 !
    Please use plain text.