Lippens Infra Posted August 28, 2020 Posted August 28, 2020 Hello all, I have a file where the height of certain points is annotated as text. The precision is 0.0001 which is too much. I have like for example a text line containing 13.6489. Would it be possible to adapt all text entities at once? and maybe even a correct round off? If i could shorten the string to 13.64 that would be ok, but even better would be 13.65 If not, there are also blocks (crosses) which have the height as Z attribute. Is it possible to extract that Z coordinate and annotate it? Thanks in advande Quote
dlanorh Posted August 28, 2020 Posted August 28, 2020 2 hours ago, Lippens Infra said: Hello all, I have a file where the height of certain points is annotated as text. The precision is 0.0001 which is too much. I have like for example a text line containing 13.6489. Would it be possible to adapt all text entities at once? and maybe even a correct round off? If i could shorten the string to 13.64 that would be ok, but even better would be 13.65 If not, there are also blocks (crosses) which have the height as Z attribute. Is it possible to extract that Z coordinate and annotate it? Thanks in advande Are these text heights "TEXT" , "MTEXT" or both? Are they all on the same layer? Quote
Lippens Infra Posted August 28, 2020 Author Posted August 28, 2020 8 hours ago, dlanorh said: Are these text heights "TEXT" , "MTEXT" or both? Are they all on the same layer? Those are TEXT entities Quote
pkenewell Posted August 28, 2020 Posted August 28, 2020 Please upload a sample drawing. Need to know if the TEXT has only the number, If is is in top level drawing or in a block, are the Text objects FIELDS, etc. Quote
dlanorh Posted August 28, 2020 Posted August 28, 2020 1 hour ago, Lippens Infra said: Those are TEXT entities If they are text entities and all on the same layer you can try this. You will need to change the layer name in part of the filter (8 . "LEVELS") so that it matches the layer you height text is on. (vl-load-com) (defun c:lev22 ( / *error* c_doc) (defun *error* ( msg ) (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred."))) (princ) );end_*error*_defun (setq c_doc (vla-get-activedocument (vlax-get-acad-object))) (ssget "_X" '((0 . "TEXT")(8 . "LEVELS"))) (vlax-for t_obj (vla-get-activeselectionset c_doc) (vlax-put-property t_obj 'textstring (rtos (atof (vlax-get-property t_obj 'textstring)) 2 2)) );end_for (princ) );end_defun 1 Quote
BIGAL Posted August 28, 2020 Posted August 28, 2020 For lipens the rtos function controls how many decimals so (rtos x 2 2) the 2 is decimal the next 2 is number of decimal places. (rtos x 2 3) 123.456 1 Quote
Lippens Infra Posted August 31, 2020 Author Posted August 31, 2020 thanks a lot! i'm learning. This works. Quote
BIGAL Posted August 31, 2020 Posted August 31, 2020 A bit more saves hard coding layer name. (setq lay (cdr (assoc 8 (entget (car (entsel "\nPlease pick a text")))))) (ssget "_X" (list (cons 0 "TEXT")(cons 8 lay))) 1 Quote
Lippens Infra Posted September 1, 2020 Author Posted September 1, 2020 6 hours ago, BIGAL said: A bit more saves hard coding layer name. (setq lay (cdr (assoc 8 (entget (car (entsel "\nPlease pick a text")))))) (ssget "_X" (list (cons 0 "TEXT")(cons 8 lay))) Thanks a lot! I've added this to the code! Quote
Recommended Posts
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.