Jump to content

Recommended Posts

Posted

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 :) 

Posted
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?

 

Posted
8 hours ago, dlanorh said:

 

Are these text heights "TEXT" , "MTEXT" or both?

Are they all on the same layer?

 

Those are TEXT entities :)

Posted

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.

Posted
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

 

  • Like 1
Posted

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

  • Like 1
Posted

thanks a lot! i'm learning. This works.

 

Posted

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

 

  • Like 1
Posted
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!

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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