CAD中數(shù)據(jù)統(tǒng)計(jì)方法_第1頁(yè)
CAD中數(shù)據(jù)統(tǒng)計(jì)方法_第2頁(yè)
CAD中數(shù)據(jù)統(tǒng)計(jì)方法_第3頁(yè)
免費(fèi)預(yù)覽已結(jié)束,剩余6頁(yè)可下載查看

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、C A D 中 統(tǒng) 計(jì) 數(shù) 字 的 方 法 :(1) 使用CAD中的快捷鍵TT,但是需要先進(jìn)行加載,加載方法是:打開(kāi)CAD選擇菜單欄-工具-加載應(yīng)用程序-選擇窗口中全部文件 -加載(即可)。然后就可以用這個(gè)快捷鍵了。在CAD中選擇需要計(jì)算的數(shù)據(jù),然后 TT 快捷鍵,點(diǎn)下空格后就會(huì)出現(xiàn)一個(gè)對(duì)話框了。( 2) 在繪圖過(guò)程中,經(jīng)常會(huì)對(duì)數(shù)字文本進(jìn)行四則運(yùn)算,或者統(tǒng)計(jì)數(shù)字,在現(xiàn)有的CAD命令中沒(méi)有直接命令與之相關(guān),用計(jì)算器又麻煩。所以可以 用一個(gè)小程序來(lái)解決。我覺(jué)得挺好的??旖萱I TJ。用法:1 、 先加載程序,首先會(huì)提示你如何用這個(gè)程序。2、然后你輸入計(jì)算結(jié)果的精度,即小數(shù)點(diǎn)位數(shù):這個(gè)只要在開(kāi)始的時(shí)候

2、輸 入就可以了,以后的命令你不用輸入精度,如果你要調(diào)整精度,隨時(shí)輸入命令 JD.3、下面為它的具體用法,你可以選擇多個(gè)文字,如果是除法,勸你最好不 要選擇 0 數(shù)字,否則會(huì)出錯(cuò)。而且命令可以連用,直到你空輸入(沒(méi)有選擇或 者取點(diǎn))為止。+ - * / 命令不用多說(shuō)。. 命令為對(duì)所選文字同時(shí)加減乘除某個(gè)數(shù)。4、統(tǒng)計(jì)的命令為T(mén)J。其速度是很快的,我曾對(duì)十萬(wàn)級(jí)的數(shù)字驗(yàn)證,求結(jié)果 既快又準(zhǔn)。5、這個(gè)程序適用于各個(gè)版本,我甚至覺(jué)得可以用于DOS勺CAD版本。原程序:; 說(shuō)明(alert 提醒 :n 請(qǐng)首先設(shè)置好輸精度 , 在繪圖的過(guò)程中可隨時(shí)用命令 JD設(shè)置精度。n命令 + - * / 分別代表對(duì)所選擇

3、的數(shù)字求和差積商。n其中 - /則是以你第一個(gè)選到的數(shù)字文本為被減數(shù)和被除數(shù)。n命令 .(點(diǎn)點(diǎn) ) 代表對(duì)所選擇的數(shù)字文本統(tǒng)一加減乘除某個(gè)數(shù),默認(rèn)為 1。n命令 TJ 代表對(duì)所選擇的數(shù)字文本進(jìn)行數(shù)學(xué)統(tǒng)計(jì)。n所有生成的新文本均與第一個(gè)選到的數(shù)字文本的樣式相同( 除角度外) 。 ); 定義了一個(gè)全局變量為精度(defun C:JD (/ )(prompt n 請(qǐng)輸入精度 , 直接回車(chē)則為系統(tǒng)精度 :)(initget 4)(if (setq PRECISION (getint)(princ)(setq PRECISION (getvar LUPREC)(C:JD); 加(defun C:+ (/

4、key sel ins first numlst result)(while (common1)(setq result (apply + (cadr numlst)(common2)(princ); 減(defun C:- (/ key sel ins first numlst result) (while (common1)(setq result (apply - (cadr numlst)(common2)(princ); 乘(defun C:* (/ key sel ins first numlst result) (while (common1)(setq result (appl

5、y * (cadr numlst)(common2)(princ); 除(defun C:/ (/ key sel ins first numlst result)(while (common1)(setq result (apply / (cadr numlst)(common2)(princ); 所有數(shù)字都加減乘除某個(gè)數(shù)(defun C:. (/ key op sel ins first numlst result)(while (setq sel (ssget (0 . TEXT)(setq first (ssname sel 0)(setq Numlst (sel-list sel)(

6、initget 1 + - * /)(setq key (getkword n 請(qǐng)輸入加減乘除符號(hào) :) (initget 2)(if (null (setq op (getreal n 請(qǐng)輸入操作數(shù) :) (setq op 1.0)(all-cal numlst key op)(princ)J J J(defun all-cal (result sym op / lst old new)(foreach n (car numlst)(setq lst (entget n)(setq old (atof (cdr (assoc 1 lst)(setq new (eval (cons (read

7、 sym) (list old op)(setq new (cons 1 (rtos new (getvar LUNITS) PRECISION)(setq lst (subst new (assoc 1 lst) lst)(entmod lst); 選擇和插入點(diǎn)(defun common1 ()(and(setq sel (ssget (0 . TEXT)(null (initget 0 Yes No)(if (setq key (getkword n是否保留原數(shù)字 Yes,No:)(setq key Yes)(setq key No)(setq first (ssname sel 0)(s

8、etq Numlst (sel-list sel); 做文字或者更新文字(defun common2 ()(setqresult (rtos result (getvar LUNITS) PRECISION)(if (= key No)(if (setq ins (getpoint n 請(qǐng)輸入插入點(diǎn) :)(make-text first result ins)(update-text first result); 選擇集合轉(zhuǎn)化成數(shù)字列表(defun sel-list (sel / i ent lst num Els nls)(setq i 0)(repeat (sslength sel)(se

9、tq ent (ssname sel i)(setq lst (entget ent)(setq num (atof (cdr (assoc 1 lst)(setq Els (cons ent Els)(setq Nls (cons num Nls)(setq i (1+ i)(list(reverse Els)(reverse Nls); 創(chuàng)建新文字 , 在指定點(diǎn)插入(defun make-text (first string inspt / remove txtlst lst)(setq remove (list -1 330 5 1 10 11 50)(setq txtlst (entg

10、et first)(foreach n txtlst(if (not (member (car n) remove)(setq lst (cons n lst)(setq lst (cons (cons 1 string) lst)(setq lst (cons (cons 10 inspt) lst)(setq lst (cons (cons 11 inspt) lst)(setq lst (reverse lst)(cdr (assoc 40 (entmake lst); 保留文字 , 僅更新內(nèi)容(defun update-text (ent string / txtlst)(setq t

11、xtlst (entget ent)(setq txtlst (subst (cons 1 string) (assoc 1 txtlst) txtlst) (entmod txtlst); 統(tǒng)計(jì)數(shù)字文本(defun C:tj (/ un sel ins tollst numlst first data len ang HIG j n m) (setq un (getvar LUNITS)(while (and (setq sel (ssget (0 . TEXT)(setq ins (getpoint n 請(qǐng)輸入插入點(diǎn) :) (princ n 統(tǒng)計(jì)正在進(jìn)行 )(setq tollst (se

12、l-list sel)(setq numlst (cadr tollst)(setq first (caar tollst)(setq data (STAT numlst)(setq len (strcat (caar data) (itoa (cdar data)(setq HIG (* (make-text first len ins) 1.5)(setq ang (* Pi -0.5)(setq j 1)(repeat 4(setq n (nth j data)(setq m (strcat (car n) (rtos (cdr n) un PRECISION)(make-text first m (polar ins ang (* j HIG)(setq j (1+ j)(princ n 統(tǒng)計(jì)已經(jīng)完成 !)(princ); 統(tǒng)計(jì)函數(shù)樣本數(shù)目 和 均值(defun STAT (numlst / len sum ave var sqr std)(setq len (length numlst);(setq sum (apply + numlst) ;(setq ave (/ sum len);(setq var (m

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論