Liviu Petreus Posted September 27, 2023 Posted September 27, 2023 Hi, Can someone help me with a lisp to change the position of letters in the text of attributes such as XX/YY to YY/XX? Thx Quote
ronjonp Posted September 27, 2023 Posted September 27, 2023 @Liviu Petreus Give this a try: (defun c:foo (/ i s str) (if (setq s (ssget ":L" '((0 . "INSERT") (66 . 1)))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (foreach att (vlax-invoke (vlax-ename->vla-object e) 'getattributes) (if (setq i (vl-string-search "/" (setq str (vla-get-textstring att)))) (vla-put-textstring att (strcat (substr str (+ 2 i)) "/" (substr str 1 i))) ) ) ) ) (princ) ) Quote
Liviu Petreus Posted September 28, 2023 Author Posted September 28, 2023 8 hours ago, ronjonp said: @Liviu Petreus Give this a try: (defun c:foo (/ i s str) (if (setq s (ssget ":L" '((0 . "INSERT") (66 . 1)))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (foreach att (vlax-invoke (vlax-ename->vla-object e) 'getattributes) (if (setq i (vl-string-search "/" (setq str (vla-get-textstring att)))) (vla-put-textstring att (strcat (substr str (+ 2 i)) "/" (substr str 1 i))) ) ) ) ) (princ) ) Many thanks Quote
ronjonp Posted September 28, 2023 Posted September 28, 2023 8 hours ago, Liviu Petreus said: Many thanks 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.