Jump to content
NIEKO

EXTRACT ONLY THE "TEXTSIZE"/"TEXTHEIGHT" VALUE FROM A STRING OF TEXT

Recommended Posts

NIEKO

EXAMPLE 01 - 5mm HIGH TEXT

"100mm THICK MILD STEEL FLAT BAR"

###########################

above is a string of text on a drawing ------ question is as follows____how can I extract or obtain (with a lisp function) only the "textsize"/"textheight" value from the string to

use the value in a lisp routine

 

appreciated

NIEKO

 

Share this post


Link to post
Share on other sites
Emmanuel Delay

Open a notepad document, copy/paste this code, save as print_text_height.lsp (feel free to rename, but keep the .lsp, and make sure ther's no .txt at the end of that).

Drag the .lsp file in your Autocad active document

Type command GTH, press enter

 


(defun c:gth ( / th)
  (setq th (cdr (assoc 40 (entget (car (entsel "\nSelect TEXT object: "))))))
  (princ "\nText height: ")
  (princ th)
  (princ)
)

Share this post


Link to post
Share on other sites
NIEKO

Emmanuel

Thanks a lot. I really appretiate it

 

NIEKO

  • Like 1

Share this post


Link to post
Share on other sites
BIGAL

Another same thing using v lisp

 


(setq obj (vlax-ename->vla-object (car (entsel "pick text object"))))
(setq ht (vla-get-height obj))

(alert (strcat "height is  " (rtos ht 2 1)))

Share this post


Link to post
Share on other sites
NIEKO

BIGAL

Thanks a lot for your help and input

I appreciate it very much

 

I would like to compliment all you guys for an excellent CAD forum

 

 

NIEKO

Share this post


Link to post
Share on other sites
ronjonp

If you want the actual height of the text in the drawing use the TEXTBOX function. A string with the same height like "1234" will not be the same physical height as "{1234,".

 

Try it :)

(if (setq e (car (entsel "\nPick text: ")))
  (print (abs (apply '- (mapcar 'cadr (textbox (entget e))))))
)

 

  • Like 2

Share this post


Link to post
Share on other sites
BIGAL

Good one ronjonp,  don't forget droppers, superscript, subscript.

 

Jj Ggx²

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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