TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: T.Willey on July 15, 2009, 11:33:50 AM
-
So while working on my explode mtext function, and some real world mtext text, I came across an entity where the width of the character were different than 1.0, and I don't see how that is from the code returned.
; Application (RO) = #<VLA-OBJECT IAcadApplication 00c2eb8c>
; AttachmentPoint = 1
; BackgroundFill = 0
; Document (RO) = #<VLA-OBJECT IAcadDocument 05e797c4>
; DrawingDirection = 5
; Handle (RO) = "EBBE9"
; HasExtensionDictionary (RO) = 0
; Height = 0.09375
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 15b98db4>
; InsertionPoint = (43.5971 22.7282 0.0)
; Layer = "HTEXT"
; LineSpacingDistance = 0.15625
; LineSpacingFactor = 1.0
; LineSpacingStyle = 1
; Linetype = "BYLAYER"
; LinetypeScale = 1.0
; Lineweight = -1
; Normal = (0.0 0.0 1.0)
; ObjectID (RO) = 2125892744
; ObjectName (RO) = "AcDbMText"
; OwnerID (RO) = 2127772840
; PlotStyleName = "ByLayer"
; Rotation = 0.0
; StyleName = "romans"
; TextString = "testing"
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 15b98c10>
; Visible = -1
; Width = 3.73509
(-1 . <Entity name: 7eb68c88>)
(0 . "MTEXT")
(330 . <Entity name: 7ed33ca8>)
(5 . "EBBE9")
(100 . "AcDbEntity")
(67 . 1)
(410 . "Layout1")
(8 . "HTEXT")
(100 . "AcDbMText")
(10 43.5971 22.7282 0.0)
(40 . 0.09375)
(41 . 3.73509)
(71 . 1)
(72 . 5)
(1 . "testing")
(7 . "romans")
(210 0.0 0.0 1.0)
(11 1.0 0.0 0.0)
(42 . 0.331473)
(43 . 0.125)
(50 . 0.0)
(73 . 1)
(44 . 1.0)
Now if you explode it with the command, you can see that there is a width factor scaling it, but can't find it with the mtext properties or dxf data.
; Alignment = 0
; Application (RO) = #<VLA-OBJECT IAcadApplication 00c2eb8c>
; Backward = 0
; Document (RO) = #<VLA-OBJECT IAcadDocument 05e797c4>
; Handle (RO) = "EBBEA"
; HasExtensionDictionary (RO) = 0
; Height = 0.09375
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 15ba5b14>
; InsertionPoint = (43.5904 22.6344 0.0)
; Layer = "HTEXT"
; Linetype = "BYLAYER"
; LinetypeScale = 1.0
; Lineweight = -1
; Normal = (0.0 0.0 1.0)
; ObjectID (RO) = 2125892752
; ObjectName (RO) = "AcDbText"
; ObliqueAngle = 0.0
; OwnerID (RO) = 2127772840
; PlotStyleName = "ByLayer"
; Rotation = 0.0
[color=red]; ScaleFactor = 0.75[/color]
; StyleName = "romans"
; TextAlignmentPoint = (0.0 0.0 0.0)
; TextGenerationFlag = 0
; TextString = "testing"
; Thickness = 0.0
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 15ba5c00>
; UpsideDown = 0
; Visible = -1
My question is, how can one find that information for the mtext entity?
On a side note: I found out that you can't change the size of text in code tags.
-
I get this when I change the character width:
; TextString = "{\\W1.5;Lee Mac}"
-
I thought it might be something like that, but as you can see in the first post that isn't the case for my text. Maybe if I post a small drawing showing the issue it will help.
-
It's in the STYLE 8-)
-
Its because the TextStyle has a width factor already. :-)
EDIT: Beat me to it :P
-
Dang it.........
Thanks guys. :oops:
-
Just one of those "Forest for the Trees" moments.
I have them all the time. :-)
-
Just one of those "Forest for the Trees" moments.
I have them all the time. :-)
Yup. Looking for the complex answer, when the simple one is right there.......
< where is that delete topic button.... can't leave any proof.... >
-
Just one of those "Forest for the Trees" moments.
I have them all the time. :-)
Well... ask me (no, better not).... I'm going to the drain with lisp - dang! by 4 :) [just read my signature]
-
Following the topic
I have a lisp where I ask the user to select a Mtext as to be the sample to do new MTEXT
Often this sample text is only a few character , and new MTEX will be a few more char.
How can I set the proper mtext width, regarding the new String STRLEN?
The new string at the new text will be as follow.
(setq ini-linea (vlax-curve-getstartpoint linea-obj))
(setq fin-linea (vlax-curve-getendpoint linea-obj))
(setq x-ini ( rtos (car ini-linea) 2 4))
(setq y-ini ( rtos (cadr ini-linea) 2 4))
(setq x-fin ( rtos (car fin-linea) 2 4))
(setq y-fin ( rtos (cadr fin-linea) 2 4))
(setq ini-text$ (strcat "X= " x-ini "\n""Y= " y-ini))
(setq fin-text$ (strcat "X= " x-fin "\n" "Y= " y-fin))
(setq text-lenght (strlen ini-text$))
I did it by guess
(setq texto-obj-width ( * text-lenght texto-heigth))
So I need to set the Mtext width
(setq text-ini (add-mtext ini-text$ ini-linea 1))
(vla-put-stylename text-ini texto-style)
(vla-put-Height text-ini texto-obj-height)
(vla-put-Width text-ini texto-obj-width)
Add-mtetx , is as follow
(defun add-mtext (str pt Width)
(if (= (type pt) 'LIST)
(setq pt (vlax-3d-point pt)))
(vla-addmtext model pt Width str)
)