Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/08/2022 in all areas

  1. Why repeat load just appload once, to do again type 2fil. Thats what the C:2fil means its a command now just run on 1st load.
    1 point
  2. http://www.lee-mac.com/draworderfunctions.html how about to use this. last of link's page function "Move Hatch Objects to Bottom". In the case of wipeout , it's usually above the backdrawing and below the text, so you'll have to think a bit more.
    1 point
  3. ; command = w for 1 digit (defun c:w ( / n e nn old new ) (setq n (getint "\n input start number : ")) (while (setq e (car(entsel "\n select text you want to change : "))) (setq e (entget e)) (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "" nn))) ) (setq old (assoc 1 e) new (cons 1 nn) ) (setq e (subst new old e)) (entmod e) (setq n (1+ n)) ) ) ; command = ww for 2 digit (defun c:ww ( / n e nn old new ) (setq n (getint "\n input start number : ")) (while (setq e (car(entsel "\n select text you want to change : "))) (setq e (entget e)) (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "0" nn))) ((= 2 (strlen nn)) (setq nn (strcat "" nn))) ) (setq old (assoc 1 e) new (cons 1 nn) ) (setq e (subst new old e)) (entmod e) (setq n (1+ n)) ) ) ; command = www for 3 digit (defun c:www ( / n e nn old new ) (setq n (getint "\n input start number : ")) (while (setq e (car(entsel "\n select text you want to change : "))) (setq e (entget e)) (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "00" nn))) ((= 2 (strlen nn)) (setq nn (strcat "0" nn))) ((= 3 (strlen nn)) (setq nn (strcat "" nn))) ) (setq old (assoc 1 e) new (cons 1 nn) ) (setq e (subst new old e)) (entmod e) (setq n (1+ n)) ) ) ; command = wwww for 4 digit (defun c:wwww ( / n e nn old new ) (setq n (getint "\n input start number : ")) (while (setq e (car(entsel "\n select text you want to change : "))) (setq e (entget e)) (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "000" nn))) ((= 2 (strlen nn)) (setq nn (strcat "00" nn))) ((= 3 (strlen nn)) (setq nn (strcat "0" nn))) ((= 4 (strlen nn)) (setq nn (strcat " " nn))) ) (setq old (assoc 1 e) new (cons 1 nn) ) (setq e (subst new old e)) (entmod e) (setq n (1+ n)) ) ) like this? or another? If you input command "w", then enter the start number. (in example 1) and then select the text, it will changes from 1, then next selected text will change to 2,3,4,5 in that order. If the starting number is entered as 100, the texts selected as 100,101,102 are changed. And the code below is what I changed to select multiple texts at once. It can't be used for diagonal lines like your sample drawing, but only for tables. ; Changes multiple texts to continuous numbers. (top left to bottom right) - 2022.05.06 exceed ; command list : MW, MWW, MWWW, MWWWW ; number of W is number of digit, in example 8 ~ 11 ; MW = 8,9,10,11 ; MWW = 08,09,10,11 ; MWWW = 008,009,010,011 ; MWWWW = 0008,0009,0010,0011 ; There is no problem in the case of 1 vertical line and 1 horizontal line. ; but, if they are both horizontal and vertical, if they overlap, or if the coordinates are slightly different up and down, ; the order may be shuffled. (vl-load-com) ; multiple w, from Left-top ~ Right-bottom. (defun c:MW ( / *error* n gap ss1 ss1count ss1index ss1y ss1list ss1stacklist ss1ent ss1x ss1sll ss1slindex nn ss1obj ) (setvar 'cmdecho 0) (LM:startundo (LM:acdoc)) ;error control (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (setvar 'cmdecho 1) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (princ) ) (setq n (getint "\n input start number (no input default value is 1) : ")) (if (= n nil) (setq n 1)) (setq gap (getint "\n input increse number (no input default value is 1) : ")) (if (= gap nil) (setq gap 1)) (princ "\n select all texts you want to change (order is top-left to bottom-right)") (setq ss1 (ssget (list (cons 0 "*TEXT")))) (setq ss1count (sslength ss1)) (setq ss1index 0) (setq ss1y 0) (setq ss1list nil) (setq ss1stacklist nil) ;get list of original texts ( y-coordinate textcontents ) (repeat ss1count (setq ss1ent (entget (ssname ss1 ss1index))) (setq ss1y (atoi (rtos (* (nth 2 (assoc 10 ss1ent)) -1) 2 2 ) ) ) ; * -1 for reverse y coordinates (for sorting) (setq ss1x (atoi (rtos (nth 1 (assoc 10 ss1ent)) 2 2) ) ) (setq ss1list (list ss1y ss1index ss1x)) (setq ss1stacklist (cons ss1list ss1stacklist)) (setq ss1index (+ ss1index 1)) );end repeat ;(princ "\n original list : ") ;(princ ss1stacklist) ;sort original list (setq ss1stacklist (vl-sort ss1stacklist (function (lambda (x1 x2)(< (car x1) (car x2))) ) ) ) ;(princ "\n sorted1 original list : ") ;(princ ss1stacklist) (defun mysort ( l ) (vl-sort l '(lambda ( a b ) (if (eq (car a) (car b)) (< (caddr a) (caddr b)) (< (car a) (car b)) ;(< (vl-prin1-to-string (car a)) (vl-prin1-to-string (car b))) ) ) ) ) (setq ss1stacklist (mysort ss1stacklist)) (setq ss1sll (length ss1stacklist)) (setq ss1slindex 0) (repeat ss1sll (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "" nn))) ) (setq ss1obj (vlax-ename->vla-object (ssname ss1 (cadr (nth ss1slindex ss1stacklist)) ))) (vla-put-textstring ss1obj nn) (setq n (+ n gap)) (setq ss1slindex (+ ss1slindex 1)) ) (setvar 'cmdecho 1) (LM:endundo (LM:acdoc)) (princ) ) ; multiple ww, from Left-top ~ Right-bottom. (defun c:MWW ( / *error* n gap ss1 ss1count ss1index ss1y ss1list ss1stacklist ss1ent ss1x ss1sll ss1slindex nn ss1obj ) (setvar 'cmdecho 0) (LM:startundo (LM:acdoc)) ;error control (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (setvar 'cmdecho 1) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (princ) ) (setq n (getint "\n input start number (no input default value is 1) : ")) (if (= n nil) (setq n 1)) (setq gap (getint "\n input increse number (no input default value is 1) : ")) (if (= gap nil) (setq gap 1)) (princ "\n select all texts you want to change (order is top-left to bottom-right)") (setq ss1 (ssget (list (cons 0 "*TEXT")))) (setq ss1count (sslength ss1)) (setq ss1index 0) (setq ss1y 0) (setq ss1list nil) (setq ss1stacklist nil) ;get list of original texts ( y-coordinate textcontents ) (repeat ss1count (setq ss1ent (entget (ssname ss1 ss1index))) (setq ss1y (atoi (rtos (* (nth 2 (assoc 10 ss1ent)) -1) 2 2 ) ) ) ; * -1 for reverse y coordinates (for sorting) (setq ss1x (atoi (rtos (nth 1 (assoc 10 ss1ent)) 2 2) ) ) (setq ss1list (list ss1y ss1index ss1x)) (setq ss1stacklist (cons ss1list ss1stacklist)) (setq ss1index (+ ss1index 1)) );end repeat ;(princ "\n original list : ") ;(princ ss1stacklist) ;sort original list (setq ss1stacklist (vl-sort ss1stacklist (function (lambda (x1 x2)(< (car x1) (car x2))) ) ) ) ;(princ "\n sorted1 original list : ") ;(princ ss1stacklist) (defun mysort ( l ) (vl-sort l '(lambda ( a b ) (if (eq (car a) (car b)) (< (caddr a) (caddr b)) (< (car a) (car b)) ;(< (vl-prin1-to-string (car a)) (vl-prin1-to-string (car b))) ) ) ) ) (setq ss1stacklist (mysort ss1stacklist)) (setq ss1sll (length ss1stacklist)) (setq ss1slindex 0) (repeat ss1sll (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "0" nn))) ((= 2 (strlen nn)) (setq nn (strcat "" nn))) ) (setq ss1obj (vlax-ename->vla-object (ssname ss1 (cadr (nth ss1slindex ss1stacklist)) ))) (vla-put-textstring ss1obj nn) (setq n (+ n gap)) (setq ss1slindex (+ ss1slindex 1)) ) (setvar 'cmdecho 1) (LM:endundo (LM:acdoc)) (princ) ) ; multiple www, from Left-top ~ Right-bottom. (defun c:MWWW ( / *error* n gap ss1 ss1count ss1index ss1y ss1list ss1stacklist ss1ent ss1x ss1sll ss1slindex nn ss1obj ) (setvar 'cmdecho 0) (LM:startundo (LM:acdoc)) ;error control (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (setvar 'cmdecho 1) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (princ) ) (setq n (getint "\n input start number (no input default value is 1) : ")) (if (= n nil) (setq n 1)) (setq gap (getint "\n input increse number (no input default value is 1) : ")) (if (= gap nil) (setq gap 1)) (princ "\n select all texts you want to change (order is top-left to bottom-right)") (setq ss1 (ssget (list (cons 0 "*TEXT")))) (setq ss1count (sslength ss1)) (setq ss1index 0) (setq ss1y 0) (setq ss1list nil) (setq ss1stacklist nil) ;get list of original texts ( y-coordinate textcontents ) (repeat ss1count (setq ss1ent (entget (ssname ss1 ss1index))) (setq ss1y (atoi (rtos (* (nth 2 (assoc 10 ss1ent)) -1) 2 2 ) ) ) ; * -1 for reverse y coordinates (for sorting) (setq ss1x (atoi (rtos (nth 1 (assoc 10 ss1ent)) 2 2) ) ) (setq ss1list (list ss1y ss1index ss1x)) (setq ss1stacklist (cons ss1list ss1stacklist)) (setq ss1index (+ ss1index 1)) );end repeat ;(princ "\n original list : ") ;(princ ss1stacklist) ;sort original list (setq ss1stacklist (vl-sort ss1stacklist (function (lambda (x1 x2)(< (car x1) (car x2))) ) ) ) ;(princ "\n sorted1 original list : ") ;(princ ss1stacklist) (defun mysort ( l ) (vl-sort l '(lambda ( a b ) (if (eq (car a) (car b)) (< (caddr a) (caddr b)) (< (car a) (car b)) ;(< (vl-prin1-to-string (car a)) (vl-prin1-to-string (car b))) ) ) ) ) (setq ss1stacklist (mysort ss1stacklist)) (setq ss1sll (length ss1stacklist)) (setq ss1slindex 0) (repeat ss1sll (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "00" nn))) ((= 2 (strlen nn)) (setq nn (strcat "0" nn))) ((= 3 (strlen nn)) (setq nn (strcat "" nn))) ) (setq ss1obj (vlax-ename->vla-object (ssname ss1 (cadr (nth ss1slindex ss1stacklist)) ))) (vla-put-textstring ss1obj nn) (setq n (+ n gap)) (setq ss1slindex (+ ss1slindex 1)) ) (setvar 'cmdecho 1) (LM:endundo (LM:acdoc)) (princ) ) ; multiple wwww, from Left-top ~ Right-bottom. (defun c:MWWWW ( / *error* n gap ss1 ss1count ss1index ss1y ss1list ss1stacklist ss1ent ss1x ss1sll ss1slindex nn ss1obj ) (setvar 'cmdecho 0) (LM:startundo (LM:acdoc)) ;error control (defun *error* ( msg ) (LM:endundo (LM:acdoc)) (setvar 'cmdecho 1) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\n Error: " msg)) ) (princ) ) (setq n (getint "\n input start number (no input default value is 1) : ")) (if (= n nil) (setq n 1)) (setq gap (getint "\n input increse number (no input default value is 1) : ")) (if (= gap nil) (setq gap 1)) (princ "\n select all texts you want to change (order is top-left to bottom-right)") (setq ss1 (ssget (list (cons 0 "*TEXT")))) (setq ss1count (sslength ss1)) (setq ss1index 0) (setq ss1y 0) (setq ss1list nil) (setq ss1stacklist nil) ;get list of original texts ( y-coordinate textcontents ) (repeat ss1count (setq ss1ent (entget (ssname ss1 ss1index))) (setq ss1y (atoi (rtos (* (nth 2 (assoc 10 ss1ent)) -1) 2 2 ) ) ) ; * -1 for reverse y coordinates (for sorting) (setq ss1x (atoi (rtos (nth 1 (assoc 10 ss1ent)) 2 2) ) ) (setq ss1list (list ss1y ss1index ss1x)) (setq ss1stacklist (cons ss1list ss1stacklist)) (setq ss1index (+ ss1index 1)) );end repeat ;(princ "\n original list : ") ;(princ ss1stacklist) ;sort original list (setq ss1stacklist (vl-sort ss1stacklist (function (lambda (x1 x2)(< (car x1) (car x2))) ) ) ) ;(princ "\n sorted1 original list : ") ;(princ ss1stacklist) (defun mysort ( l ) (vl-sort l '(lambda ( a b ) (if (eq (car a) (car b)) (< (caddr a) (caddr b)) (< (car a) (car b)) ;(< (vl-prin1-to-string (car a)) (vl-prin1-to-string (car b))) ) ) ) ) (setq ss1stacklist (mysort ss1stacklist)) (setq ss1sll (length ss1stacklist)) (setq ss1slindex 0) (repeat ss1sll (setq nn (itoa n)) (cond ((= 1 (strlen nn)) (setq nn (strcat "000" nn))) ((= 2 (strlen nn)) (setq nn (strcat "00" nn))) ((= 3 (strlen nn)) (setq nn (strcat "0" nn))) ((= 4 (strlen nn)) (setq nn (strcat "" nn))) ) (setq ss1obj (vlax-ename->vla-object (ssname ss1 (cadr (nth ss1slindex ss1stacklist)) ))) (vla-put-textstring ss1obj nn) (setq n (+ n gap)) (setq ss1slindex (+ ss1slindex 1)) ) (setvar 'cmdecho 1) (LM:endundo (LM:acdoc)) (princ) ) ;; Active Document - Lee Mac ;; Returns the VLA Active Document Object (defun LM:acdoc nil (eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object)))) (LM:acdoc) ) ;; Start Undo - Lee Mac ;; Opens an Undo Group. (defun LM:startundo ( doc ) (LM:endundo doc) (vla-startundomark doc) ) ;; End Undo - Lee Mac ;; Closes an Undo Group. (defun LM:endundo ( doc ) (while (= 8 (logand 8 (getvar 'undoctl))) (vla-endundomark doc) ) )
    1 point
  4. Set up template drawing with all the correct plot styles and dim styles save it out with clients name. then use the following on new drawings to pull from said template. http://www.lee-mac.com/steal.html
    1 point
×
×
  • Create New...