172841477 发表于 2023-9-12 19:46:11

写了一个模具画T冲的LISP

写了一个模具画T冲的LISP,有没有大佬帮忙完善一下?


目前可以画出B冲,想加一个输入数量的步骤,然后后面输出的文字里,那个数量显示输入的数量。


(defun C:BC1()(princ "")
   (setq l (getreal "\n B冲高度:"))
   (setq d (getreal "\n 直径: "))
   (setq p0 (getpoint "\n 摆放位置:"))
   (setq p0x (car p0))
   (setq p0y (cadr p0))
   (if (< d 7)
   (progn
      (setq dd (+ (/ d 2) 1))
   ))
   (if (>= d 7)
   (progn
      (setq dd (+ (/ d 2) 1.5))
   ))
   (setq p1x (- p0x dd))
   (setq p3y (- p0y 5))
   (setq p2x (+ p0x dd))
   (setq p1 (list p1x p0y))
   (setq p2 (list p2x p0y))
   (setq P3 (list p2x p3y))
   (setq P4 (list p1x p3y))
   (command "line" "none" p1 "none" p2 "none" p3 "none" p4 "none" p1 "")
   (setq p5x (+ p0x (/ d 2)))
   (setq p5y (- p0y5 ))
   (setq p7x (- p0x (/ d 2)))
   (setq p7y (- p0y l))
   (setq p5 (list p5x p5y))
   (setq p6 (list p5x p7y))
   (setq P7 (list p7x p7y))
   (setq P8 (list p7x p5y))
   (command "line" "none" p5 "none" p6 "none" p7 "")
   (command "line" "none" p7 "none" p8 "")
   (command "dim" "ver" "none" p2 "none" p3 "none" "@4,0" """ver" "none" p2 "none" p6 "none" "@10,0" ""
   "hor" "none" p1 "none" p2 "none" "@0,4" "%%c<>" "hor" "none" P6 "none" p7 "none" "@0,-4" "%%c<>" "e")
    (command "text" "none" "@-8,-10" "2.5" "0" "名 称:B冲 " "")
    (command "change" "l" "" "p" "C" "3" "")
    (command "text" "none" "@-0,-5" "2.5" "0" "材 质:SKD11" "")
    (command "change" "l" "" "p" "C" "3" "")
    (command "text" "none" "@-0,-5" "2.5" "0" "数 量:2PCS" "")
    (command "change" "l" "" "p" "C" "3" "")
    (command "text" "none" "@-0,-5" "2.5" "0" "热处理:HRC58-60" "")
    (command "change" "l" "" "p" "C" "3" "")
    (prompt "\n B冲已绘制完毕!")
)

飞雪神光 发表于 2023-9-12 20:45:52

(defun C:BC1()
        (setvar "cmdecho" 0)
        (princ "")
        (setq l (getreal "\n B冲高度:"))
        (setq d (getreal "\n 直径: "))
        (setq sl (getstring "\n 数量: "))
        (setq p0 (getpoint "\n 摆放位置:"))
        (setq p0x (car p0))
        (setq p0y (cadr p0))
        (if (< d 7)
                (setq dd (+ (/ d 2) 1))
        )
        (if (>= d 7)
                (setq dd (+ (/ d 2) 1.5))
        )
        (setq p1x (- p0x dd))
        (setq p3y (- p0y 5))
        (setq p2x (+ p0x dd))
        (setq p1 (list p1x p0y))
        (setq p2 (list p2x p0y))
        (setq P3 (list p2x p3y))
        (setq P4 (list p1x p3y))
        (command "line" "none" p1 "none" p2 "none" p3 "none" p4 "none" p1 "")
        (setq p5x (+ p0x (/ d 2)))
        (setq p5y (- p0y5 ))
        (setq p7x (- p0x (/ d 2)))
        (setq p7y (- p0y l))
        (setq p5 (list p5x p5y))
        (setq p6 (list p5x p7y))
        (setq P7 (list p7x p7y))
        (setq P8 (list p7x p5y))
        (command "line" "none" p5 "none" p6 "none" p7 "")
        (command "line" "none" p7 "none" p8 "")
        (command "dim" "ver" "none" p2 "none" p3 "none" "@4,0" """ver" "none" p2 "none" p6 "none" "@10,0" ""
                "hor" "none" p1 "none" p2 "none" "@0,4" "%%c<>" "hor" "none" P6 "none" p7 "none" "@0,-4" "%%c<>" "e")
        (command "text" "none" "@-8,-10" "2.5" "0" "名 称:B冲 " "")
        (command "change" "l" "" "p" "C" "3" "")
        (command "text" "none" "@-0,-5" "2.5" "0" "材 质:SKD11" "")
        (command "change" "l" "" "p" "C" "3" "")
        (command "text" "none" "@-0,-5" "2.5" "0" (strcat "数 量:"sl"PCS") "")
        (command "change" "l" "" "p" "C" "3" "")
        (command "text" "none" "@-0,-5" "2.5" "0" "热处理:HRC58-60" "")
        (command "change" "l" "" "p" "C" "3" "")
        (prompt "\n B冲已绘制完毕!")
)

浴火鸟TYTYJ 发表于 2023-9-13 08:04:25

五金冲压模具的实用工具:victory:

浴火鸟TYTYJ 发表于 2023-9-13 08:10:37

一键生成 :handshake

172841477 发表于 2023-9-13 08:27:28

飞雪神光 发表于 2023-9-12 20:45


感谢大佬,我去试试

172841477 发表于 2023-9-13 13:52:16

分享给有需要的朋友

172841477 发表于 2023-9-13 13:54:10

172841477 发表于 2023-9-13 13:52
分享给有需要的朋友

命令是PC各种冲针    另外有FB1非标A冲
BC1是B冲   AC1是标准A冲
共4个命令

chq168168 发表于 2023-9-13 14:45:17

172841477 发表于 2023-9-13 13:54
命令是PC各种冲针    另外有FB1非标A冲
BC1是B冲   AC1是标准A冲
共4个命令

能传个gif动图看看效果么

172841477 发表于 2023-9-14 16:05:17

chq168168 发表于 2023-9-13 14:45
能传个gif动图看看效果么

你试试效果不就好了吗?
页: [1]
查看完整版本: 写了一个模具画T冲的LISP