MSasu Posted June 11, 2009 Posted June 11, 2009 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! Quote
BIGAL Posted June 12, 2009 Posted June 12, 2009 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 ? Quote
ollie Posted June 12, 2009 Posted June 12, 2009 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. Quote
xsfhlzh Posted June 22, 2009 Posted June 22, 2009 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 Quote
MSasu Posted June 24, 2009 Author Posted June 24, 2009 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 Quote
Recommended Posts
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.