此为一快速开孔程式,(公夹板,脱料背板+1.0/s,脱料板),如果图层名不一样须自行修改
;;;************************************************************************E
;;;向下成形制作>上模 Command:ShapeU1
;;;Shape punch
;;;2004-02-07 Chen Jian
;;;MADE IN CHINA
(defun C:ShapeU1(/ en1 en1-data en1-type os)
(command "undo" "be")
(setvar "cmdecho" 0)
(setq os (getvar "osmode"))
(setvar "osmode" 0)
(setq en1 (entsel "\n選取成形公外形... "))
(while en1 ;;;當en1存在時,做以下迴圈內容,直到en1不存在止
(setq en1-data (entget (car en1)))
(setq en1-type (cdr (assoc 0 en1-data))) ;群碼0為對象類型
(if (= en1-type "LWPOLYLINE")(sub-shapeu-LWPOLYLINE1))
(if (= en1-type "CIRCLE")(sub-shapeu-circle1))
(setq en1 (entsel "\n選取成形公外形... ")))
(setvar "osmode" os)
(command "undo" "e")
(Princ "\n---------------Bye c:ShapeU1 向下成形制作>上模---------------")
(prin1)
)
(defun sub-shapeu-LWPOLYLINE1()
(sub-chk-layer1 chklay)
(command "change" en1 "" "p" "la" "layout" "C" "2" "")
;;;05-01
(command "copy" en1 "" "0,0" "")
(command "change" (entlast) "" "p" "la" "05-01" "c" "1" "") ;Color is red
;;;06-01
(command "offset" "1" en1 "-1000,-1000" "")
(command "change" (entlast) "" "p" "la" "06-01" "c" "3" "") ;Color is green
;;;07-01
(command "copy" en1 "" "0,0" "")
(command "change" (entlast) "" "p" "la" "07-01" "c" "1" "") ;Color is red
(princ "\n******{07-->>05} [ShapeU1 OK!]******")
)
(defun sub-shapeu-circle1()
(sub-chk-layer1 chklay)
(command "change" en1 "" "p" "la" "layout" "C" "2" "")
;;;05-01
(command "copy" en1 "" "0,0" "")
(command "change" (entlast) "" "p" "la" "05-01" "c" "1" "") ;Color is red
;;;06-01
(command "offset" "1" en1 "-1000,-1000" "")
(command "change" (entlast) "" "p" "la" "06-01" "c" "7" "") ;Color is black
;;;07-01
(command "copy" en1 "" "0,0" "")
(command "change" (entlast) "" "p" "la" "07-01" "c" "1" "") ;Color is red
(princ "\n******{07-->>05} [ShapeU1 OK!]******")
) |