當(dāng)我們在使用CAD軟件繪制圖紙時,圖紙中的軸網(wǎng)、圖紙說明、詳圖等很多內(nèi)容都會使用到序號標(biāo)注的功能。那在浩辰CAD軟件中如何才可以實(shí)現(xiàn)序號標(biāo)注呢?今天就為大家簡單介紹下。
CAD中序號標(biāo)注過程:
在windows下,VB和浩辰CAD都支持強(qiáng)有力的DDE(動態(tài)數(shù)據(jù)交換)功能,可以用VB編寫客戶程序通過Windows DDE 連接向浩辰CAD傳送指令和交換各種復(fù)雜的數(shù)據(jù)結(jié)構(gòu),實(shí)現(xiàn)對浩辰CAD的控制。盡管浩辰CADLISP運(yùn)行速度慢,但是它為中高級的用戶定制浩辰CAD提供了很多便利。浩辰CAD軟件包提供了許多浩辰CADLISP實(shí)現(xiàn)程序。
圖2 序號標(biāo)注流程圖
3 程序的設(shè)計和實(shí)現(xiàn)
在本文中,簡要介紹了利用LISP語言編寫的序號標(biāo)注程序,以起拋磚引玉的作用。本程序是在浩辰CAD-R12上開發(fā)并運(yùn)行通過的。程序主要包括標(biāo)注零部件序號、標(biāo)注支吊架序號、標(biāo)注分界符、標(biāo)注文字等功能,如圖1所示。同時可以設(shè)置文字高度和數(shù)字自動賦值。有了“序號標(biāo)注”功能,你就可以很方便地連續(xù)地進(jìn)行標(biāo)注。
其流程圖為:
在標(biāo)注時首先拾取起始點(diǎn),程序中設(shè)計了功能選項(xiàng)并顯示:
T標(biāo)注類型/H文字高度/N數(shù)字賦值/?幫助/〈起始點(diǎn)〉:
可以通過功能選項(xiàng)改變標(biāo)注類型、文字高度,以及確定文字高度、序號數(shù)字是否連續(xù)賦值。其實(shí)現(xiàn)程序?yàn)?span>
(defun 1b—m1 (/ input)
(setq temp T)
(while temp
(initget″ Type Height
Number ?″)
(setq strtpt (getpoint ″ \nT 標(biāo)注類型/H文字高度/N數(shù)字賦值/?幫助/〈起始點(diǎn)〉:″))
(cond
((= strtpt ″Type″)
(initget ″Part Brace
Delimit Text″)
(setq input (getkword (strcat ″\nP
零部件序號/B支吊架序號/D分界符/T標(biāo)注文字〈″1b—typ″>:″)))
(if input
(progn
(if(/=1b—typ input)(setq
num 1))
(setq 1b—typ input)
)
)
)
((= strtpt ″Height″)
(setq input )getdist (strcat ″\n 輸入新的文字高度<″(rtos txt—h)″>:″)))
(if input (setq txt—h
input))
)
((= strtpt ″Number″)
(initger ″ON OFf″)
(setq input (getkword (strcat ″\n序號數(shù)字自動連續(xù)賦值?OFf/ON <″1b—num″>:″)))
(if input (setq 1b—num
input))
)
((= strtpt ″?″)
(1b—hlp)
)
((null strtpt)
(princ ″\n正常退出LABEL.″)
(setq temp nil)
(setq cont nil)
)
(T
(setq temp nil)
)
) ;end of cond
);end of while
)
選擇標(biāo)注類型也是通過功能選項(xiàng)進(jìn)行的,其顯示選項(xiàng)為:
P零部件序號/B支吊架序號/D分界符/T文字標(biāo)注:
如果起始點(diǎn)空輸入,則退出標(biāo)注功能。在完成起始點(diǎn)選擇后,緊接著要求拾取文字標(biāo)注的位置,顯示功能選項(xiàng):
H文字高度/N數(shù)字賦值/U退回/?幫助/〈終止點(diǎn)〉:
在該過程中仍可以設(shè)置文字高度和數(shù)字自動賦值開關(guān)。實(shí)現(xiàn)程序?yàn)?span>
(defun 1b—m2 (/ input)
(setq temp T)
(while temp)
(menucmd ″S=labe12″)
(initget ″Height Number
Undo ?″)
(setq nextpt (getpoint strtpt ″\nH 文字高度/N數(shù)字連續(xù)/U退回/?幫助/〈終止點(diǎn)〉:″))
(cond
((= nextpt ″Height″)
(seta input (getdist (strcat“\n輸入新的文字高度<“(rtos.txt—h″:)>″)))
(if input (setq txt—h
input)))
((=strtpt “Number″)
(initget ″ON OFf″)
(setq input (getkword (strcat ″\n序號數(shù)字自動連續(xù)賦值?OFf/ON <″ 1b_num″>:″)))
(if input (setq lb_num input))
)
((= nextpt ″Undo″)
(command ″—.U″)
(setq temp nil)
)
((= strtpt ″?″)
(lb—hlp)
)
(T
(if (null nextpt)
(setq temp T)
(progn
(cond
((= lb—typ ″Part″) (lb—part))
((= lb—typ ″Brace″) (lb—brace))
((= lb—typ ″Delimit″) (lb—deli))
((= lb—typ ″Text″) (lb—text))
)
(setq temp nil)
)
)
)
) ?。?span>end fo cond
)end of while
)
在選擇好終止點(diǎn)之后,要求輸入相應(yīng)的標(biāo)注內(nèi)容。例如,零部件序號和分界符標(biāo)注過程分別表達(dá)為
(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 (* txt—h-1.6)))
(setq endpt (polar nextpt o (* txt—h 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 (=lb—num ″OFf″)
(\progn
(setq temp (getint (strcat ″\n 請輸入零部件序號〈″rtos num)″>:″)))
(if temp (setq num temp))
)
)
(command ″text″ ″J″ ″M″ midpt txt—h 0 num ″change″ ″L″
″″ ″P″ ″C″ 6 ″″)
(setq num (1+num))
(defun lb—del(/ txt ang radius centpt)
(setq radius txt—h)
(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 txt—h o txt 0 txt ″change″ ″L″ ″″ ″P″ ″C″ 6″″)
)
程序通過循環(huán)語句實(shí)現(xiàn)多次標(biāo)注,當(dāng)起始點(diǎn)空輸入時退出標(biāo)注。
在運(yùn)行程序功能之前,必須將其調(diào)入浩辰CAD中。只要在Command狀態(tài)下,鍵入(Load″C:/SUBDIR/lABEL″)即可。
|
以上就是在浩辰CAD軟件中,當(dāng)我們需要使用序號標(biāo)注的功能來標(biāo)注圖紙上的相關(guān)內(nèi)容時,具體的操作步驟如上所述。今天就介紹這么多了。安裝浩辰CAD軟件試試吧。更多CAD教程技巧,可關(guān)注浩辰CAD官網(wǎng)進(jìn)行查看。