- 积分
- 63889
- 明经币
- 个
- 注册时间
- 2010-5-9
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 自贡黄明儒 于 2011-8-4 11:23 编辑
;;;本程序适用于样版文件(.dwt)作图,当图框放大n倍后,输入D选择某一标注样式并修改[尺寸特征比例](变量"dimscale"),
;;;然后运行下面的程序,将产生四种新的标注样式(经我的实践,这4种标注样式基本满足各种需要了,象1元,2元,5元类似)
;;;对于采用布局出图,一种标注就够了,使用如下的程序没有必要
;;;本程序结合明经多个贴子而成
(defun C:DStyle(/ ACADDOCUMENT ACADOBJECT CURRDIMSTYLE MSPACE)
;;; 首先,返回当前的标注的样式
;;; 接着,设定新的样式。
;;; 最后,将样式恢复为原来的设定值。
(VL-LOAD-COM)
(setq AcadObject(vlax-get-acad-object)
AcadDocument(vla-get-ActiveDocument AcadObject)
mSpace(vla-get-ModelSpace AcadDocument)
)
;;; 返回激活文件当前的标注样式
(setq currDimStyle(vla-get-ActiveDimStyle AcadDocument))
;(princ "当前的标注型式是 ")(princ (vla-get-name currDimStyle))
;;; 建立标注样式2.5B1
(setvar "dimlfac" 0.4);因为图元放大了2.5倍
(setvar "DIMCLRD" 1);改变颜色以区分
(if (not (tblsearch "dimstyle" "2.5B1"))
(command "-dimstyle" "s" "2.5B1")
(command "-dimstyle" "s" "2.5B1" "y")
)
(vla-put-ActiveDimStyle AcadDocument currDimStyle);; 将标注样式设回原来的标注样式
;(princ "标注型式重设为 ")(princ (vla-get-name currDimStyle))
;;; 建立标注样式4B1
(setvar "dimlfac" 0.25)
(setvar "DIMCLRD" 2)
(if (not (tblsearch "dimstyle" "4B1"))
(command "-dimstyle" "s" "4B1")
(command "-dimstyle" "s" "4B1" "y")
)
(vla-put-ActiveDimStyle AcadDocument currDimStyle)
;;; 建立标注样式10B1
(setvar "dimlfac" 0.1)
(setvar "DIMCLRD" 4)
(if (not (tblsearch "dimstyle" "10B1"))
(command "-dimstyle" "s" "10B1")
(command "-dimstyle" "s" "10B1" "y")
)
(vla-put-ActiveDimStyle AcadDocument currDimStyle)
;;; 建立标注样式16B1
(setvar "dimlfac" 0.1)
(setvar "DIMCLRD" 5)
(if (not (tblsearch "dimstyle" "16B1"))
(command "-dimstyle" "s" "16B1")
(command "-dimstyle" "s" "16B1" "y")
)
(vla-put-ActiveDimStyle AcadDocument currDimStyle)
(princ)
)
(princ "\n 四川自贡运机集团 黄明儒 2011年8月4日)
|
评分
-
查看全部评分
|