leonucadomi Posted 5 hours ago Posted 5 hours ago hello all: There are dimensions I need to do this to. I have a routine to do this It would be possible to do everything in a single selection I mean select the dimension and place the break and the line over the text I await comments and here I put the code, thank you ; Original by RonJonP, edited by P. Kenewell (defun c:ltx (/ o s) (setvar "cmdecho" 0) (command "._undo" "_be") (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vlax-ename->vla-object e)) (cond ((= "TEXT" (cdr (assoc 0 (entget e)))) (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o)) ) ) ) ) ((= "MTEXT" (cdr (assoc 0 (entget e)))) (vla-put-textstring o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textstring o)) ) ) ) ) ((= "DIMENSION" (cdr (assoc 0 (entget e)))) (if (= (vla-get-textoverride o) "") (vla-put-textoverride o "\\O<>") (vla-put-textoverride o (strcat "\\O" (vl-string-subst "" "" (vl-string-subst "" "\\O" (vla-get-textoverride o)) ) ) ) ) ) ) ) ) (command "._undo" "_end") (setvar "cmdecho" 1) (princ) ) Quote
BIGAL Posted 2 hours ago Posted 2 hours ago Good old fashioned google 1st found this not sure if helpful. https://help.autodesk.com/view/ACDMAC/2025/ENU/?guid=GUID-E0859F66-985A-4A20-BCB4-1B57D24DC100 Quote
mhupp Posted 1 hour ago Posted 1 hour ago (edited) Also you can return the vla-object list with foreach by wrapping it in mapcar. eliminating having to use (setq o (vlax-ename->vla-object e)). Pulling the vla-object name before the cond means your checking the variable rather then check the entity up to 3 times. ; Original by RonJonP, edited by P. Kenewell, updated by Mhupp (defun c:ltx (/ D O S) (vl-load-com) (setq D (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark D) (if (setq s (ssget ":L" '((0 . "*TEXT,DIMENSION")))) (foreach o (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))) (setq typ (vla-get-ObjectName o)) (cond ((= typ "AcDbText") (vla-put-textstring o (strcat "%%O" (vl-string-subst "" "" (vl-string-subst "" "%%O" (vla-get-textstring o))))) ) ((= typ "AcDbMText") ... ) ((= typ "AcDbDimension") ... ) ) ) ) (vla-endundomark D) (princ) ) -edit also useing the (vla-startundomark allows you to have things selected before you run the command. Edited 1 hour ago by mhupp 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.