.NET

Reply
New Member
Posts: 2
Registered: ‎07-10-2006
Message 1 of 2 (63 Views)

determine the layer the block is on?

63 Views, 1 Replies
07-10-2006 02:14 PM
This is the code I have:

Dim db As Database = HostApplicationServices.WorkingDatabase
Dim trans As Transaction = db.TransactionManager.StartTransaction()

Dim id As ObjectId
Dim bt As BlockTable = CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead), BlockTable)
For Each id In bt
Dim oName As String = CType(trans.GetObject(id, OpenMode.ForRead), BlockTableRecord).Name
Dim _block As BlockTableRecord = CType(trans.GetObject(id, OpenMode.ForRead), BlockTableRecord)
Next

_block.Name.ToString() will give me the name of the block but is there a way to determine what layer that block is on?
*Norman Yuan
Message 2 of 2 (63 Views)

Re: determine the layer the block is on?

07-13-2006 08:19 AM in reply to: javi-e
-block in your code is a BlockTableRecord object, which is just a block
definition, not a block (BlockReference) inserted onto a drawing, so, it
does not lie on any layer (of course the entities that are part of the block
definition are on layer(s)).

Are you actually asking a block reference that is the reference to _block?
If so, it could be on any layer, and a BlockTableRecord may have many
BlockReferences on different layers.

wrote in message news:5232351@discussion.autodesk.com...
This is the code I have:

Dim db As Database = HostApplicationServices.WorkingDatabase
Dim trans As Transaction = db.TransactionManager.StartTransaction()

Dim id As ObjectId
Dim bt As BlockTable = CType(trans.GetObject(db.BlockTableId,
OpenMode.ForRead), BlockTable)
For Each id In bt
Dim oName As String = CType(trans.GetObject(id,
OpenMode.ForRead), BlockTableRecord).Name
Dim _block As BlockTableRecord = CType(trans.GetObject(id,
OpenMode.ForRead), BlockTableRecord)
Next

_block.Name.ToString() will give me the name of the block but is there a way
to determine what layer that block is on?

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