Jump to content

How to determine number of lines of text in a multileader


Recommended Posts

Posted

I was curious is there anyway to determine the number of lines of text (or the text box height) in a multileader object? I have done a dump of all the information and I don't see anything that references this. The reason I ask is because I am trying to add onto Lee's code found here: http://www.cadtutor.net/forum/showthread.php?76430-Multi-Leader-Shrinkwrap. My thought is to have an iteration that starts at 1.01 and increase the tolerance in 0.01 increments until the text box height is the same as it was initially (I have messed with the tolerance numerous times and I can't get a value that works all the time, but still shrinks the text box).

Posted

Hi,

 

You can get the number of lines by the quantity of the combination strings \\P in the Mtext string if found.

Posted
Hi,

 

You can get the number of lines by the quantity of the combination strings \\P in the Mtext string if found.

Thanks Tharwat for the help! So I looked into your suggestion, which I can get from vla-get-textstring, or dxf group code 304, but the problem is that the \\P information is only available if the user hits enter for a new line of text, not if the text is put on a second line by dragging the text box, at least as far as I can tell.
Posted

Dump of 3 line mtext, does your look like this ?

 

TextString = "abcdefg\\Phijklm\\Popqrst"

Posted
Dump of 3 line mtext, does your look like this ?

 

TextString = "abcdefg\\Phijklm\\Popqrst"

When I have a multileader that has 2 lines of text that look like this:
Cadtutor is
helpful.

It prints like this

TextString = "CADTUTOR IS HELPFUL"

Divide the height of the MLeader text box by the text height + line spacing - there is a similar example for MText somewhere on the web.
. Thanks Lee! I'll play around with it for a while to see if I can figure it out.
Posted

So I have been messing around with this and I still am confused. I have a text box that has a width of 29.9248, which after looking through the dxf codes I see is group code 43. The text box height is 5.3333333, but I can't find any information on this. I have tried to do 29.9248/5.33333 which gives 5.61, however, there isn't any group code that has 5.3333 or 5.61. I also know the text height is 2.0 (code 40), so I tried to do 5.3333-2.0=3.3333 to find the height, but there isn't a group code with that value either. Am I missing something/ going about this incorrectly?

Posted

Maybe this by Lee...

 

;; by Lee Mac
;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Determining-the-number-of-lines-in-a-...
(defun mattrib-number-of-lines (ent / box enx)
 (setq enx (entget ent)
 box (textbox (list '(1 . "A") (assoc 7 enx) (assoc 40 enx)))
 )
 (1+ (fix (/ (cdr (assoc 43 enx)) (* 1.66 (- (cadadr box) (cadar box))))))
)
;; mtxtattrib-number-of-lines

 

HTH, M.R.

Posted
Maybe this by Lee...

 

;; by Lee Mac
;; http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Determining-the-number-of-lines-in-a-...
(defun mattrib-number-of-lines (ent / box enx)
 (setq enx (entget ent)
 box (textbox (list '(1 . "A") (assoc 7 enx) (assoc 40 enx)))
 )
 (1+ (fix (/ (cdr (assoc 43 enx)) (* 1.66 (- (cadadr box) (cadar box))))))
)
;; mtxtattrib-number-of-lines

HTH, M.R.

Thanks marko (and Lee as well for his code)! So I tested that on an mleader object and it doesn't work because of the different dxf group codes, but it works perfectly on the mtext object. I have hard time converting it over to use for mleader because I can't figure out all the eqivalent dxf group codes. I know that 1 for mtext is equivalent to 304 for mleader (the first 304 code given), 40 to 40 (the second one given) but I can't find any equivalent for 7 (style), or 43 ( I am not sure exactly what this gives).
Posted
I can't find any equivalent for 7 (style), or 43 ( I am not sure exactly what this gives).

 

Group 43 gives the height of the MText text box - as far as I am aware, there is no equivalent DXF group for an MLeader. However, I have already provided a function to calculate this height (and also demonstrate how to obtain the MLeader Text Style), linked above.

Posted
Group 43 gives the height of the MText text box - as far as I am aware, there is no equivalent DXF group for an MLeader. However, I have already provided a function to calculate this height (and also demonstrate how to obtain the MLeader Text Style), linked above.
Lee, I'm sorry I should have done a check with that other function before posting. I think I have got it figured out now.

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...