尺寸标注,嘿嘿~
新手瞎闹,适用于总图尺寸.望高手们改进~(defun c:xx1 (/ pt1 pt2 pt3 pt4 pt5 ang dis old old1)(setq old1 (getvar "blipmode"))
(setvar "blipmode" 0)
(setq lay (getvar "clayer"))
(command "color" "bylayer")
(command "layer" "m" "DM-尺寸标注" "c" "3" "DM-尺寸标注" "")
(setq pt1 (getpoint "\n选择第一点:")
pt2 (getpoint pt1 "\n选择另一点:")
old (getvar "osmode")
pt3(mapcar'(lambda(X Y)(/(+ X Y)2.0)) pt1 pt2);求中点
ang (angle pt1 pt2)
dis (distance pt1 pt2)
pt4 (polar pt1 (+ pi ang) 1.0)
pt5 (polar pt2 ang 1.0)
)
(setvar "osmode" 0)
(drawcross pt1 ang);以P为基点,ang为角度绘制标记块
(drawcross pt2 ang)
(entmake (list (cons 0 "LINE") (cons 10 pt4) (cons 11 pt5)))
(command "-text" "J" "BC" pt3 "2.5" (angtos ang) (rtos dis 2 2) "");谁能告诉我如何用entmake生成中下对齐的文字
(setvar "osmode" old)
(setvar "blipmode" old1)
(command "layer" "s" lay "")
) (defun drawcross (p ng / px1 px2 py1 py2)
(setq eflag (tblsearch "block" "十字标记")) ;块存在标记
(if (not eflag) ;不存在十字标记的块,则按如下创建
(progn
(setq px1 (polar p (angtof "225") '1.5) ;左坐标
px2 (polar p (angtof "45") '1.5) ;右坐标
py1 (polar p (angtof "90") '1.5) ;上坐标
py2 (polar p (angtof "270") '1.5) ;下坐标
)
(entmake (list
(cons 0 "BLOCK")
(cons 2 "十字标记")
(cons 70 0)
(cons 10 p)
)
)
(entmake (list
(cons 0 "LINE")
(cons 10 px1)
(cons 11 px2)
)
)
(entmake (list
(cons 0 "LINE")
(cons 10 py1)
(cons 11 py2)
)
)
(entmake '((0 . "endblk")))
) ;progn
) ;if
(command "_insert" "十字标记" p 1 1 (angtos ng))
)
页:
[1]