Joe. Posted November 11, 2021 Posted November 11, 2021 Hello I have drawing with hundred texts objects and I want all of their text content to erase what is in the text field and write its own Z value as new content. I know it is possible to do with Field function (Field-Objects-select certain object-Position-Z coordinate), but it is too time consuming and I have to select certain object to get Z value. Is its possible to do to such kind of LISP that all text fields will change to text own Z value? Thank You in advance Quote
BIGAL Posted November 12, 2021 Posted November 12, 2021 You only need to look at how a text field is made for a Z value of existing text and overwrite string, using VL-put-textstring obj newstr. You can copy the manual field command line and edit it into a lisp. Use mtext as a test. (defun c:t2rl ( / ss obj str) (setq ss (ssget (list (cons 0 "TEXT")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj)) ">%).InsertionPoint \\f \"%lu6%pt4\">%")) (vla-put-textstring obj str) ) (command "regen") (princ) ) 1 Quote
Joe. Posted November 12, 2021 Author Posted November 12, 2021 (edited) 14 hours ago, BIGAL said: You only need to look at how a text field is made for a Z value of existing text and overwrite string, using VL-put-textstring obj newstr. You can copy the manual field command line and edit it into a lisp. Use mtext as a test. (defun c:t2rl ( / ss obj str) (setq ss (ssget (list (cons 0 "TEXT")))) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj)) ">%).InsertionPoint \\f \"%lu6%pt4\">%")) (vla-put-textstring obj str) ) (command "regen") (princ) ) Wow, superb. Thank You very much!! There should be quick link to tip the helper :). Edited November 12, 2021 by Joe. Quote
Cad64 Posted November 12, 2021 Posted November 12, 2021 1 hour ago, Joe. said: There should be quick link to tip the helper :). There is. If you click the little heart in the lower right corner of Bigal's post, it will add a point to his reputation. 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.