TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ziele_o2k on March 18, 2018, 10:17:56 AM

Title: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ziele_o2k on March 18, 2018, 10:17:56 AM
I have big problem with autolisp function textbox.
If string in text consists of some specific characters (for exmple: only dashes), then teturned coordinates by textbox function are wrong.
As example you can use LeeMac's Box Text (http://www.lee-mac.com/boxtext.html) routine, example in attached screen.
We found solution for spaces problem (https://www.theswamp.org/index.php?topic=51573.msg566569#msg566569) but now I have no idea what to do with that...
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: rkmcswain on March 19, 2018, 08:50:51 AM
What version of AutoCAD are you using?
It works as expect in 2017 here.


(https://i.imgur.com/F7txMQr.png)

Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ribarm on March 19, 2018, 09:15:43 AM
Probably A2014...
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ronjonp on March 19, 2018, 09:26:15 AM
Quick test here and it's dependent on the textstyle .. these TTF don't show up correctly.
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: rkmcswain on March 19, 2018, 09:28:16 AM
@ronjonp - what version?  My image in post #2 contains a TTF font, where it does work. (2017)
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ronjonp on March 19, 2018, 09:31:36 AM
@ronjonp - what version?  My image in post #2 contains a TTF font, where it does work. (2017)
AutoCAD 2018
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: rkmcswain on March 19, 2018, 09:46:21 AM
Interesting.


I just did this in 2018.


(https://i.imgur.com/7uCZwCG.png)
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ronjonp on March 19, 2018, 10:10:26 AM
Maybe try it on the attached drawing.
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: rkmcswain on March 19, 2018, 10:46:29 AM
Still works okay (yellow boxes are mine). Perhaps we are not conducting the same tests?


I'm running the Box Text routine from LeeMac as stated in the original post (with default 0.35 offset factor).


(https://i.imgur.com/COQ9pjE.png)
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ronjonp on March 19, 2018, 10:57:57 AM
Yup ... I'm using THIS (http://www.lee-mac.com/lisp/html/BoxTextV1-2.html) .. with an offset factor of 0.
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ribarm on March 19, 2018, 11:03:13 AM
I'm running the Box Text routine from LeeMac as stated in the original post (with default 0.35 offset factor).

That explains things...
I was using :
Quote
(defun c:frame ( / enx pl )
  (setq enx (entget (car (entsel "\nPick text..."))))
  (setq pl (mapcar '(lambda ( x ) (mapcar '+ (cdr (assoc 10 enx)) x)) (textbox enx)))
  (vl-cmdf "_.RECTANGLE" "_non" (car pl) "_non" (cadr pl))
  (princ)
)
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ziele_o2k on March 19, 2018, 11:31:17 AM
I forgot to check topic since morning and so many replies.
I'm using autocad 2018 and zwcad 2015, same wrong results with Lee Mac Box Text (TTF times new roman as font).
rkmcswain uses propably default offset as 0.35 not 0 as me and ronjonp

It seems to work fine with shx fonts

Edit:
I wrote to Autodesk, I will post their opinion.
Title: Re: Textbox - unwanted behavior? Box text by Lee Mac as example
Post by: ziele_o2k on March 19, 2018, 11:53:54 AM
I made some history review. TTF font support was introduced to autocad in AutoCAD Release 13 - 1994, AutoLISP was developed way before that - maybe here is problem?
But from other site, getboundingbox method also don't work (Visual-List introduced in 2000)  - use http://www.lee-mac.com/boundingbox.html (http://www.lee-mac.com/boundingbox.html) and example calling function at bottom of site to check.