Message 1 of 3
How to obtain the name of a block
Not applicable
07-10-2005
10:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
How to obtain the name of a block ?
<CommandMethod("LISTBLOCK")> _
Public Sub ListBlock()
Dim ed As Editor =
AcApp.Application.DocumentManager.MdiActiveDocument.Editor
AcApp.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database =
HostApplicationServices.WorkingDatabase
HostApplicationServices.WorkingDatabase
Dim trans As Transaction =
db.TransactionManager.StartTransaction()
db.TransactionManager.StartTransaction()
Try
Dim bt As BlockTable
= CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead),
BlockTable)
= CType(trans.GetObject(db.BlockTableId, OpenMode.ForRead),
BlockTable)
Dim btr As
BlockTableRecord = CType(trans.GetObject(bt(btr.ModelSpace), OpenMode.ForRead),
BlockTableRecord)
BlockTableRecord = CType(trans.GetObject(bt(btr.ModelSpace), OpenMode.ForRead),
BlockTableRecord)
Dim id As
ObjectId
ObjectId
For Each id In
btr
btr
Dim ent As Entity = CType(trans.GetObject(id, OpenMode.ForRead, False),
Entity)
If
TypeOf ent Is BlockReference Then
TypeOf ent Is BlockReference Then
'?????
End If
Next
Catch ex As Exception
ed.WriteMessage("Error ListBlock")
Finally
trans.Dispose()
End Try
End Sub