Author Topic: Mtext/Multileader Text Shrinkwrap  (Read 3269 times)

0 Members and 1 Guest are viewing this topic.

Dave M

  • Newt
  • Posts: 196
Mtext/Multileader Text Shrinkwrap
« on: December 17, 2018, 11:47:23 AM »
I am working on a project that has a lot of Mtext and Multileaders with text and the box widths and heights are all over the place.  Normally, it wouldn't be a problem, but when you mask them it is.  Does anyone have a routine that would essentially "shrinkwrap" the boundary to fit the text? Both width and height?


Thanks in advance!



Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

ribarm

  • Gator
  • Posts: 3272
  • Marko Ribar, architect
Re: Mtext/Multileader Text Shrinkwrap
« Reply #1 on: December 17, 2018, 12:57:15 PM »
My first thought and what I'd do is use (textbox) function to obtain bounding box points of text, or (vla-getboundingbox) method to get bb points and then I'd create new rectangle while (entdel) existing one that's buggy...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Mtext/Multileader Text Shrinkwrap
« Reply #2 on: December 17, 2018, 02:26:47 PM »
AFAIK the textbox function cannot handle mtext formatting. And the boundingbox won't give the required values here. Look at gc 42 and 43 in the entity list instead.

ribarm

  • Gator
  • Posts: 3272
  • Marko Ribar, architect
Re: Mtext/Multileader Text Shrinkwrap
« Reply #3 on: December 17, 2018, 02:33:52 PM »
What's wrong with TEXTMASK.LSP - Express Tools or TCIRCLE command - ACETTXT.LSP - Express Tools?
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ronjonp

  • Needs a day job
  • Posts: 7529
« Last Edit: December 17, 2018, 03:14:32 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Dave M

  • Newt
  • Posts: 196
Re: Mtext/Multileader Text Shrinkwrap
« Reply #5 on: December 17, 2018, 04:19:55 PM »
What's wrong with TEXTMASK.LSP - Express Tools or TCIRCLE command - ACETTXT.LSP - Express Tools?


Maybe I didn't make myself clear enough.  When the original drafter placed the mtext/mleaders, they placed them using rectangles much larger than needed.  I want to shrink them to the extents of the actual text.
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Mtext/Multileader Text Shrinkwrap
« Reply #6 on: December 18, 2018, 04:07:55 AM »
Code - Auto/Visual Lisp: [Select]
  1. ; (MtextShrinkBox (car (entsel)))
  2. (defun MtextShrinkBox (enm / elst)
  3.   (setq elst (entget enm))
  4.   (entmod
  5.     (subst
  6.       (cons 41 (cdr (assoc 42 elst))) ; Box width.
  7.       (assoc 41 elst)
  8.       (subst
  9.         ; (cons 46 (cdr (assoc 43 elst))) ; Box height.
  10.         '(46 . 0.0)
  11.         (assoc 46 elst)
  12.         elst
  13.       )
  14.     )
  15.   )
  16. )