lisp 画双线带倒圆角_VisualLisp增加公差、消除重合直线圆弧
1 (vl-load-com)2
3 ;;;標注文字增加公差4 ;;;命令:GV5 ;;;極限公差文字高度可設置成主尺寸文字高度的任意比例,缺省值為0.7
6 ;;;當上公差與下公差相等時為對稱公差7 (defun c:gv(/ sztoleranceheightscale rtoleranceheightscale sztoleranceupperlimit %sk1 sztolerancelowerlimit %sk2 nprecision ss i vobj ename elist)8 (Berni_Start)9
10 (cond11 ((setq szToleranceHeightScale (vl-registry-read "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceHeightScale")))12 (T13 (setq szToleranceHeightScale "0.7")14 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceHeightScale" "0.7")15 )16 )17 (setq rToleranceHeightScale (atof szToleranceHeightScale))18 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceHeightScale" (vl-princ-to-stringrToleranceHeightScale))19 (cond20 ((setq szToleranceUpperLimit (vl-registry-read "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceUpperLimit")))21 (T22 (setq szToleranceUpperLimit "0.1")23 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceUpperLimit" "0.1")24 )25 )26
27 (initget "S")28 (setq %sk1 (getreal (strcat "\n輸入上公差或 [字高比例(S)] :"))); "S"nil 實數29 (cond30 ((= %sk1 "S")31 (while
32 (progn33 (cond34 ((setq rToleranceHeightScale (getreal (strcat "\n指定公差值的文字高度相對于標注文字高度的比例因子 :"))))35 (T36 (setq rToleranceHeightScale (atof szToleranceHeightScale))37 )38 )39 (setq rToleranceHeightScale (abs rToleranceHeightScale))40 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceHeightScale" (vl-princ-to-stringrToleranceHeightScale))41 (cond42 ((> rToleranceHeightScale 0))43 (T;輸入了044 (vlax-invoke (vla-GetInterfaceObject (vlax-get-acad-object) "WScript.Shell") "popup" "必須為正" 2 "錯誤" 48);警告內容 延遲秒數 對話框標題 確定按鈕+黃色感嘆號45 (setq rToleranceHeightScale nil)46 )47 )48 (not rToleranceHeightScale)49 )50 )51 ;實數 nil52 (cond53 ((setq %sk1 (getreal (strcat "\n輸入上公差 :"))));實數54 (T;nil55 (setq %sk1 (atof szToleranceUpperLimit));使用缺省值56 )57 )58 );"S"
59 ((= (type %sk1) 'REAL));實數
60 (T;nil61 (setq %sk1 (atof szToleranceUpperLimit))62 )63 )64 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceUpperLimit" (vl-princ-to-string %sk1))65
66 (cond67 ((setq szToleranceLowerLimit (vl-registry-read "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceLowerLimit")))68 (T69 (setq szToleranceLowerLimit "0.1")70 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceLowerLimit" "0.1")71 )72 )73
74 (cond75 ((setq %sk2 (getreal (strcat "\n輸入下公差 :"))))76 (T77 (setq %sk2 (atof szToleranceLowerLimit))78 )79 )80 (vl-registry-write "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw" "ToleranceLowerLimit" (vl-princ-to-string %sk2))81 (setq nPrecision (max (BF-numOfSignificantDigitsAfterDecimalPoint %sk1) (BF-numOfSignificantDigitsAfterDecimalPoint %sk2)));獲取小數位數82
83 (princ "\n選擇尺寸:")84 (while (setq ss (ssget ":S" '((0 . "DIMENSION"))))
85 (repeat (setq i (sslength ss))86 (setq vObj (vla-ssname ss (setq i (1-i))))87 (vla-put-ToleranceDisplay vObj 2);顯示公差:極限偏差88 (vla-put-ToleranceUpperLimit vObj %sk1)89 (vla-put-ToleranceLowerLimit vObj %sk2)90 (Vlax-Put-Property vObj 'TolerancePrecision nPrecision )
91 (setq ename (vlax-vla-object->ename vObj))92 (setq eList (entget ename))93 (cond94 ((and (member '(100 . "AcDb2LineAngularDimension") eList) (< (Vlax-Get vObj'TextPrecision) nPrecision));角度標注95 (Vlax-Put-Property vObj 'TextPrecision nPrecision)
96 )97 )98 (Vlax-Put-Property vObj 'ToleranceHeightScale rToleranceHeightScale )
99 (cond100 ((= %sk1 %sk2);對稱公差101 (Vlax-Put-Property vObj 'ToleranceHeightScale 1.0)
102 )103 )104 (Vlax-Put-Property vObj 'ToleranceSuppressTrailingZeros -1 )
105 )106 (cond107 ((= %sk1 %sk2)108 (princ "\n增加對稱公差已完成!")109 )110 (T111 (princ "\n增加極限公差已完成!")112 )113 )114 );while
115
116 (Berni_End)117 (princ)118 );defun119
120 ;;;name:BF-numOfSignificantDigitsAfterDecimalPoint121 ;;;desc:小數點后有效(非零)數字的位數122 ;;;arg:rNum:要檢查小數點后有效(非零)數字位數的數字123 ;;;return:rNum為數字時返回有效小數位數,否則返回nil124 ;;;example:(BF-numOfSignificantDigitsAfterDecimalPoint 0.123) 返回 3
125 (defun BF-numOfSignificantDigitsAfterDecimalPoint(rNum /str pos nRetVal)126 (cond127 ((numberp rNum)128 (setq str (rtos rNum 2 16))129 (cond130 ((setq pos (vl-string-search "."str))131 (setq str (substr str (+ pos 2)));小數點以后的字符串(不含小數點)132 (setq str (vl-string-right-trim "0"str));去掉右邊的數字0133 (setq nRetVal (strlen str))134 )135 (T (setq nRetVal 0))136 )137 )138 (T (setq nRetVal nil))139 )140 nRetVal141 )142
143 ;;;返回選擇集ss中第index(從0開始)個圖元的對象名144 (defun vla-ssname(ss index)145 (vlax-ename->vla-object(ssname ss index))146 )147
148 ;|
149 消除重合線150 命令:SX151 移除幾何上是多余的對象。例如:152 1.對象重復的副本將被刪除。153 2.圓弧對象正好覆蓋了圓的一部分,這個圓弧不能顯現。此圓弧將被刪除。154 3.兩條直線其角度相同且部分重疊。這兩條直線將合并為一條直線。155 |;156 ;;; *****消除重線 程序開始*****
157 (defun c:sx(/n ss i ss1 ename elist etype);刪線158 (setq ss (ssget "i"))159 (Berni_Start)160
161 (princ "\n★功能:刪除重復的直線、圓、圓弧.")162 (cond163 (ss164 (setq n (sslength ss) i 0ss1 ss ss (ssadd))165 (repeat n166 (setq ename (ssname ss1 i))167 (setq eList (entget ename))168 (setq eType (cdr (assoc 0eList)))169 (cond170 ((or (= eType "LINE") (= eType "ARC") (= eType "CIRCLE"))171 (setq ss (ssadd ename ss))172 )173 )174 (setq i (1+i))175 )176 (cond177 ((= (sslength ss) 0)178 (while
179 (progn180 (setq ss (ssget '((0 . "LINE,ARC,CIRCLE"))))
181 (not ss)182 )183 )184 )185 (T T)186 )187 )188 (T189 (while
190 (progn191 (setq ss (ssget '((0 . "LINE,ARC,CIRCLE"))))
192 (not ss)193 )194 )195 )196 )197
198 (princ "\n--->程序進行中,請稍候...")199 (hbzhx ss);合并200
201 (princ "\n消除重線完成!")202
203 (Berni_End)204 (princ)205 )206
207 ;合并重線208 (defun hbzhx(ss /precision i line_list arc_list ent obj e1 e2)209 (grtext -2 "正在整理數據")210
211 (setq precision 1e-8)212 (setq i 0
213 line_list nil214 arc_list nil215 )216
217 (repeat (sslength ss)218 (setq ent (ssname ss i)219 i (1+i)220 )221 (setq obj (vlax-ename->vla-objectent))222
223 (if (> (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj)) precision);曲線長度大于精度precision224 (if (= "LINE" (cdr (assoc 0(entget ent))))225 (setq line_list (cons (line_data ent) line_list))226 (setq arc_list (cons (arc_data ent) arc_list))227 )228 )229 )230
231 (setq line_list232 (vl-sort233 line_list234 '(lambda (e1 e2)
235 (if(equal (car e1) (car e2) precision)236 (if(equal (cadr e1) (cadr e2) precision)237 (if(equal (car (caddr e1)) (car (caddr e2)) precision);起點x坐標相等238 (
249 ; 半徑 圓心x坐標 圓心y坐標 起點角 終點角 圖元名250 (setq arc_list (vl-sort arc_list251 '(lambda (e1 e2)
252 (if(equal (car e1) (car e2) precision);半徑相等253 (if(equal (cadr e1) (cadr e2) precision);圓心x坐標相等254 (if(equal (caddr e1) (caddr e2) precision);圓心y坐標相等255 (
266 (ifline_list267 (hb_line line_list precision);合并直線268 )269 (ifarc_list270 (progn271 (hb_arc arc_list precision);合并圓弧272 )273 )274
275 (grtext);使所有文本區域恢復為標準值276 )277
278
279 ;合并圓弧280 (defun hb_arc(arc_list precision /zongshu xuhao ssunnecessary 2pi arc_a biaoji bj pc sangl eangl ent arc_b sangl1 eangl1 ent1 tmplst arc_list_item ename obj)281 (setq zongshu (length arc_list)282 xuhao 0
283 ssUnnecessary (ssadd)284 2pi (* 2pi)285 )286 (princ (strcat "\n共處理了" (itoa zongshu) "個圓或圓弧圖元"))287 (grtext -1 "合并圓弧")288
289 (while (> (length arc_list) 0)290 (cs_pross zongshu (setq xuhao (1+xuhao)))291 (setq arc_a (car arc_list);a弧數據表292 arc_list (cdr arc_list)293 biaoji T294 bj (car arc_a)295 pc (list (cadr arc_a) (caddr arc_a));圓心296 sangl (cadddr arc_a)297 eangl (nth 4arc_a)298 ent (last arc_a)299 )300 (while(and biaoji301 (> (length arc_list) 0)302 )303 (setq arc_b (car arc_list))304
305 (cond306 ((and (equal bj (car arc_b) precision);同圓心同半徑307 (equal pc (list (cadr arc_b) (caddr arc_b)) precision)308 )309
310 (setq sangl1 (cadddr arc_b);b弧起點角311 eangl1 (nth 4arc_b);b弧終點角312 ent1 (last arc_b)313 )314
315 (cond316 ((= (get_dxf ent 0) "CIRCLE");a為圓317 (setq tmpLst nil)318 (foreacharc_list_item arc_list319 (cond320 ((and (equal bj (car arc_list_item) precision) (equal (car pc) (cadr arc_list_item) precision) (equal (cadr pc) (caddr arc_list_item) precision));同圓心等半徑321 (setq ssUnnecessary (ssadd (last arc_list_item) ssUnnecessary))322 (cs_pross zongshu (setq xuhao (1+xuhao)))323 )324 (T (setq tmpLst (append tmpLst (list arc_list_item))))325 )326 )327 (setq arc_list tmpLst)328 (setq biaoji nil);結束內圈循環329 )330 ((= (get_dxf ent1 0) "CIRCLE");a為弧,且b為圓331 (setq ssUnnecessary (ssadd ent ssUnnecessary))332 (cs_pross zongshu (setq xuhao (1+xuhao)))333 (setq arc_list (cdr arc_list))334
335 (setq tmpLst nil)336 (foreacharc_list_item arc_list337 (cond338 ((and (equal bj (car arc_list_item) precision) (equal (car pc) (cadr arc_list_item) precision) (equal (cadr pc) (caddr arc_list_item) precision));同圓心等半徑339 (setq ssUnnecessary (ssadd (last arc_list_item) ssUnnecessary))340 (cs_pross zongshu (setq xuhao (1+xuhao)))341 )342 (T (setq tmpLst (append tmpLst (list arc_list_item))))343 )344 )345 (setq arc_list tmpLst)346 (setq biaoji nil);結束內圈循環347 )348 ((and (= sangl eangl1) (=eangl sangl1));均為弧,且互補349 (setq ename (entmakex (list '(0 . "CIRCLE") (list 10 (car pc) (cadr pc) 0) (cons 40 bj))))
350 (setq obj (Vlax-Ename->Vla-Object ename))351 (Vlax-Put-Property obj 'Layer (cdr (assoc 8 (entget ent))) )
352 (Vlax-Put-Property obj 'Linetype (Vlax-Get (Vlax-Ename->Vla-Object ent)'Linetype))353 (Vlax-Put-Property obj 'LinetypeScale (Vlax-Get (Vlax-Ename->Vla-Object ent)'LinetypeScale))354 (Vlax-Put-Property obj 'Lineweight (Vlax-Get (Vlax-Ename->Vla-Object ent)'Lineweight));線寬355 (Vlax-Put-Property obj 'Color (Vlax-Get (Vlax-Ename->Vla-Object ent)'Color))356 (entdel ent)357
358 (setq tmpLst nil)359 (foreacharc_list_item arc_list360 (cond361 ((and (equal bj (car arc_list_item) precision) (equal (car pc) (cadr arc_list_item) precision) (equal (cadr pc) (caddr arc_list_item) precision));同圓心等半徑362 (setq ssUnnecessary (ssadd (last arc_list_item) ssUnnecessary))363 (cs_pross zongshu (setq xuhao (1+xuhao)))364 )365 (T366 (setq tmpLst (append tmpLst (list arc_list_item)))367 )368 )369 )370 (setq arc_list tmpLst)371 (setq biaoji nil);結束內圈循環372 )373 ((and (BF-onArcP sangl1 sangl eangl) (BF-onArcP eangl1 sangl eangl) (>= (+ (/ (vlax-curve-getDistAtPoint (Vlax-Ename->Vla-Object ent) (polar (list (car pc) (cadr pc) 0) sangl1 bj)) bj) (Vlax-Get (Vlax-Ename->Vla-Object ent1) 'TotalAngle )) 2pi))
374 (setq ename (entmakex (list '(0 . "CIRCLE") (list 10 (car pc) (cadr pc) 0) (cons 40 bj))))
375 (setq obj (Vlax-Ename->Vla-Object ename))376 (Vlax-Put-Property obj 'Layer (cdr (assoc 8 (entget ent))) )
377 (Vlax-Put-Property obj 'Linetype (Vlax-Get (Vlax-Ename->Vla-Object ent)'Linetype))378 (Vlax-Put-Property obj 'LinetypeScale (Vlax-Get (Vlax-Ename->Vla-Object ent)'LinetypeScale))379 (Vlax-Put-Property obj 'Lineweight (Vlax-Get (Vlax-Ename->Vla-Object ent)'Lineweight));線寬380 (Vlax-Put-Property obj 'Color (Vlax-Get (Vlax-Ename->Vla-Object ent)'Color))381 (entdel ent)382
383 (setq tmpLst nil)384 (foreacharc_list_item arc_list385 (cond386 ((and (equal bj (car arc_list_item) precision) (equal (car pc) (cadr arc_list_item) precision) (equal (cadr pc) (caddr arc_list_item) precision));同圓心等半徑387 (setq ssUnnecessary (ssadd (last arc_list_item) ssUnnecessary))388 (cs_pross zongshu (setq xuhao (1+xuhao)))389 )390 (T (setq tmpLst (append tmpLst (list arc_list_item))))391 )392 )393 (setq arc_list tmpLst)394 (setq biaoji nil);結束內圈循環395 )396 ((and (BF-onArcP sangl1 sangl eangl) (BF-onArcP eangl1 sangl eangl));弧a包含弧b397 (setq ssUnnecessary (ssadd ent1 ssUnnecessary))398 (cs_pross zongshu (setq xuhao (1+xuhao)))399 (setq arc_list (cdr arc_list))400 )401 ((and (BF-onArcP sangl sangl1 eangl1) (BF-onArcP eangl sangl1 eangl1));弧b包含弧a402 (Vlax-Put-Property (Vlax-Ename->Vla-Object ent) 'StartAngle sangl1)
403 (Vlax-Put-Property (Vlax-Ename->Vla-Object ent) 'EndAngle eangl1)
404 (setq sangl sangl1)405 (setq eangl eangl1)406 (setq ssUnnecessary (ssadd ent1 ssUnnecessary))407 (cs_pross zongshu (setq xuhao (1+xuhao)))408 (setq arc_list (cdr arc_list))409 )410 ;;;部分重疊411 ((or (BF-onArcP sangl1 sangl eangl) (BF-onArcP eangl1 sangl eangl));弧b、弧a部分重疊412 (setq ssUnnecessary (ssadd ent1 ssUnnecessary))413 (cs_pross zongshu (setq xuhao (1+xuhao)))414 (setq arc_list (cdr arc_list))415 (cond416 ((BF-onArcP sangl1 sangl eangl)417 (Vlax-Put-Property (Vlax-Ename->Vla-Object ent) 'EndAngle eangl1)
418 (setq eangl eangl1)419 )420 (T421 (Vlax-Put-Property (Vlax-Ename->Vla-Object ent) 'StartAngle sangl1)
422 (setq sangl sangl1)423 )424 )425 )426 (T (setq biaoji nil));弧a、弧b不重疊427 );cond428 );cond-1同圓心同半徑429 (T (setq biaoji nil));cond-2
430 );cond431 );while
432 );while
433
434 (if (> (sslength ssUnnecessary) 0)435 (progn436 (princ (strcat ",刪除了" (itoa (sslength ssUnnecessary)) "個重復圓或圓弧."))437 (command "erase" ssUnnecessary "")438 )439 )440 );hb_arc441
442
443 (defun line_data(ent /obj p1 p2 precision k b e1 e2)444 (setq precision 1e-8)445 (setq obj (vlax-ename->vla-objectent)446 p1 (vlax-curve-getstartpoint obj)447 p2 (vlax-curve-getendpoint obj)448 )449 (if(equal (car p1) (car p2) precision);斜率不存在450 (setq k nil451 b (car p1)452 );直線x=b453 (setq k (/ (-(cadr p2) (cadr p1))454 (-(car p2) (car p1))455 )456 b (- (cadr p1) (*(car p1) k))457 )458 )459
460 (setq p2 (vl-sort (list p1 p2)461 '(lambda(e1 e2)
462 (if(equal (car e1) (car e2) precision);x坐標相等463 (
472 (list k;斜率473 b;截距474 (list (car p1) (cadr p1));左下點二維坐標表475 (list (car p2) (cadr p2));右上點二維坐標表476 ent;圖元名477 )478 )479
480
481 (defun arc_data(ent /data bj pc sangl eangl 2pi)482 (setq 2pi (* 2pi))483 (setq data (entget ent))484 (setq bj (cdr (assoc 40data)))485 (setq pc (cdr (assoc 10data)))486 (setq sangl (cdr (assoc 50data)))487 (setq eangl (cdr (assoc 51data)))488 (ifsangl;圓弧489 nil490 (setq sangl 0.0
491 eangl 2pi492 );圓493 )494 ; 半徑 圓心x坐標 圓心y坐標 起點角 終點角 圖元名495 (list bj (car pc) (cadr pc) sangl eangl ent)496 )497
498
499 ;合并直線500 (defun hb_line(line_list precision /zongshu i xuhao line_a biaoji k b p1 p2 ent lay line_b p3 p4 p5 e1 e2 data)501 (setq zongshu (length line_list);總數502 i 0;計數變量503 xuhao 0;序號504 )505 (princ (strcat "\n共處理了" (itoa zongshu) "個直線圖元"))506 (grtext -1 "合并直線");將文本寫入到模式狀態行區域507
508 (while (> (length line_list) 0)509 (setq xuhao (1+xuhao))510 (cs_pross zongshu xuhao)511 (setq line_a (car line_list);第一條直線a的數據表512 line_list (cdr line_list)513 biaoji T;標記514 k (car line_a)515 b (cadr line_a)516 p1 (caddr line_a)517 p2 (cadddr line_a)518 ent (last line_a)519 lay (cdr (assoc 8(entget ent)));圖層520 )521 (while(and biaoji522 (> (length line_list) 0)523 )524 (setq line_b (car line_list));第一條直線b的數據表525 (cond526 ((and (equal k (car line_b) precision);共線527 (equal b (cadr line_b) precision)528 )529 (setq p3 (caddr line_b);左下點530 p4 (cadddr line_b);右上點531 p5 (vl-sort (list p1 p2 p3 p4)532 '(lambda (e1 e2)
533 (if(equal (car e1) (car e2) precision);x坐標相等534 (
561 (setq data (entget ent)562 data (subst (cons 10 p1) (assoc 10data) data)563 data (subst (cons 11 p2) (assoc 11data) data)564 )565 (entmod data)566 )567
568 (if (> i 0)569 (progn570 (princ (strcat ",刪除了" (itoa i) "條重復直線."))571 )572 )573
574 (princ)575 )576
577
578 (defun cs_pross(total i /cs_Text myI);total總數,i序號579 (setq cs_Text ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");42個字符580 (setq myI (fix (/ (*(strlen cs_Text) i) total));商的整數部分581 cs_Text (substr cs_Text 1myI)582 )583 (grtext -2cs_Text)584 )585 ;;; *****消除重線 程序結束*****
586
587
588 ;;;name:BF-onArcP589 ;;;desc:確定角ang是否在ang1與ang2之間590 ;;;arg:ang1:圓弧起點角,ang2:圓弧終點角591 ;;;return:角ang在ang1與ang2之間返回T,否則返回nil592 ;;;example:(BF-onArcP (/ pi 2) 0 pi) 返回 T\n(BF-onArcP (/ pi 4) (/ pi 2) pi) 返回 nil593 (defun BF-onArcP(ang ang1 ang2)594 (cond595 ((>ang2 ang1)596 (>=ang2 ang ang1)597 )598 (T;ang2<=ang1599 (or (<= ang ang2) (>=ang ang1))600 )601 )602 )603
604 ;;;=====================================
605 ;;;獲取實體dxf組碼內容606 ;;;(get_dxf ename code)607 (defun get_dxf (ename code /elist retVal)608 (setq elist (entget ename))609 (setq retVal (cdr (assoc code elist)))610 (cond611 (retVal)612 (T613 (princ "\n函數get_dxf的返回值為nil")614 (exit)615 )616 )617 retVal618 )619
620 ;;;初始化,讀取系統變量621 (defun Berni_Start()622 (setq Berni_S_Lst (List (getvar "osmode");0
623 (getvar "cmdecho");1
624 (getvar "clayer");2
625 (getvar "textstyle");3
626 (getvar "cecolor");4
627 (getvar "dimstyle");5
628 (getvar "plinewid");6
629 (getvar "attdia");7
630 (getvar "PICKSTYLE");8
631 (getvar "PEDITACCEPT");9
632 (getvar "dynmode");10
633 (getvar "nomutt");11
634 );end list635 );end setq636 (setvar "cmdecho" 0);1
637 (command "undo" "be")638 (setq old_error *error*)639 (setq *error* *error*_zrw)640 (setvar "osmode" 0);0
641 (setvar "attdia" 0);7INSERT 命令給出命令行提示而非使用對話框用于屬性值的輸入642 (setvar "PICKSTYLE" 0);8 控制編組選擇和關聯填充選擇的使用。0不使用編組選擇和關聯填充選擇643 (setvar "PEDITACCEPT" 1);9禁止在 PEDIT 中顯示“選定的對象不是多段線”提示,選定對象將自動轉換為多段線。644 (setvar "dynmode" 0);10
645 (princ)646 )647
648 ;;;結束時,恢復系統變量649 (defun Berni_End()650 (setvar "osmode" (nth 0Berni_s_Lst))651 (setvar "clayer" (nth 2Berni_s_Lst))652 (setvar "textstyle" (nth 3Berni_s_Lst))653 (setvar "cecolor" (nth 4Berni_s_Lst))654 (setvar "plinewid" (nth 6Berni_s_Lst))655 (setvar "attdia" (nth 7 Berni_s_Lst));控制 INSERT 命令是否使用對話框用于屬性值的輸入。0 給出命令行提示;1使用對話框656 (setvar "PICKSTYLE" (nth 8 Berni_s_Lst));控制編組選擇和關聯填充選擇的使用。0 不使用編組選擇和關聯填充選擇;1 使用編組選擇;2 使用關聯填充選擇;3使用編組選擇和關聯填充選擇657 (setvar "PEDITACCEPT" (nth 9Berni_s_Lst));禁止在 PEDIT 中顯示“選定的對象不是多段線”提示。 該提示后會顯示“是否將其轉換為多段線?”輸入 y 將選定對象轉換為多線段。 當該提示被禁止顯示時,選定對象將自動轉換658 為多段線。0 顯示提示;1抑制提示659 (setvar "dynmode" (nth 10Berni_s_Lst))660 (setvar "nomutt" (nth 11 Berni_s_Lst));禁止顯示通常情況下不禁止顯示的消息(即不進行消息反饋)。 顯示的消息為普通模式,但在腳本、AutoLISP 例程等運行期間將禁止消息顯示。0 恢復普通模式的消息反饋;1禁止不661 確定的消息反饋662 (setq *error*old_error)663 (command "undo" "e")664 (setvar "cmdecho" (nth 1Berni_s_Lst))665 (princ)666 )667
668 ;自定義錯誤處理函數669 (defun *error*_zrw(msg)670 (princ "\n出錯:")671 (princ msg)672 (princ ", 程序退出!")673 (Berni_End)674 )675
676 (princ "\n增加公差程序加載完成,命令GV")677 (princ "\n消除重合線程序加載完成,命令SX")678
679 (vl-registry-delete "HKEY_CURRENT_USER\\Software\\Autodesk\\AutoCAD\\Yx_Zrw")680 (princ)
總結
以上是生活随笔為你收集整理的lisp 画双线带倒圆角_VisualLisp增加公差、消除重合直线圆弧的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 腾讯地图SDK距离测量小工具
- 下一篇: 【小松教你手游开发】【unity实用技能