Noor-Cad Posted June 24 Share Posted June 24 Hi All, I am looking for a lisp code that will move all the selected texts VERTICALLY to the polyline or move the text to the end of the lines or polylines on which they are present. I have attached a drawing explaining the methods I am using and request for some way to reduce the steps involved. As I have lots of drawings to work. Thanking you allMOVETEXT.dwg Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 24 Share Posted June 24 (edited) @Noor-Cad Give this a try. It will maintain the differing Z vales of your text. (defun c:foo (/ ln o p pl s txt) ;; RJP » 2024-06-24 (cond ((setq s (ssget ":L" '((0 . "*TEXT,LWPOLYLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (= "AcDbPolyline" (vla-get-objectname (setq o (vlax-ename->vla-object e)))) (setq pl o) (setq txt (cons (list o (vlax-get o 'textalignmentpoint)) txt)) ) ) (if pl (foreach tx txt (setq ln (entmakex (list '(0 . "LINE") (cons 10 (cadr tx)) (cons 11 (mapcar '+ (cadr tx) '(0 1 0))) '(8 . "TEMPLINE") ) ) ) (vla-put-elevation pl (last (cadr tx))) (if (setq p (vlax-invoke (vlax-ename->vla-object ln) 'intersectwith pl 3)) (progn (vlax-put (car tx) 'textalignmentpoint p) (entdel ln)) ) ) ) ) ) (princ) ) Edited June 24 by ronjonp 1 Quote Link to comment Share on other sites More sharing options...
Noor-Cad Posted June 26 Author Share Posted June 26 On 6/25/2024 at 1:23 AM, ronjonp said: @Noor-Cad Give this a try. It will maintain the differing Z vales of your text. (defun c:foo (/ ln o p pl s txt) ;; RJP » 2024-06-24 (cond ((setq s (ssget ":L" '((0 . "*TEXT,LWPOLYLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (= "AcDbPolyline" (vla-get-objectname (setq o (vlax-ename->vla-object e)))) (setq pl o) (setq txt (cons (list o (vlax-get o 'textalignmentpoint)) txt)) ) ) (if pl (foreach tx txt (setq ln (entmakex (list '(0 . "LINE") (cons 10 (cadr tx)) (cons 11 (mapcar '+ (cadr tx) '(0 1 0))) '(8 . "TEMPLINE") ) ) ) (vla-put-elevation pl (last (cadr tx))) (if (setq p (vlax-invoke (vlax-ename->vla-object ln) 'intersectwith pl 3)) (progn (vlax-put (car tx) 'textalignmentpoint p) (entdel ln)) ) ) ) ) ) (princ) ) Excellent ! Thank you Ronjonp Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 26 Share Posted June 26 Quote Link to comment Share on other sites More sharing options...
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.