模具论坛

 找回密码
 注册

扫一扫,微信登录

QQ登录

只需一步,快速开始

搜索
热搜: 冲压 注塑 求助
    回车查看更多
    论坛可能已存在您要发布的主题帖 关闭
      查看: 1353|回复: 3

      [求助] 请教图框问题

      [复制链接]
      发表于 2009-8-29 16:47:06 | 显示全部楼层 |阅读模式
      求教华哥
      我这里有一段自动打印的LSP源代码,但是却没有适合这个代码的图框,请版主有空能不能帮我搞个适合自动打印的图框,谢谢了!

      ;將選集內所有符合條件之圖框按其頁碼序號順次批量打印,若"總張數"與"張次"中任一屬性未編輯完全或不符程序指定
      ;條件,命令將拒絕響應;
      ;註:"張次"為純實數表示的字符串,"總張數"除末位外為純實數表示的字符串.)
      (defun c:ZXC()(setq cmd(getvar "cmdecho"))(setvar "cmdecho" 0)
        (setq plot_style "1011.ctb")
        (prompt "\n注意:若指定打印機(或前次出圖打印機)為'HP LaserJet 5000 Series PCL',請輸入'C'!!!")
        (prompt "\n若指定打印機(或前次出圖打印機)為'EPSON EPL-N2010 Advanced',請輸入'B'!!!")
        (prompt "\n其它輸入均以'HP LaserJet 5100 PCL 6'打印機打印!!!")
        (initget 6 "A B C")
        (setq tab(getint "\n請選擇打印機類型 [HP 5000(A)/EPSON 2010(B)/HP 5000(C)"))
        (if (= tab "B")
          (progn
            (setq tab 2))
          (progn
            (if (= tab "C")
      (progn
         (setq tab 3))
      (progn
         (setq tab 1))
      )
            )
          )
        
        (cond ((= tab 1)(setq plot_machine "HP LaserJet 1010PCL 6")))
        (cond ((= tab 2)(setq plot_machine "")))
        (cond ((= tab 3)(setq plot_machine "")))
        (princ)      
        
        (setq obj_sel(ssget ":s" ' ((0 . "INSERT") (2 . "PX-A*"))))  
        (setq formats_num(sslength obj_sel))(setq jump 1)(setq count 0)
        (setq tol_str(cdr (assoc 1 (entget (get_attvalue (entget(ssname obj_sel 0)) "總張數")))))
        
        (if (= (distof (substr tol_str (strlen tol_str) 1)) nil)
          (progn
            (setq tol_str(substr tol_str 1 (- (strlen tol_str) 1)))
            (if (= (distof (substr tol_str (strlen tol_str) 1)) nil)
      (progn
         (prompt "\n圖框屬性編輯未完成,程序拒絕響應!!!")
         (princ)
         )
      )
            )
          )
        
        (while (<= jump (distof tol_str))
          (progn
            (setq jump# 0)
            (while (< jump# formats_num)
      (setq format_name(cdr(assoc 2 (entget(ssname obj_sel jump#)))))
      (setq format_base(cdr(assoc 10 (entget(ssname obj_sel jump#)))))
      (setq format_scale(cdr(assoc 41 (entget(ssname obj_sel jump#)))))
      (setq format_angle(cdr(assoc 50 (entget(ssname obj_sel jump#)))))
      (setq ucs_base(trans format_base 0 1))
      (setq sheet_code(cdr(assoc 1 (entget(get_attvalue(entget(ssname obj_sel jump#)) "張次")))))
      (if (= format_name "PX-A3")
         (progn
           (setq plot_pnt(polar ucs_base (- format_angle (atan 285.0 400.0))
            (* format_scale (sqrt(+ (sqr_x 285.0) (sqr_x 400.0))))))     
           (if (or (= sheet_code (itoa jump))(wcmatch  sheet_code (strcat (itoa jump) "@")))
             (progn
        (prompt (strcat "正打印圖紙總數" tol_str "張中第" (itoa jump) "張,目前已打印"
          (itoa count)"張,請稍候:"))(princ)
        (if (or (and (<= format_angle (* 1.6 pi))(>= format_angle (* 1.4 pi)))
         (and (<= format_angle (* 0.6 pi))(>= format_angle (* 0.4 pi))))
          (progn
            (if (= tab 1)
              (command "-plot" "Y" "" plot_machine "A3" "M" "P" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "0,3.31" "Y" plot_style "Y" "A" "N" "N" "Y"))
            (if (= tab 2)
              (command "-plot" "Y" "" plot_machine "A3 297 x 420 mm" "M" "P" "N" "W" "none"
                ucs_base "none" plot_pnt "F" "0,3.91" "Y" plot_style "Y" "A" "N" "N" "Y"))
            (if (= tab 3)
              (command "-plot" "Y" "" plot_machine "A3" "M" "P" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "0,5.21" "Y" plot_style "Y" "A" "N" "N" "Y")))
          (progn
            (if (= tab 1)
              (command "-plot" "Y" "" plot_machine "A3" "M" "L" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "3.31,0" "y" plot_style "Y" "A" "N" "N" "Y"))
            (if (= tab 2)
              (command "-plot" "Y" "" plot_machine "A3 297 x 420 mm" "M" "L" "N" "W" "none"
                ucs_base "none" plot_pnt "F" "3.91,0" "Y" plot_style "Y" "A" "N" "N" "Y"))
            (if (= tab 3)
              (command "-plot" "Y" "" plot_machine "A3" "M" "L" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "5.21,0" "Y" plot_style "Y" "A" "N" "N" "Y"))))
        (setq count(+ count 1))  
        (if (= count 1)
          (progn
            (setq first sheet_code)
            )
          )
        (setq final sheet_code)
        )
             )
           )
         )
      (if (= format_name "PX-A4")
         (progn
           (setq plot_pnt(polar ucs_base (- format_angle (atan 275.0 195.0))
            (* format_scale (sqrt(+ (sqr_x 275.0) (sqr_x 195.0))))))
           (if (or (= sheet_code (itoa jump))(wcmatch  sheet_code (strcat (itoa jump) "@")))
             (progn
        (prompt (strcat "正打印圖紙總數" tol_str "張中第" (itoa jump) "張,目前已打印"
          (itoa count)"張,請稍候:"))(princ)
        (if (or (and (<= format_angle (* 1.6 pi))(>= format_angle (* 1.4 pi)))
         (and (<= format_angle (* 0.6 pi))(>= format_angle (* 0.4 pi))))
           (progn
            (if (= tab 1)
              (command "-plot" "Y" "" plot_machine "A4" "M" "L" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "2.14,0" "Y" plot_style "Y" "A" "N" "N" "Y"))
            (if (= tab 2)
              (command "-plot" "Y" "" plot_machine "A4 210 x 297 mm" "M" "L" "N" "W" "none"
                ucs_base "none" plot_pnt "F" "2.86,0" "Y" plot_style "Y" "A" "N" "N"
                "Y"))
            (if (= tab 3)
              (command "-plot" "Y" "" plot_machine "A4" "M" "L" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "5.22,0" "Y" plot_style "Y" "A" "N" "N" "Y")))
          (progn
            (if (= tab 1)
              (command "-plot" "Y" "" plot_machine "A4" "M" "P" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "0,2.14" "Y" plot_style "Y" "A" "N" "N" "Y"))
            (if (= tab 2)
              (command "-plot" "Y" "" plot_machine "A4 210 x 297 mm" "M" "P" "N" "W" "none"
                ucs_base "none" plot_pnt "F" "0,2.86" "Y" plot_style "Y" "A" "N" "N"
                "Y"))
            (if (= tab 3)
              (command "-plot" "Y" "" plot_machine "A4" "M" "P" "N" "W" "none" ucs_base "none"
                plot_pnt "F" "0,5.22" "Y" plot_style "Y" "A" "N" "N" "Y"))))
        (setq count(+ count 1))
        (if (= count 1)
          (progn
            (setq first sheet_code)
            )
          )
        (setq final sheet_code)
        )
             )
           )
         )
      (setq jump#(+ 1 jump#))
      )
            (setq jump(+ 1 jump))
            )
          )
        (prompt(strcat "打印圖紙共" (itoa count) "張!!其中首頁為:" first ",尾頁為:" final))
        (setvar "cmdecho" cmd)(princ))
      ;*****************************************************************************************
       楼主| 发表于 2009-8-29 16:48:26 | 显示全部楼层
      各位大侠们有空也试一下啊,兄弟我在这里多谢了
      发表于 2009-8-29 16:58:35 | 显示全部楼层
      plot_style   1011.ctb
      打印機
      C為 HP LaserJet 5000 Series PCL
      B為 EPSON EPL-N2010 Advanced
      其它輸入均以 HP LaserJet 5100 PCL 6  打印機

      INSERT 圖框  PX-A*
      圖框屬性編輯未完成,程序拒絕響應
       楼主| 发表于 2009-8-29 17:21:44 | 显示全部楼层
      楼上的是认为,这个LSP源程序有问题吗,还请多多指教啊!
      您需要登录后才可以回帖 登录 | 注册

      本版积分规则

      关闭

      招聘信息 上一条 /5 下一条

      关闭

      求职信息 上一条 /5 下一条

      关闭

      技术求助 上一条 /5 下一条

      QQ|小黑屋|手机版|模具论坛 ( 浙ICP备15037217号 )

      GMT+8, 2025-5-5 21:56

      Powered by Discuz! X3.4

      © 2001-2013 Comsenz Inc.

      快速回复
      返回顶部
      返回列表
       
      客服电话:0577-61318188
      模具论坛交流群:
      模具论坛交流群
      工作时间:
      08:30-17:30