TheSwamp

Code Red => VB(A) => Topic started by: msasu on June 11, 2009, 01:02:06 AM

Title: Exploding MText entities through VBA
Post by: msasu on June 11, 2009, 01:02:06 AM
Hello,

Since the MText entities in AutoCAD’s VBA doesn’t support the .Explode method I’m trying to get them converted to Text type by using SendCommand – something that avoided at all in the past, so lack of clues.
Can someone tell me how to pass the current entity from a selection set to SendCommand statement?

Code: [Select]
Dim ItemsSSet As AcadSelectionSet
Dim FType(0) As Integer
Dim FData(0) As Variant
Dim theItem As Variant

FType(0) = 0
FData(0) = "MTEXT"

Set ItemsSSet = CrDrawing.SelectionSets.Add("SS1")
ItemsSSet.Select Mode:=5, FilterType:=FType, FilterData:=FData

For Each theItem In ItemsSSet
    CrDrawing.SendCommand "EXPLODE" & vbCr & ????? & vbCr
Next theItem

Thank you!
Title: Re: Exploding MText entities through VBA
Post by: Bryco on June 15, 2009, 08:38:55 PM

ThisDrawing.SendCommand "EXPLODE" & vbCr & SendCommandSelection(t) & vbCr & vbCr
where t is the mtext

Function SendCommandSelection(ent As AcadEntity) As String
    SendCommandSelection = "(handent " & Chr(34) & ent.Handle & Chr(34) & ")"
End Function

(Function stolen from the swamp probably Jeff?? )