钣金展开
此代码是本人无聊写的钣金展开插件,代码很简单,发出来给大家玩玩。:lol(defun C:tt (/ banhou en end end_data
fangzhidian1 fangzhidian2 gaodu
i jingxiangdian1 jingxiangdian2
jingxiangdian3 juli1 juli2 kouchu
maxxdacha0 maxydacha0 min_maxdacha
minxdacha0 minydacha0 pmax
pmax1 pmax2 pmin ss1 ss10
ss2 ss3 ss4 ss5 ss7
ss8 ss9 tc tp01 tp010
tp011 tp012 tp013 tp014 tp015
tp016 tp017 tp018 tp019 tp02
tp020 tp021 tp022 tp023 tp024
tp025 tp026 tp03 tp04 tp05
tp06 tp07 tp08 tp09 zwx1
zwx2
)
(vl-load-com)
(defun Min_Maxdacha ()
(vla-getboundingbox
(vlax-ename->vla-object end)
'minpdacha
'maxpdacha
)
(setq
minpdacha (vlax-safearray->list minpdacha)
maxpdacha (vlax-safearray->list maxpdacha)
)
(setq
minxdacha (car minpdacha)
maxxdacha (car maxpdacha)
minydacha (cadr minpdacha)
maxydacha (cadr maxpdacha)
)
(if (> minxdacha0 minxdacha)
(setq minxdacha0 minxdacha)
)
(if (> minydacha0 minydacha)
(setq minydacha0 minydacha)
)
(if (< maxxdacha0 maxxdacha)
(setq maxxdacha0 maxxdacha)
)
(if (< maxydacha0 maxydacha)
(setq maxydacha0 maxydacha)
)
)
(setq tc (tblsearch "layer" "zwx"))
(if (= tc nil)
(command "-layer" "m" "zwx" "c" "6" "" "")
)
(setvar "clayer" (itoa 0))
(command "undo" "be")
(setvar "cmdecho" 0)
(command "ucs" "w")
(setvar "OSMODE" 0)
(setq banhou (getreal "\n输入板厚:"))
(setq gaodu (getreal "\n输入折弯高度:"))
(setq kouchu (getreal "\n输入折弯扣除:"))
(prompt "所选图块外框必须是散的")
(setq en (ssget))
(setq minxdacha0 1e6
minydacha0 1e6
maxxdacha0 -1e6
maxydacha0 -1e6
)
(setq i 0)
(repeat (sslength en)
(setq end (ssname en i))
(setq end_data (entget end))
(Min_Maxdacha)
(setq i (1+ i))
)
(setq
pmin(list minxdacha0 minydacha0)
pmax(list maxxdacha0 maxydacha0)
pmax1 (list minxdacha0 maxydacha0)
pmax2 (list maxxdacha0 minydacha0)
tp01(polar pmin (* pi 0.5) (/ (distance pmin pmax1) 2.))
tp02(polar tp01 0 0.5)
tp03(polar tp02 pi 0.5)
tp04(polar pmin 0 (/ (distance pmin pmax2) 2.))
tp05(polar tp04 (* pi 0.5) 0.5)
tp06(polar tp05 (* pi 1.5) 0.5)
tp07(polar pmax1 0 (/ (distance pmax1 pmax) 2.))
tp08(polar tp07 (* pi 0.5) 0.5)
tp09(polar tp08 (* pi 1.5) 0.5)
tp010 (polar pmax2 (* pi 0.5) (/ (distance pmax2 pmax) 2.))
tp011 (polar tp010 0 0.5)
tp012 (polar tp010 pi 0.5)
tp013 (polar pmin (* pi 1.5) (- gaodu kouchu))
tp014 (polar pmin (* pi 0.5) (+ banhou 0.3))
tp015 (polar tp014 0 (+ banhou 0.5))
tp016 (polar tp015 (* pi 1.5) (/ banhou 2.))
tp017 (polar tp016 pi (+ banhou 0.5))
tp018 (polar tp014 pi (- gaodu kouchu))
juli1 (distance pmin pmax1)
juli2 (distance pmin pmax2)
tp019 (polar tp018 (* pi 0.5) (- juli1 (* (+ banhou 0.3) 2.)))
tp020 (polar tp013 0 juli2)
tp021 (polar tp01 0 (/ kouchu 2.))
tp022 (polar tp021 (* pi 0.5) (- (/ juli1 2.) (+ banhou 0.3)))
tp023 (polar tp021 (* pi 1.5) (- (/ juli1 2.) (+ banhou 0.3)))
tp024 (polar tp04 (* pi 0.5) (/ kouchu 2.))
tp025 (polar tp024 0 (- (/ juli2 2.) (+ banhou 0.5)))
tp026 (polar tp024 pi (- (/ juli2 2.) (+ banhou 0.5)))
)
(setq ss1 (ssget "f" (list tp011 tp012)))
(setq ss2 (ssget "f" (list tp08 tp09)))
(setq ss3 (ssget "f" (list tp05 tp06)))
(setq ss4 (ssget "f" (list tp02 tp03)))
(command "ERASE" ss1 ss2 ss3 ss4 "")
(command "pline" "non" tp022 "non" tp023 "")
(setq zwx1 (entlast))
(command "pline" "non" tp025 "non" tp026 "")
(setq zwx2 (entlast))
(command "change" zwx1 zwx2 "" "p" "la"
"zwx" "lt" "PHANTOM2" "c" "6" "s"
"25" ""
)
(command "pline""non" tp013 "non" tp017 "non"
tp016 "non" tp015 "non" tp018 ""
)
(setq ss5 (entlast))
(command "MIRROR"
ss5
""
"non"
tp01
"non"
(setq jingxiangdian1 (polar tp01 0 100))
""
)
(setq ss7 (entlast))
(command "pline" "non" tp019 "non" tp018 "")
(setq ss8 (entlast))
(command "pline" "non" tp013 "non" tp020 "")
(setq ss9 (entlast))
(command "MIRROR"
ss5
""
"non"
tp01
"non"
(setq jingxiangdian1 (polar tp01 0 100))
""
)
(setq ss10 (entlast))
(command "MIRROR"
ss9
zwx2
""
"non"
tp01
"non"
(setq jingxiangdian2 (polar tp01 0 100))
""
)
(command "MIRROR"
ss10
ss5
ss8
zwx1
""
"non"
tp04
"non"
(setq jingxiangdian3 (polar tp04 (* pi 0.5) 100))
""
)
(command
"DIMLINEAR"
"non"
tp019
(setq tp019 (polar tp019 0 (- (+ juli2 gaodu gaodu) (* kouchu 2.))))
"non"
(setq fangzhidian1 (polar tp019 (* pi 0.5) (+ gaodu 20)))
)
(command "DIMLINEAR"
"non"
tp013
(setq tp013 (polar tp013
(* pi 0.5)
(- (+ juli1 gaodu gaodu) (* kouchu 2.))
)
)
"non"
(setq fangzhidian2 (polar tp013 pi (+ gaodu 20)))
)
(setvar "osmode" 15359)
(princ)
)
本帖最后由 cchessbd 于 2024-5-11 21:30 编辑
lailaifa 发表于 2024-4-24 19:20
加这折弯线和折弯标注
试用了下,感觉还不错,槽开得有点深。我改了下。吧fas版本发上来吧,就不发源码了。
我还有个展开两道弯的修改版。源码基本也来自论坛,最近还在完善。感觉那个简单一点。
你这个改起来太难了。。。
cchessbd 发表于 2024-5-11 21:28
试用了下,感觉还不错,槽开得有点深。我改了下。吧fas版本发上来吧,就不发源码了。
我还有个展开两道 ...
我是菜鸡,写的啰嗦 感谢大师分享 谢谢楼主分享 修改了一个参数 谢谢,学习一下 本帖最后由 advksf 于 2024-4-19 13:48 编辑
{:1_1:}谢谢分享,要是能弹出有选折弯扣除更好,工艺孔,包边选择。加油 兄弟,拼角的好焊接些,包角产品不好焊也不好看
MENGZE 发表于 2024-4-19 14:02
兄弟,拼角的好焊接些,包角产品不好焊也不好看
每个厂要求不一样,我们这里要求包角