edm520 发表于 2019-12-18 13:30:34

有大神帮忙改下弄个自动添加打印机吗?

(defun c:qa()
   (if(setq ed1(tblsearch "LAYER" "base"))
   (progn
       (setq ed2(cdr (assoc 70 ed1)))
       (cond
         ((= ed2 0)(command "layer" "ON" "base" "f" "base" ""))
      ;((= ed2 1)(command "layer" "t" "base" "f" "base" ""))
         ((= ed2 4)(command "layer" "u" "base" "f" "base" ""))
         ((= ed2 5)(progn (command "layer" "ON" "base" "u" "base" "f" "base" "")))
       )
    )
   )

   (setvar "cmdecho" 0)
   (setq n 0)
   (princ "\n叫匡拒璶瓜:")
   (setq ss (ssget))
   (setq i (sslength ss))
   (setq j 0)
   (repeat i
   (setq en (ssname ss j))
   (setq j (+ j 1))
   (setq form (entget en))
   (if(and (= (cdr(assoc 0 form)) "INSERT") (= (cdr(assoc 2 form)) "A3"))
       (progn
         (setq pick_point(trans(cdr(assoc 10 form)) 0 1))
         (setq form_scale(cdr(assoc 41 form)))
         (setq first_corner(list (- (car pick_point) (* 225 form_scale)) (- (cadr pick_point) (* 148 form_scale))))
         (setq other_corner(list (+ (car pick_point) (* 205 form_scale)) (+ (cadr pick_point) (* 145 form_scale))))
         (setvar "plotid" "hp_5004")
         (command "plot" "w" first_corner other_corner "0")

         (setq n(+ 1 n))
         (princ(strcat "\n-------  A3 材" (rtos n 2 0) "--------"))
         (princ)
       )
    )
   (if(and (= (cdr(assoc 0 form)) "INSERT") (= (cdr(assoc 2 form)) "A4"))
       (progn
         (setq pick_point(trans (cdr(assoc 10 form)) 0 1))
         (setq form_scale(cdr(assoc 41 form)))
         (setq first_corner(list (- (car pick_point) (* 104 form_scale)) (- (cadr pick_point) (* 145 form_scale))))
         (setq other_corner(list (+ (car pick_point) (* 96 form_scale)) (+ (cadr pick_point) (* 145 form_scale))))
         (setvar "plotid" "hp_5005")
         (command "plot" "w" first_corner other_corner "0")

         (setq n(+ 1 n))
         (princ(strcat "\n-------  A4 材" (rtos n 2 0) "--------"))
         (princ)
       )
    )
)
   (princ(strcat "******* Ч拨," (rtos n 2 0) ".*******"))
   (princ)
)
    (princ "\n<е硉> loaded!")
    (princ)


页: [1]
查看完整版本: 有大神帮忙改下弄个自动添加打印机吗?