leeksnroses Posted August 24, 2010 Posted August 24, 2010 Hi, I have about 300 pieces of single line text numbers at 2 decimal places. These have a Z value to 3 decimal places. My units are set to 3 decimal places. How do i change these to display to 3 decimal places without physically altering them manually, or is there a lisp routine to do it? Thanks Quote
fuccaro Posted August 24, 2010 Posted August 24, 2010 What kind of "pieces of text" are we talking about? Dimensions? Attributes? Are the Z values displayed for some points? Please return with more info. Welcome in the forum! Quote
leeksnroses Posted August 25, 2010 Author Posted August 25, 2010 They are just simple single line text. All points have the correct Z value. e.g didplayed as 32.45 on screen, with the properties Z value being 32.454. Need to change quite a few. Thanks Quote
fuccaro Posted August 25, 2010 Posted August 25, 2010 Here is a quick one: (defun c:z2t() (setq l (entget (car (entsel)))) (entmod (subst (cons 1 (rtos (car (reverse (assoc 10 l))))) (assoc 1 l) l)) ) It will overwrite the content of the text with it's Z coord. The program assumes that you select a text and it makes no checks. Enter the correct data if you wish correct output! 1 Quote
BlackBox Posted August 25, 2010 Posted August 25, 2010 (edited) My two cents... (defun c:TEST (/ ss layerLock layerItem layerTable oldString newString) (vl-load-com) (cond (*activeDoc*) ((setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))))) (if (setq ss (ssget '((0 . "TEXT")))) (progn (vlax-for x (setq ss (vla-get-activeselectionset *activeDoc*)) (if (= :vlax-true (setq layerLock (vla-get-lock (setq layerItem (vla-item (cond (layerTable) ((setq layerTable (vla-get-layers *activeDoc*)))) (vla-get-layer x)))))) (progn (setq layerLocked T) (vla-put-lock layerItem :vlax-false))) (if (/= (setq oldString (vla-get-textstring x)) (setq newString (last (vlax-safearray->list (vlax-variant-value (vla-get-textalignmentpoint x)))))) (vla-put-textstring x newString))) (vla-delete ss) (if layerLocked (vla-put-lock layerItem layerLock)))) (princ)) This could easily be done without manually selecting the text entities, provided all items needing to be updated were on a specified layer, etc. Food for thought...? Hope this helps! Edited August 25, 2010 by BlackBox Limiting routine to TEXT only Quote
alanjt Posted August 25, 2010 Posted August 25, 2010 (defun c:Test (/ ss) (if (setq ss (ssget "_:L" '((0 . "TEXT")))) ((lambda (i / e l) (while (setq e (ssname ss (setq i (1+ i)))) (entupd (cdr (assoc -1 (entmod (subst (cons 1 (rtos (last (assoc 10 (setq l (entget e)))) 2 3)) (assoc 1 l) l ) ) ) ) ) ) ) -1 ) ) (princ) ) 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.