Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Text under dimension line

10 REPLIES 10
Reply
Message 1 of 11
caseys
1688 Views, 10 Replies

Text under dimension line

I had a lisp routine called "dlt.lsp" that would place text under the dimension line selected. Dummy me had to uninstall and reinstall my AutoCAD 2010 and deleted my saved lisp routines. Has any one ever heard of this routine and if so do you know where I can get it again?

Thanks in advance.

Casey
10 REPLIES 10
Message 2 of 11
rogerio_brazil
in reply to: caseys

An alternative. If you don't get it again.

Use "\X" to write text under dimension line.

See the folowing link:

http://www.spaug.org/Tip_Month02.Html
April's Tip of the Month
Classic Dimensioning Tip

Rogerio 🙂
Message 3 of 11
cab2k
in reply to: caseys

Here is an old one from me.
{code};; CAB 07.27.2005
(defun c:txt2dim (/ edim text etxt vla_dim)
(vl-load-com)
(while (or (initget 1)
(not (setq edim (entsel "\nSelect dimension: ")))
(/= (cdr (assoc 0 (entget (car edim)))) "DIMENSION")
)
(prompt "\n*** You must select a dimension. ***")
)
(while
(and (not (and (setq etxt (entsel "\nSelect text to add to override or enter to type: "))
(= (cdr (assoc 0 (entget (car etxt)))) "TEXT")
)
)
(or (initget 1)
(not (setq text (getstring t "\nType the text or ENTER to clear override: ")))
)
)
)
(if etxt
(setq text (vla-get-textstring (vlax-ename->vla-object (car etxt))))
)
(setq vla_dim (vlax-ename->vla-object (car edim)))
(cond
((and text (/= text ""))
(vla-put-textoverride vla_dim (strcat "<>\\X" text))
)
((and text (= text "")) ; clear the override
(vla-put-textoverride vla_dim text)
)
)
(princ)
){code}
Message 4 of 11
Kent1Cooper
in reply to: caseys

It's not quite clear to me whether the OP is looking for an under-the-line *replacement* for existing dimension text content [which your routine seems to do if they don't choose to clear the override, though I didn't study it very deeply], or perhaps an *added* piece of text below, with existing dimension text to remain. If the latter, there are different possibilities.

If the existing text is the actual measurement, there could be an option built into a routine like this that would use:

(strcat "<>\\X" text)

as the text override.

And assuming the problem with angle brackets on the website interface hasn't changed, that code line should be:

(strcat "less-than-symbol greater-than-symbol \\X" text)

The less-than and greater-than symbols [angle brackets] stand for the actual measurement [in current units], when you want to add a prefix and/or suffix with a text override.

Or if there might already be an override, and they want to leave that and add something below, there could be an option that saves the current text and then imposes something like:

(strcat currenttext "\\X" text)

If they want to keep *whatever* is there, regardless of whether it's default or overridden, and add something below, it could do something like:

{code}
....
(setq currenttext (vla-get-textoverride vla_dim))
(if (= currenttext ""); for default measurement
(setq currenttext "less-than-symbol greater-than-symbol")
;;...[but actually use angle brackets]...
); end if
(vla-put-textoverride vla_dim (strcat currenttext "\\X" text))
....
{code}

--
Kent Cooper
Kent Cooper, AIA
Message 5 of 11
cab2k
in reply to: caseys

I was unaware of the format problem.
see revised here (Thanks Kent)
{code};; CAB 07.27.2005
(defun c:txt2dim (/ edim text etxt vla_dim)
(vl-load-com)
(while (or (initget 1)
(not (setq edim (entsel "\nSelect dimension: ")))
(/= (cdr (assoc 0 (entget (car edim)))) "DIMENSION")
)
(prompt "\n*** You must select a dimension. ***")
)
(while
(and (not (and (setq etxt (entsel "\nSelect text to add to override or enter to type: "))
(= (cdr (assoc 0 (entget (car etxt)))) "TEXT")
)
)
(or (initget 1)
(not (setq text (getstring t "\nType the text or ENTER to clear override: ")))
)
)
)
(if etxt
(setq text (vla-get-textstring (vlax-ename->vla-object (car etxt))))
)
(setq vla_dim (vlax-ename->vla-object (car edim)))
(cond
((and text (/= text ""))
(vla-put-textoverride vla_dim (strcat (chr 60)(chr 62) "\\X" text))
)
((and text (= text "")) ; clear the override
(vla-put-textoverride vla_dim text)
)
)
(princ)
){code}
Message 6 of 11
caseys
in reply to: caseys

Thanks to all who have replied and now I am able to put the text under the dimension line. One of these days I am going to learn to write lisp routines.

Thanks again to everyone.
Message 7 of 11
Kent1Cooper
in reply to: caseys

So what you sent before was actually better than it looked [on the website interface, anyway].... That paired-angle-bracket problem has been complained about often, but never fixed, which is bad news because it spoils code for not only the actual-measurement stand-in indication in dimension text overrides, but also for the common designator for default values in typical prompts for various (get....) Lisp functions.

In the latter case, I have sometimes used {*curly* brackets} in something I post here, though I stick with the angle brackets the code I use here. But that substitution is not an option do for this dimension override situation. Going to (chr 60) (chr 62) shouldn't be necessary, but at least it *can* be taken right into Lisp files without converting anything, unlike my "less-than-symbol greater-than-symbol" description.

Another way around the problem is to keep the angle brackets, but attach the code as a .lsp file, rather than put it directly in the body of a post.

--
Kent Cooper


CAB2k wrote...
I was unaware of the format problem.
....
Kent Cooper, AIA
Message 8 of 11
cab2k
in reply to: caseys

Too bad there is not a Help File to explain how to include code as well as a "Don't do this" list.

Thanks for the Heads Up. 🙂
Message 9 of 11
Anonymous
in reply to: caseys

Alan,

They have this:
http://discussion.autodesk.com/forums/help.jspa

if that can be called better than nothing...

wrote in message news:6300679@discussion.autodesk.com...
Too bad there is not a Help File to explain how to include code as well as a
"Don't do this" list.

Thanks for the Heads Up. 🙂
Message 10 of 11
scot-65
in reply to: caseys

Kent,
> That paired-angle-bracket problem has been complained about often, but never fixed, which is bad news...
>

Try using { code } before and after...

{code}

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.


Message 11 of 11
Kent1Cooper
in reply to: caseys

Putting the curly-bracketed word "code" before and after your code content [as instructed in LE's link, and for a while in an Announcement message that's no longer there at the top of the Thread List] at least preserves indentations, which are lost if you don't surround your code that way, so it's good practice. But unfortunately it doesn't get around the website's elimination of pairs of angle brackets and anything between them.

--
Kent Cooper

scot-65 wrote...
....
Try using { code } before and after...
....
Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost