TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on August 23, 2005, 03:40:40 PM

Title: Text lenght
Post by: Andrea on August 23, 2005, 03:40:40 PM
what is the DXF groupCode to know the lenght of selected TEXT or MTEXT ?

I know this was the insertion point..
(setq t1 (cdr (assoc 10 text)))

so if it is bottom left...i need the bottom right end point.

I know also the justification style..

;;Justification Horizontal method
(setq t2 (cdr (assoc 72 text)))

;;Justification Vertical method
(setq t3 (cdr (assoc 73 text)))

but can find a way to detect the lenght of text.

any suggestion ?

thanks
Title: Text lenght
Post by: MP on August 23, 2005, 03:44:20 PM
(textbox ...)
Title: Text lenght
Post by: Bob Wahr on August 23, 2005, 03:47:29 PM
I was thinking (strlen ...)  I guess it depends on what she means by length.
Title: Text lenght
Post by: MP on August 23, 2005, 03:47:54 PM
She?
Title: Text lenght
Post by: Bob Wahr on August 23, 2005, 03:49:13 PM
guess based on "Andrea."  Appologies if I'm wrong.
Title: Text lenght
Post by: M-dub on August 23, 2005, 03:51:21 PM
Quote from: Bob Wahr
guess based on "Andrea."  Appologies if I'm wrong.


I've made that mistake before as well.  :oops:  I'm sure no offence is taken.  (I hope not, anyway!)
Title: Text lenght
Post by: Bob Wahr on August 23, 2005, 03:54:00 PM
Noted and filed away for future occasions.  Sorry Andrea.
Title: Text lenght
Post by: MP on August 23, 2005, 04:09:57 PM
No foul I'm sure, I was just confused.

Anyway, see this (http://groups.google.ca/group/autodesk.autocad.customization/tree/browse_frm/thread/d984fa2dda816397/3b1808efd97eecbe?rnum=1&hl=en&q=defun+textbox+puckett&_done=%2Fgroup%2Fautodesk.autocad.customization%2Fbrowse_frm%2Fthread%2Fd984fa2dda816397%2F1872d815610ec70b%3Flnk%3Dst%26q%3Ddefun+textbox+puckett%26rnum%3D2%26hl%3Den%26#doc_1872d815610ec70b) or this (http://groups.google.ca/group/autodesk.autocad.customization/tree/browse_frm/thread/a7669e7a0a9dc611/f2d95276d861edaa?rnum=1&hl=en&q=defun+textbox+puckett&_done=%2Fgroup%2Fautodesk.autocad.customization%2Fbrowse_frm%2Fthread%2Fa7669e7a0a9dc611%2F3b2821df0b33610c%3Flnk%3Dst%26q%3Ddefun+textbox+puckett%26rnum%3D1%26hl%3Den%26#doc_b3d52e1fb49a1226) for ideas.
Title: Text lenght
Post by: Andrea on August 23, 2005, 04:31:00 PM
No problemo..

I'm Italian....Andrea mean Andrew... :wink:

MP...the 2 codes you give me is not working...
don't know exactly why..I don't know the textbox function..
and not very familiar with lamda to...

so....need to learn alittle more..

thanks.
Title: Text lenght
Post by: MP on August 23, 2005, 05:28:10 PM
I can assure you those functions do work, but they were mentioned as ideas only; i.e. show you how the textbox and getboundingbox functions (actually getboundingbox is a subroutine) work.

If I understood your question you are looking for the length of the text (in drawing units, not string length). Either route will work (I'd suggest bounding box as it will work on a variety of objects not just text) but I digress.

Have you read the help file for either textbox or getboundingbox?
Title: Text lenght
Post by: Mark on August 23, 2005, 05:30:42 PM
And away we go . . . . to Autolisp land.
Title: Text lenght
Post by: Bob Wahr on August 23, 2005, 05:33:55 PM
A bounding box, on rotated mtext especially, could get pretty tricky for getting the length.
Title: Text lenght
Post by: CAB on August 23, 2005, 05:51:04 PM
More code to look at. :)
http://www.theswamp.org/phpBB2/viewtopic.php?t=6045
Title: Text lenght
Post by: MP on August 23, 2005, 05:57:16 PM
(http://www.theswamp.org/screens/mp/bugle.png)
CAB to the rescue.
Title: Text lenght
Post by: Andrea on August 24, 2005, 11:18:43 AM
nice....thanks.