;; **********************MOVE COMMANDS*************************** (defun c:mx (/ ss ptso ptd ptre xDist) ;Move along X axis only (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point or Enter to type in distance along X axis" ) ) (if (null ptso) (progn (setq xDist (getdist "\nType in or pick points for distance ") ptso (list 0.0 0.0 0.0) ptd (list xDist 0.0 0.0) ) (command ".move" ss "" "_non" ptso "_non" ptd) (princ) ) (progn (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptre) (cadr ptso) (caddr ptso))) (command ".move" ss "" "_non" ptso "_non" ptd) (setvar "cmdecho" 1) (princ) ) ) ) (defun c:mz (/ ss ptso ptd ptre) ;MOve in Z direction (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point or Enter to type in distance along Z axis")) (if (null ptso) (progn (setq xDist (getdist "\nType in or pick points for distance ") ptso (list 0.0 0.0 0.0) ptd (list 0.0 0.0 xDist) ) (command ".move" ss "" "_non" ptso "_non" ptd) (princ) ) (progn (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptso) (cadr ptso) (caddr ptre))) (command ".move" ss "" "_non" ptso "_non" ptd) (setvar "cmdecho" 1) (princ) ) ) ) (defun c:my (/ ss ptso ptre ptd) ;Move in Y only (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point or Enter to type in distance along Y axis" ) ) (if (null ptso) (progn (setq xDist (getdist "\nType in or pick points for distance ") ptso (list 0.0 0.0 0.0) ptd (list 0.0 xDist 0.0) ) (command ".move" ss "" "_non" ptso "_non" ptd) (princ) ) (progn (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptso) (cadr ptre) (caddr ptso))) (command ".move" ss "" "_non" ptso "_non" ptd) (setvar "cmdecho" 1) (princ) ) ) ) (defun c:mxy (/ ss ptso ptre ptd) ;Move in X,Y only (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point")) (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptre) (cadr ptre) (caddr ptso))) (command ".move" ss "" "_non" ptso "_non" ptd) (setvar "cmdecho" 1) (princ) ) ;; ******************COPY COMMANDS****************************************** (defun c:cx (/ ss ptso ptd ptre) ;.copy along X axis only (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point")) (setq ptre '(1 1));GIve ptre a value to enter While loop (while (/= nil ptre);repeat until user cancels (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptre) (cadr ptso) (caddr ptso))) (command ".copy" ss "" "_non" ptso "_non" ptd) ) (setvar "cmdecho" 1) (princ) ) (defun c:cz (/ ss ptso ptd ptre) ;.copy in Z direction (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point")) (setq ptre '(1 1)) (while (/= nil ptre) (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptso) (cadr ptso) (caddr ptre))) (command ".copy" ss "" "_non" ptso "_non" ptd) ) (setvar "cmdecho" 1) (princ) ) (defun c:cy (/ ss ptso ptre ptd) ;.copy in Y only (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point")) (setq ptre '(1 1)) (while (/= nil ptre) (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptso) (cadr ptre) (caddr ptso))) (command ".copy" ss "" "_non" ptso "_non" ptd) ) (setvar "cmdecho" 1) (princ) ) (defun c:cxy (/ ss ptso ptre ptd) ;.copy in X,Y only (setvar "cmdecho" 0) (setq ss (ssget)) (setq ptso (getpoint "\n Select source point")) (setq ptre '(1 1)) (while (/= nil ptre) (setq ptre (getpoint "\n Select destination reference")) (setq ptd (list (car ptre) (cadr ptre) (caddr ptso))) (command ".copy" ss "" "_non" ptso "_non" ptd) ) (setvar "cmdecho" 1) (princ) ) ;; *******************DIMENSION COMMANDS**************************************** (defun c:continueddimension (/ clayer cdimstyle);Continued dimension string (setvar "cmdecho" 0) (setq clayer (getvar "clayer") cdimstyle (getvar "dimstyle")) (setdimstyle) (setlayer "A-Anno-Dims") (setvar "cmdecho" 1) (command "dimlinear" pause pause pause) (command "dimcontinue") (cmdWait) (setvar "cmdecho" 0) (setvar "clayer" clayer) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) (defun c:baselinedimension (/ TextSz DimSpace clayer cdimstyle) ;Baseline dimension string (setvar "cmdecho" 0) (setq clayer (getvar "clayer") cdimstyle (getvar "dimstyle") ) (setlayer "A-Anno-Dims") (setdimstyle) (print "Select points for first dimension string") (setvar "cmdecho" 1) (command "dimlinear" pause pause pause) (command "dimbaseline") (cmdWait) (setvar "cmdecho" 0) (setvar "clayer" clayer) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) ;;Reload all currently resolved Xrefs (defun c:refreshxrefs (/ cnt tmpBlk NameList) (setvar "cmdecho" 0) (setq cnt T) (while (setq tmpBlk (tblnext "block" cnt)) (if (and (assoc 1 tmpBlk) (= (logand 32 (cdr (assoc 70 tmpBlk))) 32)) (setq NameList (cons (cdr (assoc 2 tmpBlk)) NameList)) ) (setq cnt nil) ) (foreach i NameList (command ".xref" "r" i)) (setvar "cmdecho" 1) (princ) ) ;Simple 2 point leader with Mtext and layer keying (defun c:leader2points (/ clayer ctextsize cdimstyle) (setvar "cmdecho" 0) (setq clayer (getvar "clayer") ctextsize (getvar "textsize") cdimstyle (getvar "dimstyle") ) (setlayer "A-Anno-Note") (setTextSize) (setDimStyle) (setvar "texteval" 1) (setvar "cmdecho" 1) (command "qleader") (cmdWait) (setvar "cmdecho" 0) (setvar "clayer" clayer) (setvar "textsize" ctextsize) (setvar "texteval" 0) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) ;***********Basic Mtext with Layer Keying******** (defun c:mtextlayer (/ clayer ctextsize ssEntity pnt1 TxtWdth NoteTxt) (setvar "cmdecho" 0) (setq clayer (getvar "clayer") ctextsize (getvar "textsize") ) (setlayer "A-Anno-Note") (setTextSize) (setvar "texteval" 1) (setvar "cmdecho" 1) (initdia) (command "mtext") (cmdWait) (setvar "cmdecho" 0) (setvar "clayer" clayer) (setvar "textsize" ctextsize) (setvar "texteval" 0) (setvar "cmdecho" 1) (princ) ) ;****************Linear DImension with Layer Keying********** (defun c:lineardimension (/ clayer cdimstyle) (setvar "cmdecho" 0) (setq clayer (getvar "clayer") cdimstyle (getvar "dimstyle") ) (setlayer "A-Anno-Dims") (setDimStyle) (setvar "cmdecho" 1) (command "dimlinear" pause pause pause) (setvar "cmdecho" 0) (setvar "clayer" clayer) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) ;****************Aligned DImension with Layer Keying********** (defun c:aligneddimension (/ clayer cdimstyle) (setvar "cmdecho" 0) (setq clayer (getvar "clayer") cdimstyle (getvar "dimstyle") ) (setlayer "A-Anno-Dims") (setDimStyle) (setvar "cmdecho" 1) (command "dimaligned" pause pause pause) (setvar "cmdecho" 0) (setvar "clayer" clayer) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) ;****************Ordinate DImension with Layer Keying********** (defun c:ordinatedimension (/ clayer cdimstyle) (setvar "cmdecho" 0) (setq clayer (getvar "clayer") cdimstyle (getvar "dimstyle") ) (setDimStyle) (setlayer "A-Anno-Dims") (setvar "cmdecho" 1) (command "dimordinate" pause pause) (setvar "cmdecho" 0) (setvar "clayer" clayer) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) ;****************Angular DImension with Layer Keying********** (defun c:angulardimension (/ clayer cdimstyle) (setvar "cmdecho" 0) (setq clayer (getvar "clayer") cdimstyle (getvar "dimstyle") ) (setlayer "A-Anno-Dims") (setDimStyle) (setvar "cmdecho" 1) (command "dimangular" pause pause pause) (setvar "cmdecho" 0) (setvar "clayer" clayer) (command "dimstyle" "r" cdimstyle) (setvar "cmdecho" 1) (princ) ) ;; ********************LOCAL UTILITIES************************************ (defun setlayer (TestLayer) (if (null (tblsearch "layer" TestLayer)) (command "-layer" "m" TestLayer "") ) (setvar "CLAYER" TestLayer) ) (defun *error* (msg) (if (or (= msg "Function cancelled") (= msg "quit / exit abort") ) (princ) (princ (strcat "\nSorry, somethin' aint right :-p \n " msg)) ) (setvar "cmdecho" 0) (if (not (null clayer)) (setvar "clayer" clayer) ) (if (not (null cdimstyle)) (command "dimstyle" "r" cdimstyle) ) (if (not (null ctextsize)) (setvar "textsize" ctextsize) ) (setvar "cmdecho" 1) ) ; Pause during active command....***** (defun cmdWait ( ) (while (= (logand (getvar "cmdactive") 1) 1) (command pause) (princ) ) ) ;;Get Current Dwg Scale Setting (defun AecScale (/ ds) (setq ds (CDR (ASSOC 40 (dictsearch (cdar (dictsearch (namedobjdict) "aec_vars" ) ) "aec_vars_dwg_setup" ) ) ) ) ) ; determine which space is active ; return: integer ; 1 - model space ; -1 - floating model space ; 0 - paper space (defun currentSpace (/ mode) (setq mode (getvar "tilemode")) (cond ((and (zerop mode) (<= 2 (getvar "cvport"))) -1) (t mode) ) ) ;******Activate Correct Dimension Style********** (defun setDimStyle (/ scale status) (setq scale (AecScale) status (currentSpace) ) (cond ((and (/= status 0) (= scale 4)) (command "-dimstyle" "r" "4") ) ((and (/= status 0) (= scale 8)) (command "-dimstyle" "r" "8") ) ((and (/= status 0) (= scale 12)) (command "-dimstyle" "r" "12") ) ((and (/= status 0) (= scale 16)) (command "-dimstyle" "r" "16") ) ((and (/= status 0) (= scale 24)) (command "-dimstyle" "r" "24") ) ((and (/= status 0) (= scale 32)) (command "-dimstyle" "r" "32") ) ((and (/= status 0) (= scale 48)) (command "-dimstyle" "r" "48") ) ((and (/= status 0) (= scale 96)) (command "-dimstyle" "r" "96") ) ((and (= status 0) (= scale 4)) (command "-dimstyle" "r" "PS4") ) ((and (= status 0) (= scale 8)) (command "-dimstyle" "r" "PS8") ) ((and (= status 0) (= scale 12)) (command "-dimstyle" "r" "PS12") ) ((and (= status 0) (= scale 16)) (command "-dimstyle" "r" "PS16") ) ((and (= status 0) (= scale 24)) (command "-dimstyle" "r" "PS24") ) ((and (= status 0) (= scale 32)) (command "-dimstyle" "r" "PS32") ) ((and (= status 0) (= scale 48)) (command "-dimstyle" "r" "PS48") ) ((and (= status 0) (= scale 96)) (command "-dimstyle" "r" "PS96") ) (T (alert "Your scale is non-standard,\nCheck the current Dwg Setup &/or Dim Style")) ) ) ;; *******************Layer assignment for Details******************* ;Routine to assign detail linweights to section linework (defun c:1 (/ ss) (setvar "cmdecho" 0) (setq ss (ssget)) (command "chprop" ss "" "la" "A-Detl-Patt" "c" "BYLAYER" "lt" "bylayer" "lw" "BYLAYER" "" ) (setvar "cmdecho" 1) (princ (strcat "\nChanged " (rtos (sslength ss)) " objects to 'A-Detl-Patt'" ) ) (princ) ) ;Routine to assign detail linweights to section linework (defun c:2 (/ ss) (setvar "cmdecho" 0) (setq ss (ssget)) (command "chprop" ss "" "la" "A-Detl-Thin" "c" "BYLAYER" "lt" "bylayer" "lw" "BYLAYER" "" ) (setvar "cmdecho" 1) (princ (strcat "\nChanged " (rtos (sslength ss)) " objects to 'A-Detl-Thin'" ) ) (princ) ) ;Routine to assign detail linweights to section linework (defun c:3 (/ ss) (setvar "cmdecho" 0) (setq ss (ssget)) (command "chprop" ss "" "la" "A-Detl-Medm" "c" "BYLAYER" "lt" "bylayer" "lw" "BYLAYER" "" ) (setvar "cmdecho" 1) (princ (strcat "\nChanged " (rtos (sslength ss)) " objects to 'A-Detl-Medm'" ) ) (princ) ) ;Routine to assign detail linweights to section linework (defun c:4 (/ ss) (setvar "cmdecho" 0) (setq ss (ssget)) (command "chprop" ss "" "la" "A-Detl-Wide" "c" "BYLAYER" "lt" "bylayer" "lw" "BYLAYER" "" ) (setvar "cmdecho" 1) (princ (strcat "\nChanged " (rtos (sslength ss)) " objects to 'A-Detl-Wide'" ) ) (princ) ) ;Routine to assign detail linweights to section linework (defun c:5 (/ ss) (setvar "cmdecho" 0) (setq ss (ssget)) (command "chprop" ss "" "la" "A-Detl-Hide" "c" "BYLAYER" "lt" "bylayer" "lw" "BYLAYER" "" ) (setvar "cmdecho" 1) (princ (strcat "\nChanged " (rtos (sslength ss)) " objects to 'A-Detl-Wide'" ) ) (princ) ) ;Routine to assign detail linweights to section linework (defun c:6 (/ ss) (setvar "cmdecho" 0) (setq ss (ssget)) (command "chprop" ss "" "la" "DEFPOINTS" "c" "BYLAYER" "lt" "bylayer" "lw" "BYLAYER" "" ) (setvar "cmdecho" 1) (princ (strcat "\nChanged " (rtos (sslength ss)) " objects to 'A-Detl-Wide'" ) ) (princ) ) (defun C:x1( / ) (setvar "filedia" 0) (if (= 32 (logand 32 (cdr (assoc 70 (entget (tblobjname "block" "1-REF")))))) ;;;(if (= (cdr (assoc 70 (entget (tblobjname "block" "1-REF")))) 12) (command "-xref" "u" "1-REF") (command "-xref" "r" "1-REF") ) (setvar "filedia" 1) ) (defun C:x2( / ) (setvar "filedia" 0) (if (= 32 (logand 32 (cdr (assoc 70 (entget (tblobjname "block" "2-REF")))))) (command "-xref" "u" "2-REF") (command "-xref" "r" "2-REF") ) (setvar "filedia" 1) ) (defun C:x3( / ) (setvar "filedia" 0) (if (= 32 (logand 32 (cdr (assoc 70 (entget (tblobjname "block" "3-REF")))))) (command "-xref" "u" "3-REF") (command "-xref" "r" "3-REF") ) (setvar "filedia" 1) ) (defun C:x4( / ) (setvar "filedia" 0) (if (= 32 (logand 32 (cdr (assoc 70 (entget (tblobjname "block" "4-REF")))))) (command "-xref" "u" "4-REF") (command "-xref" "r" "4-REF") ) (setvar "filedia" 1) ) (defun C:GD( / ) (setvar "filedia" 0) (if (= 32 (logand 32 (cdr (assoc 70 (entget (tblobjname "block" "Grid")))))) (command "-xref" "u" "Grid") (command "-xref" "r" "Grid") ) (setvar "filedia" 1) ) ;;Reload all currently resolved Xrefs (defun c:refreshxrefs (/ cnt tmpBlk NameList) (setvar "cmdecho" 0) (setq cnt T) (while (setq tmpBlk (tblnext "block" cnt)) (if (and (assoc 1 tmpBlk) (= (logand 32 (cdr (assoc 70 tmpBlk))) 32)) (setq NameList (cons (cdr (assoc 2 tmpBlk)) NameList)) ) (setq cnt nil) ) (foreach i NameList (command ".xref" "r" i)) (setvar "cmdecho" 1) (princ) )