找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 886|回复: 2

[编程申请]:希望修改下面的程序为谢

[复制链接]

已领礼包: 196个

财富等级: 日进斗金

发表于 2006-11-4 12:45:15 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
该程序用于线切割算价
将压缩文件中的文件解压后,放在CAD目录下的SUPPORT文件夹里,加载后可直接使用,快捷命令:LL。
希望修改后增加“切割面积一栏:”
如果可能,去掉“国产机”、进口机“
希望高手修改后传我一份,谢谢
出现如下图片
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 196个

财富等级: 日进斗金

 楼主| 发表于 2006-11-4 12:49:47 | 显示全部楼层
三个文件
fanll.dcl的代码如下

chtk: dialog {
     label = "线割费用计算器";  
               : edit_box {
                 label = "请输入此模板厚度 mm:";
                 key = "TAO";
                 value = 25.0;
                 edit_width = 30;
                              }
           : boxed_column {
           fixed_width = true;
           fixed_height = true;
           label = "请选择线割类型及单价:";
           : boxed_row {
           fixed_width = true;
           fixed_height = true;
           alignment = top;
               : toggle {
                 label = "国产机";
                 key = "leie";
                              }
               : edit_box {
                 label = "直线单价(元/mm2):";
                 key = "leia";
                 edit_width = 6;
                              }
               : edit_box {
                 label = "小孔(元/个):";
                 key = "leic";
                 edit_width = 6;
                              }}
           : boxed_row {
           fixed_width = true;
           fixed_height = true;
               : toggle {
                 label = "进口机";
                 key = "leif";
                              }
               : edit_box {
                 label = "直线单价(元/mm2):";
                 key = "leib";
                 edit_width = 6;
                              }
               : edit_box {
                 label = "小孔(元/个):";
                 key = "leid";
                 edit_width = 6;
                              }}
}
   ok_cancel ;
}

chta: dialog {
     value = "计算的相关结果为:";
           : boxed_column {
           fixed_width = true;
           fixed_height = true;   
               : edit_box {
                 label = ".";
                 key = "pera";
                 value = " ";
                 edit_width = 40;
                              }
               : edit_box {
                 label = ".";
                 key = "perr";
                 value = " ";
                 edit_width = 40;
                              }
               : edit_box {
                 label = ".";
                 key = "perc";
                 value = " ";
                 edit_width = 40;
                              }
               : edit_box {
                 label = ".";
                 key = "perd";
                 value = " ";
                 edit_width = 40;
                              }
               : edit_box {
                 label = ".";
                 key = "perg";
                 value = " ";
                 edit_width = 40;
                              }
            }
   ok_cancel ;
}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 196个

财富等级: 日进斗金

 楼主| 发表于 2006-11-4 12:51:52 | 显示全部楼层
ll.lsp的代码如下

  1. (defun c:ll()
  2.    (setvar "cmddia" 0)
  3.    (setvar "cmdecho" 0)
  4.    (setq per 0)
  5.    (setq perr 0)
  6.    (setq pere 0)
  7.    (setq perf 0)
  8.    (setq perg 0)
  9.    (setq perb 0)
  10.    (setq price "0.033")
  11.    (setq tao "25.0")
  12.    (setq leie "0")
  13.    (setq leif "1")
  14.    (setq biao "国产机:")(lla)(setq leia price)
  15.    (setq biao "进口机:")(lla)(setq leib price)
  16.    (setq biao "进口机小孔:")(lla)(setq leid price)
  17.    (setq biao "国产机小孔:")(lla)(setq leic price)
  18.    (setq platename "此板")
  19.    (setq s (ssget))
  20.    (setq dcl_id (load_dialog (findfile "fanll.dcl")))
  21.    (if (not (new_dialog "chtk" dcl_id)) (exit))
  22.    (set_tile "TAO" tao)
  23.    (set_tile "leia" leia)
  24.    (set_tile "leib" leib)
  25.    (set_tile "leic" leic)
  26.    (set_tile "leid" leid)
  27.    (set_tile "leie" leie)
  28.    (set_tile "leif" leif)
  29.    (mode_tile "leid" 0)
  30.    (mode_tile "leib" 0)
  31.    (mode_tile "leia" 1)
  32.    (mode_tile "leic" 1)
  33.    (action_tile "leie" "(fcll)")
  34.    (action_tile "leif" "(fdll)")
  35.    (action_tile "accept" "(fbll)")
  36.    (setq dd (start_dialog))
  37.    (if (= dd 0)(exit))
  38.    (if (= leie "1")
  39.        (progn
  40.        (setq price (atof leia))
  41.        (setq pricea (atof leic)))
  42.        (progn
  43.        (setq price (atof leib))
  44.        (setq pricea (atof leid))
  45.      ))
  46.    (setq nu (sslength s))
  47.    (setq kc 0)
  48.    (while (< kc nu)
  49.       (setq en (ssname s kc))
  50.       (setq eni (entget en))
  51.       (setq xing (cdr (assoc 0 eni)))
  52.       (setq layera (cdr (assoc 8 eni)))
  53.       (cond ((= xing "LWPOLYLINE")
  54.             (command "_area" "object" en)
  55.             (setq per (getvar "perimeter")))
  56.            ((= xing "ARC")
  57.             (setq per (cdr (assoc 40 eni)))
  58.             (setq per (* 2 (* per pi)))
  59.             (setq aa (cdr (assoc 50 eni)))
  60.             (setq ab (cdr (assoc 51 eni)))
  61.             (setq ac (+ (- (* 2 pi) aa) ab))
  62.             (if (> ac (* 2 pi))
  63.                 (setq ac (- ac (* 2 pi))))
  64.             (setq per (* per (/ ac (* 2 pi)))))
  65.            ((= xing "CIRCLE")
  66.             (setq per (cdr (assoc 40 eni)))
  67.             (setq per (* 2 (* per pi)))
  68.             (if (< (* price (* per (atof tao))) pricea)
  69.                 (progn
  70.                 (setq perb (+ perb 1))
  71.                 (setq per 0)
  72.                 ))
  73.             )
  74.            ((= xing "LINE")
  75.             (setq pointa (cdr (assoc 10 eni)))
  76.             (setq pointb (cdr (assoc 11 eni)))
  77.             (command "dist" pointa pointb)
  78.             (setq per (getvar "distance")))
  79.           )
  80.       (setq kc (+ kc 1))
  81.       (setq perr (+ perr per))
  82.       )
  83.    (if (/= perr 0)
  84.       (progn
  85.       (setq pera (* perr 1000))
  86.       (setq pera (itoa (fix pera)))
  87.       (setq lengtha (strlen pera))
  88.       (setq pere (+ perr (*(*(* perr 1000) (atof tao)) price)))
  89.       (setq perr (itoa (fix pere)))
  90.       (setq lengthb (strlen perr))
  91.       (setq perr (strcat platename "线割线价格为:" (substr perr 1 (- lengthb 3)) "." (substr perr (- lengthb 2) 2) "元"))
  92.       (setq pera (strcat platename "线割线长度为:" (substr pera 1 (- lengtha 3)) "." (substr pera (- lengtha 2) 2) "mm"))
  93.       )
  94.       (progn
  95.       (setq perr (strcat platename "线割线价格为:" "0.00元"))
  96.       (setq pera (strcat platename "线割线长度为:" "0.00mm"))
  97.       ))
  98.    (if (/= perb 0)
  99.       (progn
  100.       (setq perf (* (* perb pricea) 1000))
  101.       (setq perd (itoa (fix (* (* perb pricea) 1000))))
  102.       (setq lengthc (strlen perd))
  103.       (setq perc (strcat platename "线割孔个数为:" (itoa perb) "个"))
  104.       (setq perd (strcat platename "线割孔总价为:" (substr perd 1 (- lengthc 3)) "." (substr perd (- lengthc 2) 2) "元"))
  105.       )
  106.       (progn
  107.       (setq perc (strcat platename "线割孔个数为:" "0个"))
  108.       (setq perd (strcat platename "线割孔总价为:" "0.00元"))
  109.       ))
  110.    (setq perg (itoa (fix (+ pere perf))))
  111.    (setq lengthd (strlen perg))
  112.    (setq perg (strcat "总计:" (substr perg 1 (- lengthd 3)) "." (substr perg (- lengthd 2) 2) "元"))
  113.    (if (not (new_dialog "chta" dcl_id)) (exit))
  114.    (set_tile "perr" perr)
  115.    (set_tile "pera" pera)
  116.    (set_tile "perc" perc)
  117.    (set_tile "perd" perd)
  118.    (set_tile "perg" perg)
  119.    (action_tile "accept" "(fall)")
  120.    (setq dd (start_dialog))
  121.    (if (= dd 0)(exit))
  122.    (graphscr)
  123.    (setvar "cmddia" 1)
  124.    (setvar "cmdecho" 1)
  125.    (princ)
  126. )
  127. (defun lla()
  128.   (setq sDlgNameAndPath (findfile "slid.txt"))
  129.   (setq f (open sDlgNameAndPath "r"))
  130.   (setq panzhuan (read-line f))
  131.   (while (not (wcmatch panzhuan biao))
  132.        (setq panzhuan (read-line f))
  133.        (setq price (read-line f)))
  134.   (close f)
  135.   )
  136. (defun fbll()
  137.     (setq tao (get_tile "TAO"))
  138.     (setq leia (get_tile "leia"))
  139.     (setq leib (get_tile "leib"))
  140.     (setq leic (get_tile "leic"))
  141.     (setq leid (get_tile "leid"))
  142.     (setq leie (get_tile "leie"))
  143.     (setq leif (get_tile "leif"))
  144.     (done_dialog dcl_id)
  145. )
  146.   
  147. (defun fall()
  148.     (setq perr (get_tile "perr"))
  149.     (setq pera (get_tile "pera"))
  150.     (done_dialog dcl_id)
  151. )
  152. (defun fcll()
  153.    (set_tile "leia" leia)
  154.    (set_tile "leic" leic)
  155.    (set_tile "leie" "1")
  156.    (set_tile "leif" "0")
  157.    (mode_tile "leid" 1)
  158.    (mode_tile "leib" 1)
  159.    (mode_tile "leia" 0)
  160.    (mode_tile "leic" 0)
  161.   )
  162. (defun fdll()
  163.    (set_tile "leib" leib)
  164.    (set_tile "leid" leid)
  165.    (set_tile "leie" "0")
  166.    (set_tile "leif" "1")
  167.    (mode_tile "leid" 0)
  168.    (mode_tile "leib" 0)
  169.    (mode_tile "leia" 1)
  170.    (mode_tile "leic" 1)
  171.   )

slid.txt文件的内容如下
These are some refrence data:
国产机:
0.005
进口机:
0.02
国产机小孔:
5.0
进口机小孔:
12.0
end
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2025-9-21 04:21 , Processed in 0.176491 second(s), 37 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表