Shrink wrap the vertically for single line MTEXT
(defun c:MtextFrameV (/ ent) (if (and (setq ent (car (entsel))) (equal (cdr (assoc 0 (setq ent (entget ent)))) "MTEXT") ) (entmod (subst (cons 46 (cdr (assoc 40 ent))) (assoc 46 ent) ent) ) ) (princ) )
@devitg wrote:
The attached DWG explain it self. The question is , how to set the Mtext´s box or grips , as close to the Mtext . This 1 line Mtext , comes from a multiple line Mtext. I have the LISP done up to convert the multiline in a single line , but it kept the vertical distance between grips as the original multiline MTEXT. I use VLx functions. Thanks in advance
That's curious.... I can't get a single-line Mtext object to have its opposite-the-justification-side grips distant from the content like that [except in one "cheating" circumstance -- see below]. Even the one in your sample drawing, which you show that way in your image, doesn't have them that way when I open it. And even when I put several Enters in for blank lines below the text content, it won't keep the trailing Enters, but they go away, and the grips end up vertically tight against the bottom of the content. If you're seeing it that way only after modifying the content with a Lisp routine, but before everything is really finished, maybe an (entupd) or something would clear it.
The one circumstance under which I can get grips to be vertically distant from the text content is by using leading Enters before the content. Then the upper grips remain elevated above the content. But that's "cheating" because it's not single-line Mtext any more. [Why Mtext allows leading Enters but not trailing ones, I couldn't say.] And that's obviously not the case with your example, where the vertical separation is below.
Maybe it's version-dependent -- I'm still back here in 2004, where I don't even have a 46-code entry [used in pbejse's suggestion] in Mtext entity data.
Dear pbejse,
What is dxf code '46'?
I can not find in dxf reference document. I am using AutoCAD2011.
If it is undocumented, please let us know what it is?
DXF 46 is defined as Floating-point values (text height, scale factors, and so )
its has different meaning for different entities, type DXF 46 on the search box within developer documentation section on the help file
For mtext 46 is the Reference rectangle height and 41 is Reference rectangle width
in the OP's example, the mtext includes this group code
and if 45 is present, background mask is included as well
(defined as "Fill box scale (optional): Determines how much border there is around the text.")
Hope this helps