- »ý·Ö
- 2575
- Ã÷¾±Ò
- ¸ö
- ×¢²áʱ¼ä
- 2015-8-7
- ÔÚÏßʱ¼ä
- Сʱ
- ÍþÍû
-
- ½ðÇ®
- ¸ö
- ¹±Ï×
-
- ¼¤Çé
-
|
±¾Ìû×îºóÓÉ ·åÔÆÓÚÎí ÓÚ 2016-5-29 21:22 ±à¼
Ç󸽼þ¡°×ø±êµã.dwg¡±¸÷µã×ø±ê²¢Áбí±íʾµÄÎÊÌâ¡£
¶ÔÓÚÈ·¶¨µÄ×ø±êÃû³ÆÈç1-1-1£¬¿ÉÉ趨¹æÔòΪ£ºÇÅÁº±àºÅ-ÇŶձàºÅ-×®»ù±àºÅ£¬1-1-1¼´±í´ï¸ÃµãΪ1ºÅÇÅ1ºÅ¶ÕµÚ1¸ù×®µÄ×ø±êµã¡£
Èç¹ûͼÖÐÒѾµãÑ¡ºÃ¸÷µã£¬ÒªÇ󽫸÷×ø±êµãµÄ×ø±êÉú³É±í¸ñ²¢Ð´ÈëcadÖС£ÈçÏÂͼ£º
°´ÒªÇóÉú³É±í¸ñ£º
ͼÖÐËùÓôø±àºÅµÄÎå½ÇÐÇÊÇÒÑÉú³ÉµÄÊôÐԿ飬±àºÅÊÇÊôÐÔÖµÒÑÓÐÌáÈ¡´úÂë¡£
·¹ýµÄ´óÉñÃÇ£¬Èç¹ûÓÐÐËȤ¿ÉÒÔפ×ãÑо¿Ò»Ï£¬ÎÊÌâµÄ¹Ø¼üÊÇÔÚÓÚÈçºÎÀûÓÃÎÄ×Ö½øÐÐÅÅÐò²¢Éú³É±í¸ñ¡£
±¾ÈËÒѾÍê³É²¿·Ö´úÂ룬µ«¶ÔÓÚÅÅÐòÕâ¿éδÄÜÏëµ½ºÏÊʵķ½·¨¡£
1¡¢Éú³ÉÊôÐÔ¿é´úÂ룺
;Éú³ÉÊôÐÔ¿é"×ø±êµã"£¬emkattblk ,Éú³ÉÆÕͨ¿é"×ø±êµã1"
(defun c:emkattblk (/ ang0 ang1 h pt0 pt1 pt10 pt11 pt2 pt3 pt4 pt5 pt6 pt7 pt8 pt9 s1 s2)
(vl-load-com)
;(setq pt0 (getpoint "ÇëÊäÈë²åÈëµã"))
;(setq h (getdist pt0 "×Ö¸ß"))
(setq pt0 '(0 0 0))
(setq h 2.5)
(setq ang0 (/ pi 5))
(setq ang1 (* ang0 2))
(setq s1 (* h 1))
(setq s2 (* h 1 (/ (cos ang1) (cos ang0))))
(setq pt1 (polar pt0 (/ pi 2) s1)
pt2 (polar pt0 (- (/ pi 2) ang0) s2)
pt3 (polar pt0 (- (/ pi 2) (* ang0 2)) s1)
pt4 (polar pt0 (- (/ pi 2) (* ang0 3)) s2)
pt5 (polar pt0 (- (/ pi 2) (* ang0 4)) s1)
pt6 (polar pt0 (- (/ pi 2) (* ang0 5)) s2)
pt7 (polar pt0 (- (/ pi 2) (* ang0 6)) s1)
pt8 (polar pt0 (- (/ pi 2) (* ang0 7)) s2)
pt9 (polar pt0 (- (/ pi 2) (* ang0 8)) s1)
pt10 (polar pt0 (- (/ pi 2) (* ang0 9))s2)
pt11 (polar pt0 (* (/ pi 6) -1) (* h 1.1))
)
;ÎåÐǵ¥¶À×ö¿é
(entmake (list '(0 . "block") (cons 2 "×ø±êµã1") '(70 . 2) (cons 10 pt0)))
(entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2)))
(entmake (list '(0 . "LINE") (cons 10 pt2) (cons 11 pt3)))
(entmake (list '(0 . "LINE") (cons 10 pt3) (cons 11 pt4)))
(entmake (list '(0 . "LINE") (cons 10 pt4) (cons 11 pt5)))
(entmake (list '(0 . "LINE") (cons 10 pt5) (cons 11 pt6)))
(entmake (list '(0 . "LINE") (cons 10 pt6) (cons 11 pt7)))
(entmake (list '(0 . "LINE") (cons 10 pt7) (cons 11 pt8)))
(entmake (list '(0 . "LINE") (cons 10 pt8) (cons 11 pt9)))
(entmake (list '(0 . "LINE") (cons 10 pt9) (cons 11 pt10)))
(entmake (list '(0 . "LINE") (cons 10 pt10) (cons 11 pt1)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt1)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt2)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt3)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt4)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt5)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt6)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt7)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt8)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt9)))
(entmake (list '(0 . "LINE") (cons 10 pt0) (cons 11 pt10)))
(entmake '((0 . "ENDBLK")))
;;¿é½áÊø
(entmake (list '(0 . "block") (cons 2 "×ø±êµã") '(70 . 2) (cons 10 pt0)))
(entmake (list '(0 . "INSERT") (cons 2 "×ø±êµã1") (cons 10 pt0)))
(entmake (list '(0 . "ATTDEF") '(8 . "0") (cons 10 pt11) (cons 40 h) '(1 . "0-0-0") '(3 . "×ø±êµã±àºÅ")
'(2 . "񅧏") '(41 . 0.7) '(70 . 0))
)
(entmake '((0 . "ENDBLK")))
(princ)
)
2¡¢ÌáÈ¡ËùÓÐ×ø±ê²¢ÅÅÐò£º
;¶¨Òå3ÏòÅÅÐò£¬´Ó×óµ½ÓÒÅÅÐò£¬·µ»ØÐòºÅ
(defun pxi_3 ( xyzlist / one oneof three threeof two twoof)
(setq one car ;_X
two cadr ;_Y
three caddr ;_z
oneof < ;_X
twoof < ;_y
threeof < ;_z
)
(vl-sort-i xyzlist ;·µ»Øµã¼¯ÄÚÈݿɲÉÓÃvl-sortº¯Êý
(function (lambda (e1 e2)
(cond
((> (abs (- (one e1) (one e2))) 0) ;_ ½áÊø>
(oneof (one e1) (one e2)) ;_ ½áÊøoneof
)
((> (abs (- (two e1) (two e2))) 0) ;_ ½áÊø>
(twoof (two e1) (two e2)) ;_ ½áÊøtwoof
)
(T
(threeof (three e1) (three e2)) ;_ ½áÊøthreeof
)
) ;_ ½áÊøcond
) ;_ ½áÊølambda
) ;_ ½áÊøfunction
) ;_ ½áÊøvl-sort
)
;¶¨Òå3ÏòÅÅÐò£¬´Ó×óµ½ÓÒÅÅÐò£¬·µ»ØÅÅÐò½á¹û
(defun px_3 ( xyzlist / one oneof three threeof two twoof)
(setq one car ;_X
two cadr ;_Y
three caddr ;_z
oneof < ;_X
twoof < ;_y
threeof < ;_z
)
(vl-sort xyzlist ;·µ»Øµã¼¯ÄÚÈݿɲÉÓÃvl-sortº¯Êý
(function (lambda (e1 e2)
(cond
((> (abs (- (one e1) (one e2))) 0) ;_ ½áÊø>
(oneof (one e1) (one e2)) ;_ ½áÊøoneof
)
((> (abs (- (two e1) (two e2))) 0) ;_ ½áÊø>
(twoof (two e1) (two e2)) ;_ ½áÊøtwoof
)
(T
(threeof (three e1) (three e2)) ;_ ½áÊøthreeof
)
) ;_ ½áÊøcond
) ;_ ½áÊølambda
) ;_ ½áÊøfunction
) ;_ ½áÊøvl-sort
)
;È¥Öظ´ÏÇó±íÖÐ×ÓÏî¡£
(defun by-same-cut (lst1 / lst_new lst2)
(setq lst_new '() lst2 lst1)
(foreach m lst1
(setq lst2 (cdr lst2))
(if (= (member m lst2) nil)
(setq lst_new (append lst_new (list m)))
)
)
)
;¶¨ÒåÇó±íÖеÄ×ÓÏî¼°¸öÊý
(defun list_xyz_num (A / a_1 an b lst n num)
(setq B (by-same-cut A ))
(setq n 0)
(setq lst nil)
(repeat (length B)
(setq an (nth n B))
(setq A_1 (vl-remove an A))
(setq num (- (length A) (length A_1)))
(setq lst (cons (list an num) lst))
(setq n(1+ n))
)
(setq lst (reverse lst))
)
;;Ñ¡È¡ÊôÐÔ¿é,ÌáÈ¡ÊôÐÔ¿éÖÐÎÄ×Ö¼°²åÈëµã.
(vl-load-com)
(defun c:tt (/ elist elist_01 i lst n1 n2 pt pts s1 txt_00 txt_01 txt_02 txt_03 txt_list)
;elist ͼԪ±í
;elist_01 ͼԪ±íµü´ú
;i ÆðʼÐòºÅ
;pt ²åÈëµã×ø±ê
;s1 ÊôÐÔ¿éÑ¡Ôñ¼¯
;txt_00 ÊôÐÔ¿éÎÄ×ÖÄÚÈÝ
;txt_01 AÁÐ
;txt_02 BÁÐ
;txt_03 CÁÐ
;pts ²åÈëµã×ø±ê¼¯ºÏ
;txt_list ÊôÐÔ¿éÎÄ×ÖÄÚÈÝת»¯Îª±í¼¯ºÏ
;txt_A AÁм¯ºÏ
;txt_B BÁм¯ºÏ
;txt_C CÁм¯ºÏ
(SETVAR "CMDECHO" 0)
(setq S1 (ssget '((0 . "INSERT") (66 . 1))));;;¿òÑ¡Ð޸ĵÄÊôÐÔ¿é
(if s1
(progn
(setq i 0)
(setq pts nil
txt_list nil
txt_A nil
txt_B nil
txt_C nil
)
(repeat (sslength S1)
(setq elist (entget (ssname S1 i))
elist_01 elist)
(setq pt (cdr(assoc 10 elist)))
(setq pts (cons pt pts) )
(while (/= (cdr(assoc 0 (setq elist_01 (entget(entnext(cdr(assoc -1 elist_01)))))))
"SEQEND")
(if (= (cdr(assoc 0 elist_01)) "ATTRIB")
(progn
(setq txt_00 (cdr(assoc 1 elist_01)))
(setq n1 (vl-string-search "-" Txt_00))
(setq n2 (vl-string-search "-" Txt_00 (1+ n1)))
(setq txt_01 (atoi (substr txt_00 1 n1) ))
(setq txt_02 (atoi (substr txt_00 (+ n1 2) (- n2 n1 1))))
(setq txt_03 (atoi (substr txt_00 (+ n2 2) )))
)
)
)
(setq txt_list (cons (list txt_01 txt_02 txt_03) txt_list ))
(setq txt_A (cons txt_01 txt_A ))
;(setq txt_B (cons txt_02 txt_B ))
;(setq txt_C (cons txt_03 txt_C ))
(setq i (1+ i))
)
(setq txt_list_i (pxi_3 txt_list))
(setq txt_list (px_3 txt_list))
(setq A_1 (list_xyz_num txt_A))
(princ txt_A)
(princ txt_list_i)
(setq i nil)
)
)
(SETVAR "CMDECHO" 1)
(princ)
)
3¡¢Çó¸÷·ÖÏîµÄ¸öÊý¼°Ë³Ðò²¢Ð´Èë±í¸ñ
¡¤¡¤¡¤ |
±¾Ìû×ÓÖаüº¬¸ü¶à×ÊÔ´
ÄúÐèÒª µÇ¼ ²Å¿ÉÒÔÏÂÔØ»ò²é¿´£¬Ã»ÓÐÕ˺ţ¿×¢²á
x
|