CAD > CAD行业教程> CAD图文教程> 文章详情

CAD中如何标注序号

2019-07-25 13179 CAD标注  

当我们在使用CAD软件绘制图纸时,图纸中的轴网、图纸说明、详图等很多内容都会使用到序号标注的功能。那在浩辰CAD软件中如何才可以实现序号标注呢?今天就为大家简单介绍下。

CAD中序号标注过程:

windows下,VB和浩辰CAD都支持强有力的DDE(动态数据交换)功能,可以用VB编写客户程序通过Windows DDE 连接向浩辰CAD传送指令和交换各种复杂的数据结构,实现对浩辰CAD的控制。尽管浩辰CADLISP运行速度慢,但是它为中高级的用户定制浩辰CAD提供了很多便利。浩辰CAD软件包提供了许多浩辰CADLISP实现程序。

1 标注类型

2 序号标注流程图

3 程序的设计和实现
在本文中,简要介绍了利用LISP语言编写的序号标注程序,以起抛砖引玉的作用。本程序是在浩辰CAD-R12上开发并运行通过的。程序主要包括标注零部件序号、标注支吊架序号、标注分界符、标注文字等功能,如图1所示。同时可以设置文字高度和数字自动赋值。有了“序号标注”功能,你就可以很方便地连续地进行标注。
其流程图为:
在标注时首先拾取起始点,程序中设计了功能选项并显示:
T标注类型/H文字高度/N数字赋值/?帮助/〈起始点〉:
可以通过功能选项改变标注类型、文字高度,以及确定文字高度、序号数字是否连续赋值。其实现程序为
(defun 1b
m1 (/ input)
(setq temp T)
(while temp
(initgetType Height Number ?)
(setq strtpt (getpoint ″ \nT 标注类型/H文字高度/N数字赋值/?帮助/〈起始点〉:″))
(cond
((= strtpt Type)
(initget Part Brace Delimit Text)
(setq input (getkword (strcat ″\nP
零部件序号/B支吊架序号/D分界符/T标注文字〈″1btyp>:)))
(if input
(progn
(if(/=1btyp input)(setq num 1))
(setq 1btyp input)
)


((= strtpt Height)
(setq input )getdist (strcat ″\n 输入新的文字高度<″(rtos txth)″>:)))
(if input (setq txth input))
)
((= strtpt Number)
(initger ON OFf)
(setq input (getkword (strcat ″\n序号数字自动连续赋值?OFf/ON <″1bnum″>:)))
(if input (setq 1bnum input))

((= strtpt ?)
(1bhlp)

((null strtpt)
(princ ″\n正常退出LABEL.)
(setq temp nil)
(setq cont nil)
)
T
setq temp nil

;end of cond
;end of while

选择标注类型也是通过功能选项进行的,其显示选项为:
P零部件序号/B支吊架序号/D分界符/T文字标注:
如果起始点空输入,则退出标注功能。在完成起始点选择后,紧接着要求拾取文字标注的位置,显示功能选项:
H文字高度/N数字赋值/U退回/?帮助/〈终止点〉:
在该过程中仍可以设置文字高度和数字自动赋值开关。实现程序为
(defun 1b
m2 ( input)
(setq temp T)
(while temp)
(menucmdS=labe12)
(initget Height Number Undo ?)
(setq nextpt (getpoint strtpt ″\nH 文字高度/N数字连续/U退回/?帮助/〈终止点〉:″))
(cond
((= nextpt Height)
(seta input (getdist (strcat“\n输入新的文字高度<“(rtos.txth″:)>″)))
(if input (setq txth input)))
((=strtpt Number)
(initget ON OFf)
(setq input (getkword (strcat ″\n序号数字自动连续赋值?OFf/ON <1b_num>:)))
(if input (setq lb_num input))
)
((= nextpt Undo)
(command ″—.U)
(setq temp nil)

((= strtpt ?)
lbhlp

T
if (null nextpt
(setq temp T)
(progn
(cond
((= lbtyp Part) (lbpart))
((= lbtyp Brace) (lbbrace))
((= lbtyp Delimit) (lbdeli))
((= lbtyp Text) (lbtext))

setq temp nil



)    ;end fo cond
end of while

在选择好终止点之后,要求输入相应的标注内容。例如,零部件序号和分界符标注过程分别表达为
(defun lb
part( ang endpt midpt)
(setq ang (angle strtpt nextpt))
(if (and (> ang (/ pi 2))(<ang (* pi 1.5)))
(setq endpt (polar nextpt o (* txth-1.6)))
(setq endpt (polar nextpt o (* txth 1.6)))

(command donut 0 0.3 strtpt ″″ ″line)
strtpt nextpt endpt
″″)
(setq midpt (mapcar' + nextpt endpt)
midpt (mapcar'
midpt'(2 2 2))midpt (mapcar'midpt'(0 4 0)))
(if (=lbnum OFf)
(progn
(setq temp (getint (strcat ″\n 请输入零部件序号〈″rtos num)″>:″)))
(if temp (setq num temp))


command text″ ″J″ ″M midpt txth 0 num change″ ″L″ ″″ ″P″ ″C 6 ″″)
(setq num (1+num))
(defun lb
del(/ txt ang radius centpt)
(setq radius txth)
(setq ang (angle strtpt nextpt))
(setq centpt (polar nextpt ang radius))
(command donut 0 0.3 strtpt ″″ ″line strtpt nextpt″″)
command circle centpt radius
(setq txt (getstring ″\n 请输入分界符序号:″))
(command text″ ″J″ ″M centpt txth o txt 0 txt change″ ″L″ ″″ ″P″ ″C 6″″)

程序通过循环语句实现多次标注,当起始点空输入时退出标注。
在运行程序功能之前,必须将其调入浩辰CAD中。只要在Command状态下,键入(LoadC:/SUBDIR/lABEL)即可。

以上就是在浩辰CAD软件中,当我们需要使用序号标注的功能来标注图纸上的相关内容时,具体的操作步骤如上所述。今天就介绍这么多了。安装浩辰CAD软件试试吧。更多CAD教程技巧,可关注浩辰CAD官网进行查看。

相关文章推荐
Copyright © 1992-2021 苏州浩辰软件股份有限公司 版权所有 苏ICP备12077906号-1 增值电信业务经营许可证: 苏B2-20210241 苏公网安备 32059002004222号