楼主是做冲模的吧,给你这个看看,我也是在网上看到别人的 hyjxlayer:dialog { label = "放大多义线复制到对应的层"; :row{ :boxed_row{ :column{spacer_0; :toggle{ key="mb1";label= "盖板 (001)"; } :toggle{ key="mb2";label= "上模板 (002)"; } :toggle{ key="mb3";label= "凸模固定板座(003)"; } :toggle{ key="mb4";label= "凸模固定板 (004)"; } :toggle{ key="mb5";label= "卸料板座 (005)"; } :toggle{ key="mb6";label= "卸料板 (006)"; } :toggle{ key="mb7";label= "凹模板 (007)"; } :toggle{ key="mb8";label= "凹模板座 (008)"; } :toggle{ key="mb9";label= "下模座 (009)"; } :toggle{ key="mb10";label= "导料板 (010)"; } :toggle{ key="mb11";label= "凹模 (Die)"; } :toggle{ key="mb12";label= "凸模 (Punch)"; } } // spacer_1; :column{ :edit_box{label="偏侈距离:";key="dis1";edit_width=6;} :edit_box{label="偏侈距离:";key="dis2";edit_width=6;} :edit_box{label="偏侈距离:";key="dis3";edit_width=6;} :edit_box{label="偏侈距离:";key="dis4";edit_width=6;} :edit_box{label="偏侈距离:";key="dis5";edit_width=6;} :edit_box{label="偏侈距离:";key="dis6";edit_width=6;} :edit_box{label="偏侈距离:";key="dis7";edit_width=6;} :edit_box{label="偏侈距离:";key="dis8";edit_width=6;} :edit_box{label="偏侈距离:";key="dis9";edit_width=6;} :edit_box{label="偏侈距离:";key="dis10";edit_width=6;} :edit_box{label="偏侈距离:";key="dis11";edit_width=6;} :edit_box{label="偏侈距离:";key="dis12";edit_width=6;} //spacer_0; }}} :row{spacer_1; :toggle{label = "全选/清除";key="setall";fixed_width=true;} //:toggle{label = "反选";key="vice";fixed_width=true;} spacer_1; spacer_1;spacer_1;spacer_1;spacer_1; :toggle{label = "值清空";key="clear";fixed_width=true;} :toggle{label = "缺省";key="setold";fixed_width=true;} } ok_cancel; } (defun hy_jxlayer() (setq dcl_id (load_dialog "hy_dcl.dcl")) (if (< dcl_id 0) (exit)) (if(not (new_dialog "hyjxlayer" dcl_id)) (exit)) (mode_tile "dis1" 0)(SET_TILE "dis1" "1.0") (mode_tile "dis2" 0)(SET_TILE "dis2" "0.5") (mode_tile "dis3" 0)(SET_TILE "dis3" "0.5") (mode_tile "dis4" 0)(SET_TILE "dis4" "0.02") (mode_tile "dis5" 0)(SET_TILE "dis5" "0.6") (mode_tile "dis6" 0)(SET_TILE "dis6" "0.002") (mode_tile "dis7" 0)(SET_TILE "dis7" "0.03") (mode_tile "dis8" 0)(SET_TILE "dis8" "0.5") (mode_tile "dis9" 0)(SET_TILE "dis9" "1.5") (mode_tile "dis10" 0)(SET_TILE "dis10" "0.5") (mode_tile "dis11" 0)(SET_TILE "dis11" "0.1") (mode_tile "dis12" 0)(SET_TILE "dis12" "0.1") (mode_tile "dis13" 0)(SET_TILE "dis13" "0.5") (mode_tile "dis14" 0)(SET_TILE "dis14" "0.5") (mode_tile "dis15" 0)(SET_TILE "dis15" "0.5") (set_tile "mb5" "1") (action_tile "mb1" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb2" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb3" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb4" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb5" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb6" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb7" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb8" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb9" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb10" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb11" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb12" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb13" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb14" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "mb15" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "setall" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "clear" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "setold" "(setq x (get_tile $key)) (hyficha $key x)") (action_tile "setall" "(qc-qx $value)") (action_tile "vice" "(qc-fx $value)") (action_tile "dis1" "(hyfichcheck \"dis1\")") (action_tile "dis2" "(hyfichcheck \"dis2\")") (action_tile "dis3" "(hyfichcheck \"dis3\")") (action_tile "dis4" "(hyfichcheck \"dis4\")") (action_tile "dis5" "(hyfichcheck \"dis5\")") (action_tile "dis6" "(hyfichcheck \"dis6\")") (action_tile "dis7" "(hyfichcheck \"dis7\")") (action_tile "dis8" "(hyfichcheck \"dis8\")") (action_tile "dis9" "(hyfichcheck \"dis9\")") (action_tile "dis10" "(hyfichcheck \"dis10\")") (action_tile "dis11" "(hyfichcheck \"dis11\")") (action_tile "dis12" "(hyfichcheck \"dis12\")") (action_tile "dis13" "(hyfichcheck \"dis13\")") (action_tile "dis14" "(hyfichcheck \"dis14\")") (action_tile "dis15" "(hyfichcheck \"dis15\")") ;(action_tile "mb1" "(setq mb1 (get_tile \"mb1\"))(hy_savedat)") ;(ACTION_TILE "setall" "(MODE_TILE "mb1" 0)")
;(action_tile "setall" "(setq dd 2)") ;(action_tile "clear1" "(setq dd 3)") (action_tile "accept" "(hyfichb)") (setq dd (start_dialog)) ;(unload_dialog dcl_id) ;|(cond ((= dd 2)(ok_all)) ((= dd 3)(ok_clear)) )|; (if (= dd 1) (hyfichc) ) ) (defun qc-qx(b) (set_tile "mb1" b) (set_tile "mb2" b) (set_tile "mb3" b) (set_tile "mb4" b) (set_tile "mb5" b) (set_tile "mb6" b) (set_tile "mb7" b) (set_tile "mb8" b) (set_tile "mb9" b) (set_tile "mb10" b) (set_tile "mb11" b) (set_tile "mb12" b) ) (defun qc-fx(a) (setq m1 (get_tile "mb1")) (if (= m1 "0") (set_tile "mb1" 1)) ) (defun ok_all() (set_tile "mb1" "1")(set_tile "mb2" "1")(set_tile "mb3" "1")(set_tile "mb4" "1")) (defun hyficha(key x) (cond ((= key "mb1") (if (= x "1") (progn (mode_tile "dis1" 0)(mode_tile "dis1" 2)(SET_TILE "dis1" "1.0")) (mode_tile "dis1" 1))) ((= key "mb2") (if (= x "1") (progn (mode_tile "dis2" 0) (mode_tile "dis2" 2)(SET_TILE "dis2" "0.5")) (mode_tile "dis2" 1))) ((= key "mb3") (if (= x "1") (progn (mode_tile "dis3" 0) (mode_tile "dis3" 2)(SET_TILE "dis3" "0.5")) (mode_tile "dis3" 1))) ((= key "mb4") (if (= x "1") (progn (mode_tile "dis4" 0) (mode_tile "dis4" 2)(SET_TILE "dis4" "0.02")) (mode_tile "dis4" 1))) ((= key "mb5") (if (= x "1") (progn (mode_tile "dis5" 0) (mode_tile "dis5" 2)(SET_TILE "dis5" "0.6")) (mode_tile "dis5" 1))) ((= key "mb6") (if (= x "1") (progn (mode_tile "dis6" 0) (mode_tile "dis6" 2)(SET_TILE "dis6" "0.002")) (mode_tile "dis6" 1))) ((= key "mb7") (if (= x "1") (progn (mode_tile "dis7" 0) (mode_tile "dis7" 2)(SET_TILE "dis7" "0.03")) (mode_tile "dis7" 1))) ((= key "mb8") (if (= x "1") (progn (mode_tile "dis8" 0) (mode_tile "dis8" 2)(SET_TILE "dis8" "0.5")) (mode_tile "dis8" 1))) ((= key "mb9") (if (= x "1") (progn (mode_tile "dis9" 0) (mode_tile "dis9" 2)(SET_TILE "dis9" "1.5")) (mode_tile "dis9" 1))) ((= key "mb10") (if (= x "1") (progn (mode_tile "dis10" 0) (mode_tile "dis10" 2)(SET_TILE "dis10" "0.5")) (mode_tile "dis10" 1))) ((= key "mb11") (if (= x "1") (progn (mode_tile "dis11" 0) (mode_tile "dis11" 2)(SET_TILE "dis11" "0.1")) (mode_tile "dis11" 1))) ((= key "mb12") (if (= x "1") (progn (mode_tile "dis12" 0) (mode_tile "dis12" 2)(SET_TILE "dis12" "0.1")) (mode_tile "dis12" 1))) ((= key "mb13") (if (= x "1") (progn (mode_tile "dis13" 0) (mode_tile "dis13" 2)) (mode_tile "dis13" 1))) ((= key "mb14") (if (= x "1") (progn (mode_tile "dis14" 0) (mode_tile "dis14" 2)) (mode_tile "dis14" 1))) ((= key "mb15") (if (= x "1") (progn (mode_tile "dis15" 0) (mode_tile "dis15" 2)) (mode_tile "dis15" 1)))
((= key "clear") (if (= x "1") (progn (set_tile "dis1" "0")(set_tile "dis2" "0")(set_tile "dis3" "0")(set_tile "dis4" "0") (set_tile "dis5" "0")(set_tile "dis6" "0")(set_tile "dis7" "0")(set_tile "dis8" "0") (set_tile "dis9" "0")(set_tile "dis10" "0")(set_tile "dis11" "0")(set_tile "dis12" "0") (set_tile "setold" "0")))) ((= key "setold") (if (= x "1") (progn (SET_TILE "dis1" "1.0")(SET_TILE "dis2" "0.5")(SET_TILE "dis3" "0.5")(SET_TILE "dis4" "0.02") (SET_TILE "dis5" "0.6")(SET_TILE "dis6" "0.002")(SET_TILE "dis7" "0.03")(SET_TILE "dis8" "0.5") (SET_TILE "dis9" "1.5")(SET_TILE "dis10" "0.5")(SET_TILE "dis11" "0.1")(SET_TILE "dis12" "0.1") (set_tile "clear" "0")))) ) ) (defun hyfichb() (setq i 0) (setq list1 '()) (setq list2 '()) (if (= (get_tile "mb1") "1") (progn (setq list1 (cons (get_tile "dis1") list1)) (setq list2 (cons "001" list2)) ) ) (if (= (get_tile "mb2") "1") (progn (setq list1 (cons (get_tile "dis2") list1)) (setq list2 (cons "002" list2)) ) ) (if (= (get_tile "mb3") "1") (progn (setq list1 (cons (get_tile "dis3") list1)) (setq list2 (cons "003" list2)) ) ) (if (= (get_tile "mb4") "1") (progn (setq list1 (cons (get_tile "dis4") list1)) (setq list2 (cons "004" list2)) ) ) (if (= (get_tile "mb5") "1") (progn (setq list1 (cons (get_tile "dis5") list1)) (setq list2 (cons "005" list2)) ) ) (if (= (get_tile "mb6") "1") (progn (setq list1 (cons (get_tile "dis6") list1)) (setq list2 (cons "006" list2)) ) ) (if (= (get_tile "mb7") "1") (progn (setq list1 (cons (get_tile "dis7") list1)) (setq list2 (cons "007" list2)) ) ) (if (= (get_tile "mb8") "1") (progn (setq list1 (cons (get_tile "dis8") list1)) (setq list2 (cons "008" list2)) ) ) (if (= (get_tile "mb9") "1") (progn (setq list1 (cons (get_tile "dis9") list1)) (setq list2 (cons "009" list2)) ) ) (if (= (get_tile "mb10") "1") (progn (setq list1 (cons (get_tile "dis10") list1)) (setq list2 (cons "010" list2)) ) ) (if (= (get_tile "mb11") "1") (progn (setq list1 (cons (get_tile "dis11") list1)) (setq list2 (cons "die" list2)) ) ) (if (= (get_tile "mb12") "1") (progn (setq list1 (cons (get_tile "dis12") list1)) (setq list2 (cons "punch" list2)) ) ) (if (= (get_tile "mb13") "1") (progn (setq list1 (cons (get_tile "dis13") list1)) (setq list2 (cons "dd" list2)) (setq i (+ i 1)) ) ) (if (= (get_tile "mb14") "1") (progn (setq list1 (cons (get_tile "dis14") list1)) (setq list2 (cons "cc" list2)) ) ) (if (= (get_tile "mb15") "1") (progn (setq list1 (cons (get_tile "dis15") list1)) (setq list2 (cons "dh" list2)) ) ) (done_dialog 1) ) (defun hyfichc() ;;将list1 list2中的数据取去 (setvar "cmdecho" 0) (setq ss (ssget)) ;;选择物体 (setq j 0) (setq k (sslength ss)) (repeat (length list1) (setq dis (atof (nth j list1))) ;; 将表list1中的第j个原素取去 (setq lyname (nth j list2)) (setq j (+ j 1)) (setq n 0) (setq pt (list 99999999 99999999)) (repeat k (setq e (entget (setq e1 (ssname ss n)))) ;;取去实体中的一个原子 (setq n (1+ n)) (cond ((= "LWPOLYLINE" (cdr (assoc 0 e))) (progn (if (= dis 0) (command "copy" e1 "" pt pt ) (command "offset" dis e1 pt "") ) (setq e (entget (entlast))) (setq e (subst (cons 8 lyname) (assoc 8 e) e)) (entmod e) ) ) ((= "CIRCLE" (cdr (assoc 0 e))) (progn (if (= dis 0) (command "copy" e1 "" pt pt) (command "offset" dis e1 pt "") ) (setq e (entget (entlast))) (setq e (subst (cons 8 lyname) (assoc 8 e) e)) (entmod e) ) ) ((= "INSERT" (cdr (assoc 0 e))) (progn (command "copy" e1 "" pt (polar pt (* pi 0.25) (* dis 1.414))) (setq e (entget (entlast))) (setq e (subst (cons 8 (STRCAT lyname "mark")) (assoc 8 e) e)) (entmod e) (setq e1 (entlast)) (setq e2 (entnext e1)) (if(/= e2 nil) ;将长宽更正 (progn (setq ed2 (entget e2)) (while (= (cdr (assoc 0 ed2)) "ATTRIB") (cond ((= (strcase (cdr (assoc 2 ed2))) "CH") (PROGN (SETQ len1 (cdr (assoc 1 ed2))) (IF(or (> (STRLEN len1) 1) (/= (substr len1 1 1) " ")) (setq len1 (rtos (+ (atof len1) dis dis) 2 5)) ) (SETQ ED2 (SUBST (CONS 1 len1) (assoc 1 ed2) ed2)) (entmod ed2) (entupd e2) ) ) ((= (strcase (cdr (assoc 2 ed2))) "KUAN") (PROGN (SETQ len1 (cdr (assoc 1 ed2))) (IF(or (> (STRLEN len1) 1) (/= (substr len1 1 1) " ")) (setq len1 (rtos (+ (atof len1) dis dis) 2 5)) ) (SETQ ED2 (SUBST (CONS 1 len1) (assoc 1 ed2) ed2)) (entmod ed2) (entupd e2) ) ) ) (setq e2 (entnext e2)) (setq ed2 (entget e2)) ) ;while ) ) ;if ) ) ) ;;;end cond ) ;;end repeat ) ;;end repeat (princ) ) (defun hyfichcheck(key) (setq x (atof (get_tile key))) (if (>= x 0) (progn (set_tile "error" "") ) (progn (set_tile "error" (strcat (strcase key) "的值不能为负数!")) (mode_tile key 2) (mode_tile key 3) nil ) ) ) |