.NET

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

determine the layer the block is on?

69 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 (69 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?
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.