Community
<CommandMethod("LISTBLOCK")> _
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Alan" <sscvs@bluewin.ch>
wrote in message
href="news:4897475@discussion.autodesk.com">news:4897475@discussion.autodesk.com...
Hi
How to obtain the name of a block ?
<CommandMethod("LISTBLOCK")>
_
Public Sub ListBlock()
Dim ed As Editor =
AcApp.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database =
HostApplicationServices.WorkingDatabase
Dim trans As Transaction =
db.TransactionManager.StartTransaction()
Try
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)
Dim id As
ObjectId
For Each id In
btr
Dim ent As Entity = CType(trans.GetObject(id, OpenMode.ForRead, False),
Entity)
If TypeOf ent Is BlockReference Then
'?????
End If
Next
Catch ex As Exception
ed.WriteMessage("Error ListBlock")
Finally
trans.Dispose()
End
Try
End
Sub
This Code is ok !.
Danks M. Jon Prisbe !... Alan
<CommandMethod("LISTBLOCK")> _
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Alan" <sscvs@bluewin.ch> a
écrit dans le message de
href="news:4897475@discussion.autodesk.com">news:4897475@discussion.autodesk.com...
Hi
How to obtain the name of a block ?
<CommandMethod("LISTBLOCK")>
_
Public Sub ListBlock()
Dim ed As Editor =
AcApp.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database =
HostApplicationServices.WorkingDatabase
Dim trans As Transaction =
db.TransactionManager.StartTransaction()
Try
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)
Dim id As
ObjectId
For Each id In
btr
Dim ent As Entity = CType(trans.GetObject(id, OpenMode.ForRead, False),
Entity)
If TypeOf ent Is BlockReference Then
'?????
End If
Next
Catch ex As Exception
ed.WriteMessage("Error ListBlock")
Finally
trans.Dispose()
End
Try
End
Sub
Can't find what you're looking for? Ask the community or share your knowledge.