- (defun C:hf (/ osold)
- (setq osold (getvar "osmode"))
- (setvar "CMDECHO" 0)
- (setlayer_lsp "HF" 8);检查焊缝图层是否存在,没有则新建图层
- (setq pt1 (getpoint "\n输入焊缝的起点 :")
- pt2 (getpoint "\n输入焊缝的终点:")
- h (getint "\n输入焊缝高度的高度:")
- l (distance pt1 pt2)
- n (fix (/ l h))
- ang (angle pt1 pt2)
- pt3 pt1)
- (setvar "osmode" 0)
- (command ".pline" pt1 "a")
- (repeat (- n 2)
- (command "ce" (setq pt4 (polar pt3 ang h)) "a" "-120")
- (command "d" pt3 pt4)
- (setq pt3 pt4)
- )
- (command "ce" (setq pt4 (polar pt3 ang h)) "a" "-180" "")
- (setvar "osmode" osold )
- (princ)
- )
- (defun setlayer_lsp(LAY CLR)
- (if (=(tblobjname "LAYER" LAY) nil)
- (entmake (list'(0 . "LAYER")'(100 . "AcDbSymbolTableRecord")'(100 . "AcDbLayerTableRecord")
- '(6 . "CONTINUOUS")(cons 62 CLR)'(70 . 0)(cons 2 LAY)))
- (entmod(subst(cons 62 CLR)(assoc 62(entget(tblobjname "LAYER" LAY)))(entget(tblobjname "LAYER" LAY))))
- ) (setvar "CLAYER" LAY)
- )
|