明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1000|回复: 8

[基础] 写了一个模具画T冲的LISP

[复制链接]
发表于 2023-9-12 19:46:11 | 显示全部楼层 |阅读模式
写了一个模具画T冲的LISP,有没有大佬帮忙完善一下?


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


  (defun C:BC1()(princ "[B冲绘制]")
   (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 (- p0y  5 ))
   (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 | 显示全部楼层
  1. (defun C:BC1()
  2.         (setvar "cmdecho" 0)
  3.         (princ "[B冲绘制]")
  4.         (setq l (getreal "\n B冲高度:"))
  5.         (setq d (getreal "\n 直径: "))
  6.         (setq sl (getstring "\n 数量: "))
  7.         (setq p0 (getpoint "\n 摆放位置:"))
  8.         (setq p0x (car p0))
  9.         (setq p0y (cadr p0))
  10.         (if (< d 7)
  11.                 (setq dd (+ (/ d 2) 1))
  12.         )
  13.         (if (>= d 7)
  14.                 (setq dd (+ (/ d 2) 1.5))
  15.         )
  16.         (setq p1x (- p0x dd))
  17.         (setq p3y (- p0y 5))
  18.         (setq p2x (+ p0x dd))
  19.         (setq p1 (list p1x p0y))
  20.         (setq p2 (list p2x p0y))
  21.         (setq P3 (list p2x p3y))
  22.         (setq P4 (list p1x p3y))
  23.         (command "line" "none" p1 "none" p2 "none" p3 "none" p4 "none" p1 "")
  24.         (setq p5x (+ p0x (/ d 2)))
  25.         (setq p5y (- p0y  5 ))
  26.         (setq p7x (- p0x (/ d 2)))
  27.         (setq p7y (- p0y l))
  28.         (setq p5 (list p5x p5y))
  29.         (setq p6 (list p5x p7y))
  30.         (setq P7 (list p7x p7y))
  31.         (setq P8 (list p7x p5y))
  32.         (command "line" "none" p5 "none" p6 "none" p7 "")
  33.         (command "line" "none" p7 "none" p8 "")
  34.         (command "dim" "ver" "none" p2 "none" p3 "none" "@4,0" ""  "ver" "none" p2 "none" p6 "none" "@10,0" ""
  35.                 "hor" "none" p1 "none" p2 "none" "@0,4" "%%c<>" "hor" "none" P6 "none" p7 "none" "@0,-4" "%%c<>" "e")
  36.         (command "text" "none" "@-8,-10" "2.5" "0" "名 称:B冲 " "")
  37.         (command "change" "l" "" "p" "C" "3" "")
  38.         (command "text" "none" "@-0,-5" "2.5" "0" "材 质:SKD11" "")
  39.         (command "change" "l" "" "p" "C" "3" "")
  40.         (command "text" "none" "@-0,-5" "2.5" "0" (strcat "数 量:"sl"PCS") "")
  41.         (command "change" "l" "" "p" "C" "3" "")
  42.         (command "text" "none" "@-0,-5" "2.5" "0" "热处理:HRC58-60" "")
  43.         (command "change" "l" "" "p" "C" "3" "")
  44.         (prompt "\n B冲已绘制完毕!")
  45. )

评分

参与人数 1明经币 +1 收起 理由
bssurvey + 1 赞一个!

查看全部评分

回复 支持 2 反对 0

使用道具 举报

发表于 2023-9-13 08:04:25 | 显示全部楼层
五金冲压模具的实用工具
 楼主| 发表于 2023-9-13 08:27:28 | 显示全部楼层

感谢大佬,我去试试
 楼主| 发表于 2023-9-13 13:52:16 | 显示全部楼层
分享给有需要的朋友

本帖子中包含更多资源

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

x
 楼主| 发表于 2023-9-13 13:54:10 | 显示全部楼层
172841477 发表于 2023-9-13 13:52
分享给有需要的朋友

命令是PC  各种冲针    另外有FB1非标A冲
BC1是B冲     AC1是标准A冲
共4个命令
发表于 2023-9-13 14:45:17 | 显示全部楼层
172841477 发表于 2023-9-13 13:54
命令是PC  各种冲针    另外有FB1非标A冲
BC1是B冲     AC1是标准A冲
共4个命令

能传个gif动图看看效果么
 楼主| 发表于 2023-9-14 16:05:17 | 显示全部楼层
chq168168 发表于 2023-9-13 14:45
能传个gif动图看看效果么

你试试效果不就好了吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-17 04:51 , Processed in 0.188730 second(s), 28 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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