How To Re-Assemble Exploded Block

How To Re-Assemble Exploded Block

Anonymous
Not applicable
298 Views
2 Replies
Message 1 of 3

How To Re-Assemble Exploded Block

Anonymous
Not applicable
Hello,

I am trying to re-assemble a block that I have exploded. Is this possible? The block consisted of an ACADText object and an ACADLWPolyline object. I have successfully obtained the property values of the individual objects that formerly made up the block. Now I simply want to put the block back together. My code looks like the following:


****Begin Code********
Global ExplodedObjects As Variant
Dim SelectedBlockReference As AcadBlockReference
Dim SelectionSet As AcadSelectionSet
Dim BOMPieceMarkRef as String
Dim BOMPieceMarkID As String
Dim TheLayer As String

Set SelectionSet = ThisDrawing.ActiveSelectionSet
Set SelectedBlockReference = SelectionSet(0)

ExplodedObjects = SelectedBlockReference.Explode
For i = 0 To UBound(ExplodedObjects)
ExplodedObjects(i).Update
If ExplodedObjects(i).ObjectName = "AcDbText" Then
BOMPieceMarkRef = ExplodedObjects(i).TextString
BOMPieceMarkID = ExplodedObjects(i).Hyperlinks.Item(0).URL
LayerName = ExplodedObjects(i).Layer
End If
ExplodedObjects(i).Update
Next
*****End Code******


My other option here is to reference the ACADText object's properties inside the block object. That would be nice because I wouldn't have to explode the block at all, but I can't figure out how to do that yet. Any help is greatly appreciated.

Thanks,
T-Tops
0 Likes
299 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
wrote in message news:5554146@discussion.autodesk.com...
My other option here is to reference the ACADText object's properties inside
the block object. That would be nice because I wouldn't have to explode the
block at all, but I can't figure out how to do that yet. Any help is greatly
appreciated.

Thanks,
T-Tops

Here's one way to get Text within a block definition without exploding a
blockref.

Function getTextInBlock(oBlkRef As AcadBlockReference) As Variant
Dim oBlock As AcadBlock
Dim oEnt As AcadEntity
Dim vResult() As AcadText
Dim i As Integer

i = -1
Set oBlock = ThisDrawing.Blocks.Item(oBlkRef.Name)
For Each oEnt In oBlock
If TypeOf oEnt Is AcadText Then
i = i + 1
ReDim Preserve vResult(i)
Set vResult(i) = oEnt
End If
Next

getTextInBlock = vResult
End Function


Sub test()
Dim vPick As Variant
Dim oEnt As AcadEntity
Dim vTest As Variant

'Note this is just a test, make sure to select an Insert!
ThisDrawing.Utility.GetEntity oEnt, vPick, "Select Insert: "
vTest = getTextInBlock(oEnt)

End Sub
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hi

May be the following code is useful.
blk = ThisDrawing.Blocks.Add(ss, "abcde")
Set h = ThisDrawing.PaperSpace.InsertBlock(logo, Me.txtBlockFolder & "\" & Me.ComboBox4.Text, 1, 1, 1, 0)
ent = h.Explode
For i = 0 To UBound(ent)
Call ThisDrawing.CopyObjects(ent(i), blk)
Next
Regards,
shijith
0 Likes