Jump to content

Recommended Posts

Posted

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?

 

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 & [color=red][b]?????[/b][/color] & vbCr
Next theItem

 

Thank you!

Posted

Maybe use the insertion point of the mtext then explode using this pick point to select object ?

 

explode select-object enter acad

explode inspt enter vba ?

Posted
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?

 

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 & [color=red][b]?????[/b][/color] & vbCr
Next theItem

Thank you!

 

You could use

(setq sset (ssget "X" '((0 . "*TEXT"))))
(command"explode" sset"")

It may be possible to take the MText string and create a Text object and explode.

 

Finally,

 

You could create an individual text object for each char using the height of the string in the text object for offsetting

 

I hope one of these is useful

 

EDIT:

 

Recreate each entity delete the original and pass

 CrDrawing.SendCommand "EXPLODE" & vbCr & "(entlast)" & vbCr 

Ollie.

  • 2 weeks later...
Posted
Maybe use the insertion point of the mtext then explode using this pick point to select object ?

 

explode select-object enter acad

explode inspt enter vba ?

 

Private Function MToS(mtext As Variant) As Variant

'

Dim i As Integer

Dim ss As AcadSelectionSet

Dim pTexts As New Collection

ThisDrawing.ActiveSelectionSet.Clear

ThisDrawing.SendCommand "Explode" & vbCr & "(handent " & Chr(34) _

& mtext.Handle & Chr(34) & ")" & vbCr & vbCr

Set ss = ThisDrawing.ActiveSelectionSet

For i = 0 To ss.Count - 1

If UCase(ss(i).ObjectName) = "ACDBTEXT" Then pTexts.Add ss(i)

Next i

MToS = pTexts

End Function

Posted

Thank you for your solutions!

Finally have used this combination of AutoLISP statements with SendCommand – just tried to avoid doing like this. This is because I has some problems in the past when used such combination (AutoLISP routines called from VBA via SendCommand); seems that the VBA interpreter don’t wait for the AutoLISP to finish and execute next statement(s) which obstruct AutoCAD.

 

Regards

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...