明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5300|回复: 14

[基础] 我也玩玩山寨,哈哈,DCL 控件

[复制链接]
发表于 2014-6-24 19:44 | 显示全部楼层 |阅读模式
本帖最后由 邹锋 于 2014-6-24 19:46 编辑

大家好,我TONY 又来分享我的程序了,爱分享爱源码, ,希望帮到更多人,提高大家的水平
这是个初级帖子,高手请绕路,

此程序只适合模具介使用,但调用DCL 各控件你们可以借鉴下学习下,
在工作作常用的燕秀外挂,但是它的只使用的是大同顶针,我公司常做欧洲模具,经常用到HASCO 顶针,所以模仿燕秀外挂做了个DCL 介面的工具

下面是燕秀外挂中的



下面是我仿他的程序,  使用HASCO 标准件




点击下面可下载
  1. (defun c:HET(/ pl ddlst l1 l3 l4 cl1 cl2 cl3 cl4 dd TYP)
  2.   (setvar "cmdecho" 0)
  3.   (hascocanshu);设置顶针参数
  4.   (hascodcl)
  5.   (prin1)
  6. )

  7. (defun hascocanshu ()
  8.   (setq ddlst '("dd1" "dd2" "dd3" "dd4" "dd5" "dd6"))
  9.   (setq pl '("顶针Z41/" "托针Z44" "司筒Z45" "扁顶Z46" "镶针Z40/Z41"))
  10.   (setq        L1 '("1"    "1.2"  "1.5"  "2"         "2.5"        "3"    "3.5"  "4"
  11.              "4.5"  "5"           "5.5"  "6"         "6.5"        "7"    "8"    "8.5"
  12.              "9"    "10"   "10.5" "11"         "12"        "12.5" "14"   "16"
  13.              "18"   "20"   "25"          "32"
  14.             )
  15.         )
  16.   (setq        L2 '("0.8"   "0.9"   "1"     "1.1"   "1.2"   "1.3"   "1.4"
  17.              "1.5"   "1.6"   "1.7"   "1.8"   "1.9"   "2"     "2.2"
  18.              "2.5"
  19.             )
  20.         )
  21.   (setq        L3 '("2"    "2.5"  "3"         "4"        "4.5"  "5"    "5.5"
  22.              "6"    "7"           "8"          "9"         "10"  "11"    "12"
  23.              "14"   "16"  "20"   "25"
  24.             )
  25.         )
  26.   (setq        L4 '("3.8X0.8"          "3.8X1"      "3.8X1.2"    "4.5X1"
  27.              "4.5X1.2"          "4.5X1.5"    "5.5X1"            "5.5X1.2"
  28.              "5.5X1.5"          "5.5X2"      "7.5X1.2"    "7.5X1.5"
  29.              "7.5X2"          "9.5X1.5"    "9.5X2"            "11.5X2"
  30.              "11.5X2.5"          "15.5X2"     "15.5X2.5"
  31.             )
  32.         )
  33.   (setq        cl1 (list '(2.5 1.2) '(2.5 1.2)        '(3 1.5)   '(4 2)
  34.                   '(5 2)     '(6 3)        '(7 3)           '(8 3)
  35.                   '(8 3)     '(10 3)        '(10 3)           '(12 5)
  36.                   '(12 5)    '(12 5)        '(14 5)           '(14 5)
  37.                   '(14 5)    '(16 5)        '(16 5)           '(16 5)
  38.                   '(18 7)    '(18 7)        '(22 7)           '(22 7)
  39.                   '(24 7)    '(26 8)        '(32 10)   '(40 10)
  40.                  )
  41.         )
  42.   (setq cl2 (list '(4 2 2) '(6 3 3)
  43.                   )
  44.         )
  45.   (setq cl3 (list '(4 2 1) '(5 2 1) '(6 3 1.5) '(8 3 2) '(8 3 2.5) '(10 3 2.5) '(10 3 3.5)
  46.                   '(12 5 3.5) '(12 5 4.5) '(14 5 5) '(14 5 6) '(16 5 6) '(18 5 8) '(20 7 8)
  47.                   '(22 7 10)  '(22 7 12) '(26 7 16) '(32 10 20)
  48.                   )
  49.         )
  50.   (setq cl4 (list '(4.2 8 3 3.8 0.8) '(4.2 8 3 3.8 1) '(4.2 8 3 3.8 1.2) '(5 10 3 4.5 1)
  51.                   '(5 10 3 4.5 1.2) '(5 10 3 4.5 1.5) '(6 12 5 5.5 1) '(6 12 5 5.5 1.2)
  52.                   '(6 12 5 5.5 1.5) '(6 12 5 5.5 2) '(8 14 5 7.5 1.2) '(8 14 5 7.5 1.5)
  53.                   '(8 14 5 7.5 2) '(10 16 5 9.5 1.5) '(10 16 5 9.5 2)  '(12 18 7 11.5 2)
  54.                   '(12 18 7 11.5 2.5) '(16 22 7 15.5 2) '(16 22 7 15.5 2.5)
  55.                   )
  56.         )
  57. )




  58. (defun hascodcl()
  59.   (setq dcl_id (load_dialog "hascoet"))
  60.   (if (not (new_dialog "hascoet" dcl_id))
  61.     (progn (alert "不能装入对话框") (exit))
  62.   )
  63.   (setetdcl)
  64.   (action_tile "poplist" "(sub_LIST2 $value)")
  65.   (action_tile "listbox" "(sub_LIST3 $value)")
  66.   (action_tile "im1" "(sub_lst 0)")
  67.   (action_tile "accept" "(getlist)(done_dialog 1)")
  68.   (action_tile "cancel" "(done_dialog)")
  69.   (setq dd (start_dialog))
  70.   (if (= dd 1)
  71.     (makehet)
  72.   )
  73. )

  74. (defun setetdcl(/ sldlist ii aa)
  75.   (show_list "poplist" pl)
  76.   (show_list "listbox" L1)
  77.   (show_sld "img1" "顶针")
  78.   (set_tile "text1" "顶针直径:")
  79.   (set_tile "listbox" (itoa  7))
  80.   (mapcar 'set_tile  (list "dd1" "dd2" "dd3" "dd4" "dd5" "dd6") (list "4" "" "" "8" "3" ""))
  81.   (mapcar 'mode_tile  ddlst '(0 1 1 0 0 1));设置那6个编辑框状态,1为灰色不可编辑,0为可编辑
  82. )

  83. (defun show_list (key newlist)
  84.   (start_list key)
  85.   (mapcar 'add_list newlist)
  86.   (end_list)
  87. )

  88. (defun show_sld        (key sld)
  89.   (setq x (dimx_tile key))
  90.   (setq y (dimy_tile key))
  91.   (start_image key)
  92.   (fill_image 0 0 x y 0)
  93.   (slide_image 0 0 x y sld)
  94.   (end_image)
  95. )

  96. (defun sub_LIST2 (num / )
  97.   (cond ((= num "0")
  98.          (setetdcl)
  99.          )
  100.         ((= num "1")
  101.          (show_list "listbox" L2)
  102.          (show_sld "img1" "托针")
  103.          (set_tile "text1" "托针直径:");设置编辑框左边的文字
  104.          (set_tile "text2" "  托直径:");设置编辑框左边的文字
  105.          (set_tile "listbox" (itoa  0));默认设置为第一个
  106.          (mapcar 'set_tile  ddlst '("0.8" "2" "" "4" "2" "50"));设置编辑框默认参数
  107.          (mapcar 'mode_tile  ddlst '(0 0 1 0 0 0));设置编辑框默认编辑状态
  108.          )
  109.         ((= num "2")
  110.          (show_list "listbox" L3)
  111.          (show_sld "img1" "司筒")
  112.          (set_tile "text1" "  筒直径:")
  113.          (set_tile "text2" "  针直径:")
  114.          (set_tile "listbox" (itoa  3))
  115.          (mapcar 'set_tile  ddlst '("4" "2" "" "8" "3" ""))
  116.          (mapcar 'mode_tile  ddlst '(0 0 1 0 0 1))
  117.          )
  118.         ((= num "3")
  119.          (show_list "listbox" L4)
  120.          (show_sld "img1" "扁顶")
  121.          (set_tile "text1" "      长:")
  122.          (set_tile "text2" "      宽:")
  123.          (set_tile "text3" "    直径:")
  124.          (set_tile "listbox" (itoa  1))
  125.          (mapcar 'set_tile  ddlst '("3.8" "1" "4.2" "8" "3" "50"))
  126.          (mapcar 'mode_tile  ddlst '(0 0 0 0 0 0))
  127.          )
  128.         ((= num "4")
  129.          (show_list "listbox" L1)
  130.          (show_sld "img1" "镶针")
  131.          (set_tile "text1" "镶针直径:")
  132.          (set_tile "listbox" (itoa  7))
  133.          (mapcar 'set_tile  (list "dd1" "dd2" "dd3" "dd4" "dd5" "dd6") (list "4" "" "" "8" "3" ""))
  134.          (mapcar 'mode_tile  ddlst '(0 1 1 0 0 1))
  135.          )
  136.         )
  137. )

  138. (defun sub_LIST3 (num)
  139.   (setq nn (atoi num))
  140.   (setq typ (get_tile "poplist"))
  141.   (cond ((or (= typ "0") (= typ "4"))
  142.          (setq 2rad (nth nn l1))
  143.          (setq d1 (rtos (car (nth nn cl1)) 2 0))
  144.          (setq k (rtos (cadr (nth nn cl1)) 2 0))
  145.          (set_tile "dd1" 2rad)
  146.          (set_tile "dd4" d1)
  147.          (set_tile "dd5" k)
  148.          )
  149.         ((= typ "1")
  150.          (setq 2rad (atof (nth nn l2)))
  151.          (if (< 2rad 1.5)
  152.            (setq tuocs (nth 0 cl2))
  153.            (setq tuocs (nth 1 cl2))
  154.            )
  155.          (setq d2 (rtos (car tuocs) 2 0))
  156.          (setq k (rtos (cadr tuocs) 2 0))
  157.          (setq d3 (rtos (caddr tuocs) 2 0))
  158.          (set_tile "dd1" (rtos 2rad 2 1))
  159.          (mapcar 'set_tile  (list "dd1" "dd2" "dd3" "dd4" "dd5" "dd6")
  160.                  (list (rtos 2rad 2 1) d3 "" d2 k "50"))
  161.          )
  162.         ((= typ "2")
  163.          (setq 2rad (nth nn l3))
  164.          (setq tuocs (nth nn cl3))
  165.          (setq d2 (rtos (car tuocs) 2 0))
  166.          (setq k (rtos (cadr tuocs) 2 0))
  167.          (setq d3 (rtos (caddr tuocs) 2 0))
  168.          (mapcar 'set_tile  (list "dd1" "dd2" "dd3" "dd4" "dd5" "dd6")
  169.                  (list 2rad d3 "" d2 k ""))
  170.          )
  171.         ((= typ "3")
  172.          (setq tuocs (nth nn cl4))
  173.          (setq d1 (rtos (nth 0 tuocs) 2 1))
  174.          (setq d2 (rtos (nth 1 tuocs) 2 1))
  175.          (setq k (rtos (nth 2 tuocs) 2 1))
  176.          (setq aa (rtos (nth 3 tuocs) 2 1))
  177.          (setq bb (rtos (nth 4 tuocs) 2 1))
  178.          (mapcar 'set_tile  (list "dd1" "dd2" "dd3" "dd4" "dd5" "dd6")
  179.                  (list aa bb d1 d2 k "50"))
  180.          )
  181.         )
  182.   )

  183. (defun getlist ()
  184.   (setq typ (get_tile "poplist"))
  185.   (cond ((or (= typ "0") (= typ "4"))
  186.          (setq etdd (atof (get_tile "dd1")))
  187.          (setq w1 (/ (atof (get_tile "dd4")) 2))
  188.          (setq h1 (atof (get_tile "dd5")))
  189.          )
  190.         ((= typ "1")
  191.          (setq etd (atof (get_tile "dd1")))
  192.          (setq netd (atof (get_tile "dd2")))
  193.          (setq w1 (/ (atof (get_tile "dd4")) 2))
  194.          (setq h1 (atof (get_tile "dd5")))
  195.          (setq netdh (atof (get_tile "dd6")))
  196.          )
  197.         ((= typ "2")
  198.          (setq etdd (atof (get_tile "dd1")))
  199.          (setq netd (atof (get_tile "dd2")))
  200.          (setq w1 (/ (atof (get_tile "dd4")) 2))
  201.          (setq h1 (atof (get_tile "dd5")))
  202.          (setq netdz (get_tile "dd2"))
  203.          (if  (/= (vl-position netdz l1) nil)
  204.            (progn
  205.              (setq i (vl-position netdz l1))
  206.              (setq necs (nth i cl1))
  207.              (setq w2 (/ (float (car necs)) 2))
  208.              (setq h2 (cadr necs))
  209.              )
  210.            (progn
  211.              (setq netdz (rtos (fix netd) 2 0))
  212.              (setq i (vl-position netdz l1))
  213.              (setq necs (nth i cl1))
  214.              (setq w2 (/ (float (car necs)) 2))
  215.              (setq h2 (cadr necs))
  216.              )
  217.            )
  218.          )
  219.         ((= typ "3")
  220.          (setq etd (atof (get_tile "dd2")))
  221.          (setq netd (atof (get_tile "dd3")))
  222.          (setq w1 (/ (atof (get_tile "dd4")) 2))
  223.          (setq h1 (atof (get_tile "dd5")))
  224.          (setq netdh (atof (get_tile "dd6")))
  225.          )
  226.         )
  227.   (princ)
  228.   )

  229. (defun makehet(/ p1 p2 chklty ang1 ettyp p3)
  230.   (setvar "orthomode" 1)
  231.   (setq chklty (tblsearch "LTYPE" "CENTER"))
  232.   (if (= chklty nil)
  233.     (entmake
  234.       (list '(0 . "LTYPE")
  235.             '(100 . "AcDbSymbolTableRecord")
  236.             '(100 . "AcDbLinetypeTableRecord")
  237.             (cons 2 "CENTER")
  238.             '(3 . "Center ____ _ ____ _ ____ _ ____ _ ____ _ ____")
  239.             '(70 . 0)
  240.             '(73 . 2)
  241.             '(40 . 15.0)
  242.             '(49 . 10.0)
  243.             '(74 . 0)
  244.             '(49 . -5.0)
  245.             '(74 . 0)
  246.       )
  247.     )
  248.   )
  249.   (cond ((= typ "0")
  250.          (setq ettyp "epin")
  251.          (while   (setq p1 (getpoint "\n 指定第一点:"))
  252.            (setq p2 (getpoint p1 "\n 指定第二点:"))
  253.            (setq ang1 (angle p1 p2))
  254.            (if (> (distance p1 p2) 30)
  255.              (makedz p1 p2 ettyp etdd w1 h1 ang1)
  256.              (alert "两点小于30,重新选择")
  257.              )
  258.            )
  259.          )
  260.         ((= typ "1")
  261.          (setq ettyp "epin")
  262.          (while   (setq p1 (getpoint "\n 指定第一点:"))
  263.            (setq p2 (getpoint p1 "\n 指定第二点:"))
  264.            (setq ang1 (angle p1 p2))
  265.            (if (> (distance p1 p2) 76)
  266.              (make_bd p1 p2 ettyp etd netd w1 h1 netdh ang1)
  267.              (alert "长度小于75,重新选择")
  268.              )
  269.            )
  270.          )
  271.         ((= typ "2")
  272.          (setq ettyp "epin")
  273.          (while   (setq p1 (getpoint "\n 指定第一点:"))
  274.            (setq p2 (getpoint p1 "\n 指定第二点:"))
  275.            (setq p3 (getpoint p2 "\n 指定第下一点:"))
  276.            (setq ang1 (angle p1 p2))
  277.            (setq p3 (polar p2 ang1 (distance p2 p3)))
  278.            (makedz p1 p3 ettyp netd w2 h2 ang1)
  279.            (makedz p2 p3 ettyp etdd w1 h1 ang1)
  280.            )
  281.          )
  282.         ((= typ "3")
  283.          (setq ettyp "epin")
  284.          (while   (setq p1 (getpoint "\n 指定第一点:"))
  285.            (setq p2 (getpoint p1 "\n 指定第二点:"))
  286.            (setq ang1 (angle p1 p2))
  287.            (if (> (distance p1 p2) 76)
  288.              (make_bd p1 p2 ettyp etd netd w1 h1 netdh ang1)
  289.              (alert "长度小于75,重新选择")
  290.              )
  291.            )
  292.          )       
  293.         ((= typ "4")
  294.          (setq ettyp "insert")
  295.          (while   (setq p1 (getpoint "\n 指定第一点:"))
  296.            (setq p2 (getpoint p1 "\n 指定第二点:"))
  297.            (setq ang1 (angle p1 p2))
  298.            (if (> (distance p1 p2) 10)
  299.              (makedz p1 p2 ettyp etdd w1 h1 ang1)
  300.              (alert "两点小于10,重新选择")
  301.              )
  302.            )
  303.          )
  304.         )
  305.   (princ)
  306. )






  307. ;;;;;;;;;;;;;;;画顶针与镶针函数,
  308. ;;p1第一点,P2,第二点,TYP为顶针或者镶针;ETD为顶针直径 W1为顶针头的半径,H1为顶针头的高度
  309. (defun makedz(p1 p2 typ etd w1 h1 ang1 / 0.5pi 1.5pi 2pi ang1 ang2 ang3 etd
  310.               p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20)
  311.   (setq 0.5pi (* pi 0.5))
  312.   (setq 1.5pi (* pi 2))
  313.   (setq 2pi (* pi 2))
  314.   (setq P1 (trans p1 1 0))
  315.   (setq P2 (trans p2 1 0))  
  316.   (entmake (list
  317.              '(0 . "LINE")
  318.              (cons 10 p1)
  319.              (cons 11 p2)
  320.              (cons 62 1)
  321.              (cons 6 "CENTER")
  322.              (cons 8 typ)
  323.              (cons 48 0.1)
  324.              )
  325.            )
  326.   (setq ang2 (nth 0 (getang ang1)))
  327.   (setq ang3 (nth 1 (getang ang1)))
  328.   (setq p3 (polar p1 ang2 w1)
  329.         p4 (polar p3 ang1 h1)
  330.         )
  331.   (setq p5 (polar p3 ang2 0.5)
  332.         p6 (polar p5 ang1 h1)
  333.         )
  334.   (setq p7 (polar p1 ang3 w1)
  335.         p8 (polar p7 ang1 h1)
  336.         )
  337.   (setq p9 (polar p7 ang3 0.5)
  338.         p10 (polar p9 ang1 h1)
  339.         )
  340.   (setq p11 (polar (polar p1 ang2 (/ etd 2)) ang1 h1)
  341.         p12 (polar p2 ang2 (/ etd 2))
  342.         )
  343.   (setq p13 (polar (polar p1 ang3 (/ etd 2)) ang1 h1)
  344.         p14 (polar p2 ang3 (/ etd 2))
  345.         )
  346.   (mkl p3 p4 typ)
  347.   (mkl p5 p6 typ)
  348.   (mkl p7 p8 typ)
  349.   (mkl p9 p10 typ)
  350.   (mkl p4 p8 typ)
  351.   (mkl p6 p10 typ)
  352.   (mkl p11 p12 typ)
  353.   (mkl p13 p14 typ)
  354.   (if (= typ "epin")
  355.     (if (> (distance p1 p2) 30)
  356.       (progn
  357.         (setq p15 (polar p11 ang2 0.25)
  358.               p16 (polar p15 ang1 (- (distance p1 p2) 30))
  359.               p17 (polar p11 ang1 (+ (- (distance p1 p2) 30) 0.25))
  360.               )
  361.         (setq p18 (polar p13 ang3 0.25)
  362.               p19 (polar p18 ang1 (- (distance p1 p2) 30))
  363.               p20 (polar p13 ang1 (+ (- (distance p1 p2) 30) 0.25))
  364.               )
  365.         (mkl p15 p16 "epin")
  366.         (mkl p16 p17 "epin")
  367.         (mkl p18 p19 "epin")
  368.         (mkl p19 p20 "epin")
  369.         )
  370.       )
  371.     )
  372.   )


  373. ;;;此处可以做成一个子函数,可节省代码行数,但便于别人好学习,还是分开为两处子程序
  374. (defun make_bd(p1 p2 typ etd netd w1 h1 netdh ang1 / 0.5pi 1.5pi 2pi
  375.                ang2 ang3 p3 p4 p5 p6 p6 p7 p8 p9 p10 p11 p12 p13
  376.                p14 p15 p16 p17 p18 b1 b2 b3 b4 b5 b6 b7 b8 aa)
  377.   (setq 0.5pi (* pi 0.5))
  378.   (setq 1.5pi (* pi 2))
  379.   (setq 2pi (* pi 2))
  380.   (setq P1 (trans p1 1 0))
  381.   (setq P2 (trans p2 1 0))
  382.   (entmake (list
  383.              '(0 . "LINE")
  384.              (cons 10 p1)
  385.              (cons 11 p2)
  386.              (cons 62 1)
  387.              (cons 6 "CENTER")
  388.              (cons 8 typ)
  389.              (cons 48 0.1)
  390.              )
  391.            )
  392.   (setq ang2 (nth 0 (getang ang1)))
  393.   (setq ang3 (nth 1 (getang ang1)))
  394.   (setq p3 (polar p1 ang2 w1)
  395.         p4 (polar p3 ang1 h1)
  396.         )
  397.   (setq p5 (polar p3 ang2 0.25)
  398.         p6 (polar p5 ang1 h1)
  399.         )
  400.   (setq p7 (polar p1 ang3 w1)
  401.         p8 (polar p7 ang1 h1)
  402.         )
  403.   (setq p9 (polar p7 ang3 0.25)
  404.         p10 (polar p9 ang1 h1)
  405.         )
  406.   (setq p11 (polar (polar p1 ang2 (/ netd 2)) ang1 h1)
  407.         p12 (polar p11 ang1 (- netdh h1 2))
  408.         )
  409.   (setq p13 (polar (polar p1 ang3 (/ netd 2)) ang1 h1)
  410.         p14 (polar p13 ang1 (- netdh h1 2))
  411.         )
  412.   (setq p15 (polar (polar p1 ang2 (/ etd 2)) ang1 netdh)
  413.         p16 (polar p15 ang1 (- (distance p1 p2) netdh))
  414.         )
  415.   (setq p17 (polar p15 ang3  etd)
  416.         p18 (polar p16 ang3  etd)
  417.         )
  418.   (setq aa (- (distance p1 p2) netdh 30));;设置避空长度
  419.   (if (< aa 0)
  420.     (setq aa 10)
  421.     );;设置避空长度
  422.   (setq b1 (polar p11 ang2  0.25)
  423.         b2 (polar b1 ang1  (+ (- netdh h1) aa))
  424.         )
  425.   (setq b3 (polar b2 ang3  (- (+ 0.25 (/ netd 2)) (/ etd 2)))
  426.         b4 (polar b3 ang1  1)
  427.         )
  428.   (setq b5 (polar b1 ang3  (* (+ 0.25 (/ netd 2)) 2))
  429.         b6 (polar b2 ang3  (* (+ 0.25 (/ netd 2)) 2))
  430.         )
  431.   (setq b7 (polar b3 ang3  etd)
  432.         b8 (polar b7 ang1  1)
  433.         )
  434.   (mkl p3 p4 typ)
  435.   (mkl p5 p6 typ)
  436.   (mkl p7 p8 typ)
  437.   (mkl p9 p10 typ)
  438.   (mkl p4 p8 typ)
  439.   (mkl p6 p10 typ)
  440.   (mkl p11 p12 typ)
  441.   (mkl p13 p14 typ)
  442.   (mkl p15 p16 typ)
  443.   (mkl p17 p18 typ)
  444.   (mkl p12 p15 typ);托斜线
  445.   (mkl p14 p17 typ);托斜线
  446.   (mkl p15 p17 typ);托平线
  447.   (mkl p12 p14 typ);托平线
  448.   (mkl b1 b2 typ);左逼空竖线
  449.   (mkl b3 b2 typ);左逼空横线
  450.   (mkl b4 b2 typ);左逼空斜线
  451.   (mkl b5 b6 typ);右逼空竖线
  452.   (mkl b7 b6 typ);右逼空横线
  453.   (mkl b8 b6 typ);右逼空斜线
  454.   )
  455.   


  456. ;;或取另外两个角度ANG2为左边的角度,ANG3为右边的
  457. (defun getang(ang1 / ang2 ang3)
  458.   (cond        ((and (< ang1 0.5pi) (>= ang1 0))
  459.          (setq ang2 (+ ang1 0.5pi))
  460.          (setq ang3 (- ang2 pi))
  461.         )
  462.         ((and (>= ang1 0.5pi) (< ang1 pi))
  463.          (setq ang2 (+ ang1 0.5pi))
  464.          (setq ang3 (- ang1 0.5pi))
  465.         )
  466.         ((and (<= ang1 1.5pi) (>= ang1 pi))
  467.          (setq ang2 (+ ang1 0.5pi))
  468.          (setq ang3 (- ang1 0.5pi))
  469.         )
  470.         ((and (< ang1 2pi) (> ang1 1.5pi))
  471.          (setq ang3 (- ang1 0.5pi))
  472.          (setq ang2 (- ang3 pi))
  473.         )
  474.         )
  475.   (list ang2 ang3)
  476.   )
  477.   




  478. ;自定义函数,取两点与图层,生成一条直线
  479. (defun mkl (pt1 pt2 lay /)
  480.   (entmake (list '(0 . "LINE")
  481.                  (cons 10 pt1)
  482.                  (cons 11 pt2)
  483.                  (cons 8 lay)
  484.            )
  485.   )
  486. )
该贴已经同步到 邹锋的微博

本帖子中包含更多资源

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

x

点评

幻灯片最好放左侧,鼠标移动距离会短一点  发表于 2017-2-24 22:15

评分

参与人数 4明经币 +4 金钱 +50 收起 理由
xyp1964 + 1 赞一个!
仲文玉 + 1 赞一个!
机械工程师 + 1 支持,很赞哦。
edata + 1 + 50 很给力!

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下

本帖被以下淘专辑推荐:

发表于 2014-6-24 20:06 | 显示全部楼层
好东西,感谢分享
发表于 2014-6-25 09:48 | 显示全部楼层
留下脚印,以备学习
发表于 2014-6-25 10:20 | 显示全部楼层
自动化顶针
很牛啊
发表于 2014-6-25 11:47 | 显示全部楼层
下载 收藏了   
发表于 2014-6-25 12:57 | 显示全部楼层
留脚印留脚印
发表于 2014-6-25 18:31 | 显示全部楼层
必须支持!!
发表于 2014-6-26 16:24 | 显示全部楼层
好强大啊   收藏先!
发表于 2014-6-27 14:56 | 显示全部楼层
支持楼主的源码精神
发表于 2014-6-27 14:59 | 显示全部楼层
支持楼主的源码精神
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-3-29 22:06 , Processed in 0.253762 second(s), 35 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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