- 积分
- 2455
- 明经币
- 个
- 注册时间
- 2003-8-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|

楼主 |
发表于 2004-4-5 09:36:00
|
显示全部楼层
好的,其实我要指的是上面那部分的。
(defun c:dcc () (setvar "cmdecho" 0) (setvar "osmode" 0) (setq os (getvar "osmode")) (command "_.undo" "be") ;(setq ltsc (getvar "ltscale")) ;(setvar "ltscale" 1)(command "regen") (setq p11 (getpoint "\n请选择起点:")) (if (= p11 nil) (exit)) (setq p12 (getcorner p11 "\n请选择另一角点:")) (setq ss (ssget "c" p11 p12 '((0 . "LWPOLYLINE")))) (setq num (sslength ss) NN 0) (while (< NN num) (setq nam (ssname ss NN) ent (entget nam)) (pline_po) (setq ss1 (ssget "f" (list p-1 p-2) '((0 . "LINE")))) (SETQ nam1 (ssname ss1 0) ent1 (entget nam1)) (setq ss2 (ssget "f" (list p-3 p-4) '((0 . "LINE")))) (SETQ nam2 (ssname ss2 0) ent2 (entget nam2)) (setq l-1 (cdr (assoc 10 ent1)) l-2 (cdr (assoc 11 ent1)) l-3 (cdr (assoc 10 ent2)) l-4 (cdr (assoc 11 ent2))) (setq int1 (inters p-1 p-2 l-1 l-2) int2 (inters p-3 p-4 l-3 l-4)) (setq pot1 (polar p-1 (+ (angle p-1 p-2) (* pi 1.5)) 350) pot2 (polar int1 (+ (angle p-1 p-2) (* pi 1.5)) 350) pot3 (polar p-2 (+ (angle p-1 p-2) (* pi 1.5)) 350) pot4 (polar p-3 (+ (angle p-3 p-4) (* pi 1.5)) 350) pot5 (polar int2 (+ (angle p-3 p-4) (* pi 1.5)) 350) pot6 (polar p-4 (+ (angle p-3 p-4) (* pi 1.5)) 350))
(setq id1 (polar (polar (polar pot1 (angle pot1 pot2) (*(distance pot1 pot2) 0.5)) (+ (angle pot1 pot2) (* pi 1.5)) 172.3568) (+ (angle pot1 pot2) pi) 200)) (setq id2 (polar (polar (polar pot3 (angle pot3 pot2) (*(distance pot2 pot3) 0.5)) (+ (angle pot2 pot3) (* pi 1.5)) 172.3568) (+ (angle pot3 pot2) pi) 200)) (setq id3 (polar (polar (polar pot4 (angle pot4 pot5) (*(distance pot4 pot5) 0.5)) (+ (angle pot4 pot5) (* pi 1.5)) 172.3568) (+ (angle pot4 pot5) pi) 200)) (setq id4 (polar (polar (polar pot6 (angle pot6 pot5) (*(distance pot5 pot6) 0.5)) (+ (angle pot5 pot6) (* pi 1.5)) 172.3568) (+ (angle pot6 pot5) pi) 200))
(load "dim_1-100")(dim_1-100)
(command "_.dimaligned" pot1 pot2 "@0,-450") (if (< (distance pot1 pot2) 500) (command "_.dimtedit" (entlast) id1)) (command "_.dimaligned" pot3 pot2 "@0,-450") (if (< (distance pot2 pot3) 500) (command "_.dimtedit" (entlast) id2)) (command "_.dimaligned" pot4 pot5 "@450,0") (if (< (distance pot4 pot5) 500) (command "_.dimtedit" (entlast) id3)) (command "_.dimaligned" pot6 pot5 "@450,0") (if (< (distance pot5 pot6) 500) (command "_.dimtedit" (entlast) id4))
(setq NN (1+ NN)) );while ;(setvar "ltscale" ltsc)(command "regen") (command "_.undo" "e") (setvar "osmode" os) (setvar "cmdecho" 1) (princ));end defun
;求PLINE上的点 (defun pline_po () (load "get_pl_pot") (setq plpot (get_pl_pot nam))
(setq plpot (vl-sort plpot (function (lambda (e1 e2) (< (cadr e1) (cadr e2)) ) ) ) ;按Y坐标排序(小到大) );;end setq
(SETQ P-1 (NTH 0 plpot) p-2 (NTH 1 plpot));求点(水平)
(setq lst1 (vl-sort (list p-1 p-2) (function (lambda (e1 e2) (< (car e1) (car e2)) ) ) ) ;按Y坐标排序(小到大) );;end setq (setq p-1 (nth 0 lst1) p-2 (nth 1 lst1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq plpot1 (vl-sort plpot (function (lambda (e1 e2) (< (car e1) (car e2)) ) ) ) ;按X坐标排序(大到小) );;end setq
(setq p-3 (nth 2 plpot1) p-4 (nth 3 plpot1));求点(垂直) (setq lst2 (vl-sort (list p-3 p-4) (function (lambda (e1 e2) (< (cadr e1) (cadr e2)) ) ) ) ;按Y坐标排序(小到大) );;end setq (setq p-3 (nth 0 lst2) p-4 (nth 1 lst2))
);end defun
(defun dim_1-100 () (command "style" "arial_narrow" "arial narrow" "" "" "" "" "") (command "insert" "dimx" "0,0" "" "" "") (command "erase" (entlast) "")
(setq tbl (tblsearch "dimstyle" "1-100")) (if (= tbl nil) (command "DIMSTYLE" "s" "1-100") (command "DIMSTYLE" "r" "1-100") );end if
;设置标注参数 (setvar "DIMALTD" 4) (setvar "DIMALTTD" 4) (setvar "DIMALTTZ" 0) (setvar "DIMALTU" 8) (setvar "DIMALTZ" 0) (setvar "DIMAPOST" "") (setvar "DIMASZ" 1) (setvar "DIMAUNIT" 0) ;判断ACAD版本号 (setq acadver (getvar "acadver")) (if (= acadver "14.0") (setvar "dimblk" "DIMX") (setvar "DIMLDRBLK" "DIMX")) (setvar "DIMBLK1" "DIMX") (setvar "DIMBLK2" "DIMX") (setvar "DIMBLK" "DIMX") (setvar "DIMCEN" 2.5) (setvar "DIMCLRD" 82) (setvar "DIMCLRE" 82) (setvar "DIMCLRT" 2) (setvar "DIMDEC" 0) (setvar "DIMDLE" 0) (setvar "DIMDLI" 0) (setvar "DIMEXE" 250) (setvar "DIMEXO" 0) (setvar "DIMFIT" 5) (setvar "DIMGAP" 150) (setvar "DIMJUST" 0) (setvar "DIMLFAC" 1) (command "DIMLIM" "Off") (setvar "DIMPOST" "") (setvar "DIMRND" 0) (command "DIMSAH" "On") (setvar "DIMSCALE" 1) (command "DIMSD1" "Off") (command "DIMSD2" "Off") (command "DIMSE1" "Off") (command "DIMSE2" "Off") (command "DIMSHO" "On") (command "DIMSOXD" "Off") (setvar "DIMTAD" 1) (setvar "DIMTDEC" 4) (setvar "DIMTFAC" 1) (command "DIMTIH" "Off") (command "DIMTIX" "On") (setvar "DIMTM" 0) (command "DIMTOFL" "On") (command "DIMTOH" "Off") (command "DIMTOL" "Off") (setvar "DIMTOLJ" 1) (setvar "DIMTP" 0) (setvar "DIMTSZ" 0) (setvar "DIMTVP" 0) (setvar "DIMTXSTY" "ARIAL_NARROW") (setvar "DIMTXT" 250) (setvar "DIMTZIN" 0) (setvar "DIMUNIT" 2) (command "DIMUPT" "Off") (setvar "DIMZIN" 0) )
(defun GET_PL_POT (E / ED) (defun DXF (NO) (cdr (assoc NO ED)) ) (defun GETLWPL (ED / PL) (while (setq ED (cdr (member (setq PL10 (assoc 10 ED)) ED ) ) ) (setq PL (cons (cdr PL10) PL)) ) (reverse PL) ) (defun GETPL (ED / E PL P10) (setq E (DXF -1)) (while (setq E (entnext E)) (if (setq P10 (cdr (assoc 10 (entget E)))) (setq PL (cons P10 PL)) ) ) (reverse PL) ) (setq ED (entget E)) (setq PLTYPE (DXF 0)) (cond ((= "POLYLINE" PLTYPE) (GETPL ED) ) ((= "LWPOLYLINE" PLTYPE) (GETLWPL ED) ) ) ) |
|