當我們在使用CAD軟件繪制圖紙時,圖紙中的軸網、圖紙說明、詳圖等很多內容都會使用到序號標注的功能。那在浩辰CAD軟件中如何才可以實現序號標注呢?今天就為大家簡單介紹下。
CAD中序號標注過程:
在windows下,VB和浩辰CAD都支持強有力的DDE(動態數據交換)功能,可以用VB編寫客戶程序通過Windows DDE 連接向浩辰CAD傳送指令和交換各種復雜的數據結構,實現對浩辰CAD的控制。盡管浩辰CADLISP運行速度慢,但是它為中高級的用戶定制浩辰CAD提供了很多便利。浩辰CAD軟件包提供了許多浩辰CADLISP實現程序。
圖2 序號標注流程圖
3 程序的設計和實現
在本文中,簡要介紹了利用LISP語言編寫的序號標注程序,以起拋磚引玉的作用。本程序是在浩辰CAD-R12上開發并運行通過的。程序主要包括標注零部件序號、標注支吊架序號、標注分界符、標注文字等功能,如圖1所示。同時可以設置文字高度和數字自動賦值。有了“序號標注”功能,你就可以很方便地連續地進行標注。
其流程圖為:
在標注時首先拾取起始點,程序中設計了功能選項并顯示:
T標注類型/H文字高度/N數字賦值/?幫助/〈起始點〉:
可以通過功能選項改變標注類型、文字高度,以及確定文字高度、序號數字是否連續賦值。其實現程序為
(defun 1b—m1 (/ input)
(setq temp T)
(while temp
(initget″ Type Height
Number ?″)
(setq strtpt (getpoint ″ \nT 標注類型/H文字高度/N數字賦值/?幫助/〈起始點〉:″))
(cond
((= strtpt ″Type″)
(initget ″Part Brace
Delimit Text″)
(setq input (getkword (strcat ″\nP
零部件序號/B支吊架序號/D分界符/T標注文字〈″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序號數字自動連續賦值?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
)
選擇標注類型也是通過功能選項進行的,其顯示選項為:
P零部件序號/B支吊架序號/D分界符/T文字標注:
如果起始點空輸入,則退出標注功能。在完成起始點選擇后,緊接著要求拾取文字標注的位置,顯示功能選項:
H文字高度/N數字賦值/U退回/?幫助/〈終止點〉:
在該過程中仍可以設置文字高度和數字自動賦值開關。實現程序為
(defun 1b—m2 (/ input)
(setq temp T)
(while temp)
(menucmd ″S=labe12″)
(initget ″Height Number
Undo ?″)
(setq nextpt (getpoint strtpt ″\nH 文字高度/N數字連續/U退回/?幫助/〈終止點〉:″))
(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序號數字自動連續賦值?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)
)
)
)
) ;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 (* 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″″)
)
程序通過循環語句實現多次標注,當起始點空輸入時退出標注。
在運行程序功能之前,必須將其調入浩辰CAD中。只要在Command狀態下,鍵入(Load″C:/SUBDIR/lABEL″)即可。
|
以上就是在浩辰CAD軟件中,當我們需要使用序號標注的功能來標注圖紙上的相關內容時,具體的操作步驟如上所述。今天就介紹這么多了。安裝浩辰CAD軟件試試吧。更多CAD教程技巧,可關注浩辰CAD官網進行查看。