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

determine the layer the block is on?

1 REPLY 1
Reply
Message 1 of 2
Anonymous
185 Views, 1 Reply

determine the layer the block is on?

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?
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

-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?

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report