16
99
83
初露锋芒
...snip(setq cecho (getvar "cmdecho")) (prompt "\nSelect Entities to be Changed : ") (command "setvar" "cmdecho" "0") (setq ss-circle (ssget '( (-4 . "<OR") (-4 . "<AND") (0 . "CIRCLE") (-4 . "AND>") (-4 . "<AND") (0 . "LWPOLYLINE") (42 . 1.0) (-4 . "AND>") (-4 . "OR>") ) ) ) (setq index 0) ;(repeat n (setq i -1) (while (setq ent (ssname ss-circle (setq i (1+ i)))) (setq lst (cons ent lst)) ) (reverse lst) (foreach ent lst (setq enlist (entget ent)) (setq cr (cdr (assoc 40 enlist))) (cond ((equal cr 0.0625 0.00001) ;1/8" PILOT DRILL (command "change" ent "" "property" "layer" "cnc_drill-pilot" "" ) ) snip...
使用道具 举报
63
6297
6283
后起之秀
(if (setq ss-circle (ssget '((-4 . "<OR") (0 . "CIRCLE") (-4 . "<AND") (0 . "LWPOLYLINE") (42 . 1.0) (-4 . "AND>") (-4 . "OR>")))) (progn (setq i -1) (while (setq ent (ssname ss-circle (setq i (1+ i)))) (setq enlist (entget ent)) (if (and (eq (cdr (assoc 0 enlist)) "CIRCLE")(equal cr 0.0625 0.00001)) (command "change" ent "" "property" "layer" "cnc_drill-pilot" "") ) ( ;; Add your stuff here for the LWpolyline ) ) ) )
(defun C:C2L (/ a1 a2 n index b1 b2 b3 d1 d2 cecho ss-circle ss-pline ent lst enlist cr i cl ) ;(command "undo" "be") (setq *old_error* *error*) (setq *error* trap) ;(command "undo" "be") (setq cl (getvar "clayer")) ; ----------------------------------------------------------------------------- ; | CREATE LAYERS | ; | | ; ----------------------------------------------------------------------------- (if ; if layer CNC_DRILL-PILOT does not exist (not (tblsearch "LAYER" "CNC_DRILL-PILOT") ) (command "-layer" "make" "CNC_DRILL-PILOT" "color" "9" "" "" ) ;create layer CNC_DRILL-PILOT (command "-layer" "thaw" "CNC_DRILL-PILOT" "on" "CNC_DRILL-PILOT" "set" "CNC_DRILL-PILOT" "" ) ) (if ; if layer CNC_DRILL-.1875 does not exist (not (tblsearch "LAYER" "CNC_DRILL-.1875-THRU") ) (command "-layer" "make" "CNC_DRILL-.1875-THRU" "color" "CYAN" "" "" ) ; create layer CNC_DRILL-.1875-THRU (command "-layer" "thaw" "CNC_DRILL-.1875-THRU" "on" "CNC_DRILL-.1875-THRU" "set" "CNC_DRILL-.1875-THRU" "" ) ) (if ; if layer CNC_DRILL-.250 does not exist (not (tblsearch "LAYER" "CNC_DRILL-.250-PEG") ) (command "-layer" "make" "CNC_DRILL-.250-PEG" "color" "RED" "" "" ) ; create layer CNC_DRILL-.250-PEG (command "-layer" "thaw" "CNC_DRILL-.250-PEG" "on" "CNC_DRILL-.250-PEG" "set" "CNC_DRILL-.250-PEG" "" ) ) (if ; if layer CNC_DRILL-.3125 does not exist (not (tblsearch "LAYER" "CNC_DRILL-.3125-THRU") ) (command "-layer" "make" "CNC_DRILL-.3125-THRU" "color" "GREEN" "" "" ) ; create layer CNC_DRILL-.3125-THRU (command "-layer" "thaw" "CNC_DRILL-.3125-THRU" "on" "CNC_DRILL-.3125-THRU" "set" "CNC_DRILL-.3125-THRU" "" ) ) (if ; if layer CNC_DRILL-.375 does not exist (not (tblsearch "LAYER" "CNC_DRILL-.375-THRU") ) (command "-layer" "make" "CNC_DRILL-.375-THRU" "color" "MAGENTA" "" "" ) ; create layer CNC_DRILL-.375-THRU (command "-layer" "thaw" "CNC_DRILL-.375-THRU" "on" "CNC_DRILL-.375-THRU" "set" "CNC_DRILL-.375-THRU" "" ) ) (if ; if layer CNC_DRILL-.500 does not exist (not (tblsearch "LAYER" "CNC_DRILL-.500-THRU") ) (command "-layer" "make" "CNC_DRILL-.500-THRU" "color" "9" "" "" ) ; create layer CNC_DRILL-.375-THRU (command "-layer" "thaw" "CNC_DRILL-.500-THRU" "on" "CNC_DRILL-.375-THRU" "set" "CNC_DRILL-.500-THRU" "" ) ) (if ; if layer CNC_PLY-DOWEL does not exist (not (tblsearch "LAYER" "CNC_PLY-DOWEL") ) (command "-layer" "make" "CNC_PLY-DOWEL" "color" "211" "" "" ) ; create layer CNC_DRILL-DOWEL (command "-layer" "thaw" "CNC_PLY-DOWEL" "on" "CNC_PLY-DOWEL"