Block Reference question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
1. first I have a drawing called "test1"
2. and a drawing call "Dwg1" Inside this drawing is a block called "Block1"
3. now after I insert Drawing "Dwg1" into drawing "test1" I explode it then I save and close the drawing test1.
4. now I run this code on drawing Test1 and it gives me a block count of 2 for block "Block1"
but there is only one block Reference in the drawing called "Block1"
yes I know when I inserted the Drawing "dwg1" is comes in as a block called "dwg1" and inside that Block is a block called "block1"
now my code count the block1 that is inside the drawing/block called "dwg1 Even though i exploded the drawing/block "dwg1"
my question is Even though i exploded the Drawing/block "dwg1" why does "block1" that was inside Drawing/block "dwg1" show up as a Block Reference?
and how do i work around this so i only get the Block Reference that is really in the drawing.
Public Sub DwgTest(ByVal pathtodwg As String, ByVal blockname As String)
Dim db As Database = New Database(False, False)
If IO.File.Exists(pathtodwg) = True Then
db.ReadDwgFile(pathtodwg, System.IO.FileShare.Read, False, Nothing)
Using Trans As Transaction = db.TransactionManager.StartTransaction
Dim bktbl As BlockTable = db.BlockTableId.GetObject(OpenMode.ForRead)
Dim revblk As BlockTableRecord = bktbl(blockname).GetObject(OpenMode.ForRead)
Dim refs As ObjectIdCollection = revblk.GetBlockReferenceIds(False, False)
MsgBox(refs.Count.ToString)
End Using
db.Dispose()
End If
End Sub