CADkitt Posted September 9, 2010 Share Posted September 9, 2010 It looks so damn easy and still I don't manage to modify it. It should be able to select more then one dimension, and not select by box but just one by one. (defun c:2x (/) (vl-load-com) (vlax-put-property (vlax-ename->vla-object (car (entsel "Select diminsion to change")) ) "TextSuffix" (strcat "(2x)") ) ) I was also thinking of adding a variable for setting the 2x to 3x etc., but I don't know if it is really needed. (I can probably do this myself) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 9, 2010 Share Posted September 9, 2010 That's a single selection due to (entsel) function, So to move to multiple try the following . Here is a multiple selection set codes ... (defun c:2x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (setq obj (vlax-ename->vla-object ent) ) ) ) (princ) ) Good Luck. Tharwat Quote Link to comment Share on other sites More sharing options...
CADkitt Posted September 9, 2010 Author Share Posted September 9, 2010 (edited) yeah I got it to work final result: (defun c:x55 (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(55x)") ) ) ) (princ) ) And with custom input: (defun c:xx (/ i ss ent obj num) (setq num (getreal "\nSpecify x Times: ")) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(" (rtos num 2 0) "x)") ) ) ) (princ) ) tnx Tharwat edit: final lisp 5d does degree (from %%d) 5c does circle (from &&c) 1 to 20 x works by just typing "1x" (without "") and "2x" "3x" till "20x" xx asks for user input. Limitation is that it overwrites the prefix always. (defun c:1x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(1x)") ) ) ) (princ) ) (defun c:2x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(2x)") ) ) ) (princ) ) (defun c:3x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(3x)") ) ) ) (princ) ) (defun c:4x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(4x)") ) ) ) (princ) ) (defun c:5x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(5x)") ) ) ) (princ) ) (defun c:6x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(6x)") ) ) ) (princ) ) (defun c:7x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(7x)") ) ) ) (princ) ) (defun c:8x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(8x)") ) ) ) (princ) ) (defun c:9x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(9x)") ) ) ) (princ) ) (defun c:10x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(10x)") ) ) ) (princ) ) (defun c:11x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(11x)") ) ) ) (princ) ) (defun c:12x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(2x)") ) ) ) (princ) ) (defun c:13x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(14x)") ) ) ) (princ) ) (defun c:15x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(15x)") ) ) ) (princ) ) (defun c:16x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(16x)") ) ) ) (princ) ) (defun c:17x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(17x)") ) ) ) (princ) ) (defun c:18x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(18x)") ) ) ) (princ) ) (defun c:19x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(19x)") ) ) ) (princ) ) (defun c:20x (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(20x)") ) ) ) (princ) ) (defun c:5d (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "%%d") ) ) ) (princ) ) (defun c:5c (/ i ss ent obj ) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextPrefix" (strcat "%%c") ) ) ) (princ) ) (defun c:xx (/ i ss ent obj num) (setq num (getreal "\nSpecify x Times: ")) (vl-load-com) (if (setq i -1 ss (ssget '((0 . "DIMENSION")))) (while (setq ent (ssname ss (setq i (1+ i)) ) ) (vlax-put-property (setq obj (vlax-ename->vla-object ent) ) "TextSuffix" (strcat "(" (rtos num 2 0) "x)") ) ) ) (princ) ) Edited September 9, 2010 by CADkitt something went wrong with 4x Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 9, 2010 Share Posted September 9, 2010 You're welcome any time. Tharwat Quote Link to comment Share on other sites More sharing options...
CADkitt Posted September 9, 2010 Author Share Posted September 9, 2010 I updated the script the 4x was missing and the 3x had (x4) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 9, 2010 Share Posted September 9, 2010 A very good work Marijn. I do recommend you to add the 'undo' for your codes, because if something went wrong you won't be able to go back to the original Dimension . (vla-startundomark (setq *activeDoc* (vla-get-activedocument (vlax-get-acad-object))) ) ....... doing of routine .... (vla-endundomark *activeDoc*) Best Regards, Tharwat 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.