本帖最后由 jerisonfang 于 2023-7-21 19:17 编辑
使用方法简述:
cad命令输入zj,空格确认,提示输入折减系数(即铝板折弯90度时候的折减数值,比如3mm铝板单边折减是2.5),输入确认以后提示输入角度,输入确认以后提示点击插入点,点击完即出现折减换算图形
- (defun c:zj ()
- (setvar "cmdecho" 0)
- (setvar "blipmode" 0)
- (setvar "OSMODE" 18103)
- (vl-load-com)
- (progn
- (command "_DIMSTYLE" "r" "AVA-01")
- (setq str (getreal "请输入折减系数:"))
- (if (= str nil) (setq str 2.5))
- (setq ang (getreal "\n请输入角度:"))
- (setq ppp (getpoint "\n请输入插入点:"))
- (setq xs str)
- (setq pp1 (mapcar '+ ppp '(50 0 0)))
- (setq pp2 (mapcar '+ ppp '(50 10 0)))
- (setq pp3 (mapcar '+ ppp '(0.0 -10 0.0)))
- (setq pp4 (mapcar '+ ppp '(10 0 0)))
- (command "PLINE" pp1 ppp "")
- (setq ss (entlast))
- (command "copy" ss "" "0,0,0" "0,0,0")
- (setq ss1 (ssget "P"))
- (command "rotate" ss1 "" ppp ang)
- (setq ss2 (entlast))
- (setq ss3 (ssname ss1 0))
- (setq obj1 (vlax-ename->vla-object ss3))
- (setq pt1 (vla-get-Coordinates obj1))
- (setq p01 (vlax-variant-value pt1))
- (setq p01 (vlax-safearray->list p01))
- (setq p11 (list (car p01) (cadr p01) 0.0))
- (command "peditaccept" 1)
- (command "_pedit" "m" ss2 ss3 "" "j" "0.0" "")
- (command "offset" xs (entlast) pp2 "")
- (setq a1 (entlast))
- (setq obj (vlax-ename->vla-object a1))
- (setq pt (vla-get-Coordinates obj))
- (setq p0 (vlax-variant-value pt))
- (setq p0 (vlax-safearray->list p0))
- (setq p1 (list (caddr p0) (cadddr p0) 0.0))
- (setq p2 (list (car p1) (- (cadr p1) xs) 0.0))
- (command "DIMLINEAR" ppp p1 pp3 "")
- (command "DIMLINEAR" p1 p2 pp1 "")
- (command "_DIMANGULAR" "" ppp pp1 p11 pp2)
- )
- (setvar "OSMODE" 1719)
- )
|