Author Topic: Exploding MText entities through VBA  (Read 4204 times)

0 Members and 1 Guest are viewing this topic.

msasu

  • Mosquito
  • Posts: 13
Exploding MText entities through VBA
« 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!

Bryco

  • Water Moccasin
  • Posts: 1883
Re: Exploding MText entities through VBA
« Reply #1 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?? )