叶文军 发表于 2004-6-2 19:34:00

有个LISP程序请教!很急很急!!!!!!!

下面这个程序是小弟修改过的,有个问题不懂:当输入的比例尺为1:200时,“建筑占地面积”一栏显示的位置是正确的,但是为其它时,该栏的位置会因比例尺的大小而垂直移动,想请哪位老大帮忙改一下,谢谢!另外一个问题:该程序只能量算并标注直线的长度,却不能量算弧形的长度,而且不能显示中文字体(在CAD2002中),很令我头疼。还有一个图层的问题:该程序必须要有CASS中的几个图层才能用,单独一个0层就不能用了,可以帮忙改一下吗?谢谢,我很急啊!小弟的EMAIL:ywj_82@163.com


(defun c:zdt8 ()<BR>       (setq s (getint "\n 请输入比例尺(1:200)1:"))<BR>       (if (&gt; 100 s)<BR>                       (progn<BR>                                       (setq ss (/ 200 100))<BR>                                       (setq sbl 200)<BR>                                       (terpri)<BR>                                        ;(setq ssbl (rtos sbl 2 1))<BR>                                        ;(princ ssbl )(terpri)<BR>                       )<BR>                       (progn<BR>                                       (setq ss (/ s 100))<BR>                                       (setq sbl s)<BR>                                        ;(setq ssbl (rtos sbl 2 1))<BR>                                        ;(princ ssbl )(terpri)<BR>                       )<BR>       )<BR>       (setq ss1 (rtos (* ss 0.03) 2 2))<BR>       (setq ss2 (rtos (* ss 0.05) 2 2))<BR>       (setq ss3 (rtos (* ss 0.2) 2 2))<BR>                                        ;(princ ss1 )(terpri)<BR>                                                ;(princ "\n please select one ployline or many ploylines")<BR>       (setq lun (getvar "lunits"))<BR>       (princ lun)<BR>       (terpri)<BR>                                        ;(princ "\n")<BR>       (setq lup (getvar "luprec"))<BR>       (princ lup)<BR>       (terpri)<BR>       (setq lay (getvar "clayer"))<BR>       (princ lup)<BR>       (terpri)<BR>       (setvar "lunits" 2)<BR>       (setvar "luprec" 8)<BR>       (setq ent (ssget))<BR>       (setq l (sslength ent))<BR>       (setq ll (1- l))<BR>       (setvar "cmdecho" 0)<BR>       (while (&gt; ll -1)<BR>                       (setq e (ssname ent ll))<BR>                       (command "area" "e" e)<BR>                       (setq arr (getvar "area"))<BR>                       (setq arr1 (rtos arr 2 2))<BR>                       (command "layer" "s" "jzd" "")<BR>                       (command "pedit" e "w" ss1 "")<BR>                                        ;(command "pedit" e "w" 0 "")<BR>                       (command "change" e "" "p" "la" "jzd" "c" "bylayer" "")<BR>                       (setvar "clayer" lay)<BR>                                        ;(command "text" aa "1.5" "0"       arr1 )<BR>                                        ;(princ arr1) (terpri)<BR>                                        ;(setq ar0 (vl-list* ar))<BR>                                        ;(princ ar0 )<BR>                       (setq ar (entget e))<BR>                                        ;(setq ar0 (vl-list* ar))<BR>                                        ;(princ ar0 )<BR>                       (setq pt0 (cdr (assoc '10 ar)))<BR>                       (setq pt1 (cdr (assoc '10 ar)))<BR>                       (setq sumx 0<BR>               sumy 0<BR>                       )<BR>                       (setq sum 0)<BR>                       (setq x3 (car pt0)<BR>               y3 (cadr pt0)<BR>                       )<BR>                       (setq x4 (car pt0)<BR>               y4 (cadr pt0)<BR>                       )<BR>                                        ;(setq zbb (getint "\n 是否画界址点坐标表:1、画, 2、否"))<BR>                                        ;(if (= 1 zbb)<BR>                                        ;(progn<BR>                                        ;(setq jzb (getpoint "\n please input the up-left point"))<BR>                                        ;(setq jzbx (car jzb) jzby (cadr jzb))<BR>                                        ;(setq jzdx (rtos jzdx 2 2) jzdy (rtos jzdy 2 2))<BR>                                        ;(command "text" "j" "m" jzdx "1.5" "0" (list jzdx jzdy) "")<BR>                                        ;);progn<BR>                                        ;)<BR>                       (setq pt2 (cdr (assoc '10 ar)))<BR>                       (setq jzdh 2)<BR>                       (setq num 1)<BR>                       (while (= 1 num)<BR>                                        ;( repeat 4<BR>                                        ;(princ pt2)(terpri)<BR>                                       (setq pt1 (cdr (assoc '10 ar)))<BR>                                       (setq x1 (car pt1)<BR>                               y1 (cadr pt1)<BR>                                       )<BR>                                       (setq y3 (max y3 y1)<BR>                               y4 (min y4 y1)<BR>                                       )<BR>                                       (setq x3 (max x3 x1)<BR>                               x4 (min x4 x1)<BR>                                       )<BR>                                       (setq aa (list (/ (+ x3 x4) 2) (/ (+ y3 y4) 2)))<BR>                                       (setq sum (1+ sum))<BR>                                       (setq x (car pt1)<BR>                               y (cadr pt1)<BR>                                       )<BR>                                        ;(command "text" "j" "ml" pt1 ss3 "0" jzdh "")<BR>                                        ;(setq jzdh ( 1+ jzdh))<BR>                                       (setq sumx (+ sumx x)<BR>                               sumy (+ y sumy)<BR>                                       )<BR>                                        ;(setq x3 (/ sumx sum) y3 (/ sumy sum))<BR>                                       (command "layer" "s" "jzd" "")<BR>                                       (command "circle" pt1 ss2 "")<BR>                                       (setvar "clayer" lay)<BR>                                       (setq old (assoc '10 ar))<BR>                                       (setq ar (subst '(20) old AR))<BR>                                        ;(setq pt2 ( cdr (assoc '10 ar)))<BR>                                        ;(princ pt2)(terpri)<BR>                                        ;(princ "\n the program error!")<BR>                                       (if (/= nil (assoc '10 ar))<BR>        (progn<BR>                                        ;(cond ( /= nil (assoc '10 ar ))<BR>               (setq num 1)<BR>               (setq pt2 (cdr (assoc '10 ar)))<BR>               (princ pt2)<BR>               (terpri)<BR>               (setq jl (distance pt1 pt2))<BR>               (setq a (rtos jl 2 2))<BR>               (setq b1 (angle pt1 pt2))<BR>               (setq ang0 (+ 90 b1))<BR>               (setq dist (* 0.2 ss))<BR>               (setq        x1 (car pt1)<BR>                y1 (cadr pt1)<BR>               )<BR>               (setq        x2 (car pt2)<BR>                y2 (cadr pt2)<BR>               )<BR>                                        ;(setq sum ( 1+ sum))<BR>                                        ;(setq sumx ( + sum x1 ) sumy (+ y1 sumy))<BR>                                        ;(setq y3 (max y3 y1) y4 (min y4 y1))<BR>                                        ;(setq aa (list ( / ( + x3 x4) 2 ) ( / ( + y3 y4 ) 2)))<BR>                                        ;(princ aa)(terpri)<BR>               (setq x5 (/ (+ x1 x2) 2))<BR>               (setq y5 (/ (+ y1 y2) 2))<BR>               (setq pt5 (list x5 y5))<BR>               (if (&lt; x1 x2)<BR>                               (if        (&lt; y2 y1)<BR>                                               (if (&lt; -1 (/ (- y2 y1) (- x2 x1)))<BR>                (setq b1 (+ pi b1))


                                               )<BR>                               )<BR>               )<BR>               (if (&lt; x2 x1)<BR>                               (if        (&gt; y2 y1)<BR>                                               (if (&lt; -1 (/ (- y2 y1) (- x2 x1)))<BR>                (setq b1 (+ pi b1))<BR>                                               )<BR>                                               (setq b1 (+ pi b1))<BR>                               )<BR>                               (if        (&lt; y2 y1)<BR>                                               (setq b1 (+ pi b1))<BR>                               )<BR>               )<BR>               (setq pt (polar pt5 ang0 dist))<BR>               (setq b2 (* (/ b1 Pi) 180))<BR>               (setq ptjzdh (polar pt2 ang0 dist))<BR>               (command "layer" "s" "zj" "")<BR>               (command "text" "j" "m" ptjzdh ss3 "0" jzdh "")<BR>               (setq jzdh (1+ jzdh))<BR>               (command "text" "j" "mc" pt ss3 b2 a)<BR>               (setvar "clayer" lay)<BR>        )                                ;progn<BR>        (progn<BR>               (setq num -1)<BR>                                        ;(princ num)(terpri)<BR>                                        ;(princ pt0)<BR>               (setq jl (distance pt1 pt0))<BR>                                        ;(princ s)<BR>               (setq a (rtos jl 2 2))<BR>               (setq b1 (angle pt1 pt0))<BR>               (setq ang0 (+ 90 b1))<BR>               (setq dist (* 0.2 ss))<BR>               (setq        x1 (car pt1)<BR>                y1 (cadr pt1)<BR>               )<BR>               (setq        x2 (car pt0)<BR>                y2 (cadr pt0)<BR>               )<BR>               (setq x5 (/ (+ x1 x2) 2))<BR>               (setq y5 (/ (+ y1 y2) 2))<BR>               (setq pt5 (list x5 y5))<BR>               (if (&lt; x1 x2)<BR>                               (if        (&lt; y2 y1)<BR>                                               (if (&lt; -1 (/ (- y2 y1) (- x2 x1)))<BR>                (setq b1 (+ pi b1))


                                               )<BR>                               )<BR>               )<BR>               (if (&lt; x2 x1)<BR>                               (if        (&gt; y2 y1)<BR>                                               (if (&lt; -1 (/ (- y2 y1) (- x2 x1)))<BR>                (setq b1 (+ pi b1))<BR>                                               )<BR>                                               (setq b1 (+ pi b1))<BR>                               )<BR>                               (if        (&lt; y2 y1)<BR>                                               (setq b1 (+ pi b1))<BR>                               )<BR>               )<BR>               (setq pt (polar pt5 ang0 dist))<BR>               (setq b2 (* (/ b1 Pi) 180))<BR>               (setq ptjzdh (polar pt0 ang0 dist))<BR>               (command "layer" "s" "zj" "")<BR>               (command "text" "j" "m" ptjzdh ss3 "0" "1" "")<BR>                                        ;(command "layer" "s" "zj" "")<BR>               (command "text" "j" "mc" pt ss3 b2 a)<BR>               (setvar "clayer" lay)<BR>                                        ; (SETQ AA (GETPOINT "面积注记位置:"))<BR>                                        ;(command "layer" "s" "jzd" "")<BR>                                        ; (command "text" "j" "m" aa "1.5" "0"       arr1 "")<BR>        )                                ;progn<BR>                                       )                                        ;if<BR>                                        ;(setq p (list x1 y1 ))<BR>                                        ;(command "text" "j" "m" p "1.0" "0" dh)<BR>                                        ;(setq dh ( 1 + dh))<BR>                                        ;)<BR>                       )                                        ;while 1 <BR>                                        ;(command"change" e "" "p" "la" "zj" "c" "bylayer" "")<BR>                                        ;(command"change" e "" "" "" "" "1.5" "" "" "")<BR>                                        ;(SETQ AA (GETPOINT "面积注记位置:"))<BR>                                        ;(command "layer" "s" "jzd" "")<BR>                                        ;(setq x3 (/ sumx sum) y3 (/ sumy sum))<BR>                                        ;(setq aa (list x3 y3 ))<BR>                       (setq xcen (/ (+ x3 x4) 2)<BR>               ycen (/ (+ y3 y4) 2)<BR>                       )<BR>                       (setq aa (list xcen ycen))<BR>                       (command "layer" "s" "jzd" "")<BR>;;;;;(SETQ AA (GETPOINT "面积注记位置:"))<BR>                                        ;(setq zdh (getstring "输入宗地号:"))<BR>                       (command "text" "j" "ml" aa ss3 "0" arr1)<BR>                       (setq aa0 (list (- xcen (* 0.4 ss)) ycen))<BR>                       (command "line" aa0 aa "")<BR>                       (setq zdh (getstring "输入宗地号:"))<BR>                       (setq aa (list (- xcen (* 0.2 ss)) (+ (* 0.16 ss) ycen)))<BR>                       (command "text" "j" "mc" aa ss3 "0" zdh)<BR>                       (setq ydlb (getstring "输入用地类别:"))<BR>                       (setq aa (list (- xcen (* 0.2 ss)) (- ycen (* 0.16 ss))))<BR>                       (command "text" "j" "mc" aa ss3 "0" ydlb)<BR>                       (setvar "clayer" lay)<BR>;;;(setq blc0 (getreal "请输入宗地图比例尺1:"))<BR>;;;<BR>                                        ;(setq sbl0 (rtos s 2 2))<BR>                                        ;(princ sbl0)(terpri)<BR>                                        ;(setq ssbl (rtos sbl 2 1))<BR>                                        ;(princ "sbl:")<BR>                                        ;(princ sbl )(terpri)<BR>                                        ;(princ "blc0:")<BR>;;;加宗地图框及文字----<BR>                       (setq blc (/ sbl 1000.0))<BR>                       (setq aa (list xcen ycen))<BR>                       (setq xaa (- (car aa) (* 160 blc)))<BR>                       (setq yaa (- (cadr aa) (* 96 blc)))<BR>                       (setq aa (list xaa yaa))<BR>                       (setq zlpt (list (+ xaa (* 14.5 blc)) (+ yaa (* 196.5 blc))))<BR>                       (princ zlpt)<BR>                       (terpri)<BR>                       (setq mcpt (list (+ xaa (* 144.0 blc)) (+ yaa (* 196.5 blc))))<BR>                       (setq thpt (list (+ xaa (* 258.0 blc)) (+ yaa (* 196.5 blc))))<BR>                       (setq dhpt (list (+ xaa (* 305.0 blc)) (+ yaa (* 196.5 blc))))<BR>                       (setq blcpt (list (+ xaa (* 160 blc)) (+ yaa (* -5.0 blc))))<BR>                       (setq wyrmpt (list (+ xaa (* 18.40 blc)) (+ yaa (* -7.10 blc))))<BR>                       (setq newyrmpt (list (+ xaa (* 93.10 blc)) (+ yaa (* -7.10 blc))))<BR>                       (setq fhrmpt (list (+ xaa (* 93.10 blc)) (+ yaa (* -13.70 blc))))<BR>                       (setq wyyearpt (list (+ xaa (* 35.90 blc)) (+ yaa (* -7.0 blc))))<BR>                       (setq wyyuept (list (+ xaa (* 49.60 blc)) (+ yaa (* -7.0 blc))))<BR>                       (setq wydaypt (list (+ xaa (* 61.20 blc)) (+ yaa (* -7.0 blc))))<BR>                       (setq newyearpt (list (+ xaa (* 110.60 blc)) (+ yaa (* -7.0 blc))))<BR>                       (setq newyuept (list (+ xaa (* 124.3 blc)) (+ yaa (* -7.0 blc))))<BR>                       (setq newdaypt (list (+ xaa (* 135.9 blc)) (+ yaa (* -7.0 blc))))<BR>                       (setq jhyearpt (list (+ xaa (* 35.90 blc)) (+ yaa (* -15 blc))))<BR>                       (setq jhyuept (list (+ xaa (* 49.60 blc)) (+ yaa (* -15 blc))))<BR>                       (setq jhdaypt (list (+ xaa (* 61.20 blc)) (+ yaa (* -15 blc))))<BR>                       (setq fhyearpt (list (+ xaa (* 110.60 blc)) (+ yaa (* -15 blc))))<BR>                       (setq fhyuept (list (+ xaa (* 124.30 blc)) (+ yaa (* -15 blc))))<BR>                       (setq fhdaypt (list (+ xaa (* 135.90 blc)) (+ yaa (* -15 blc))))<BR>                       (setq jhrmpt (list (+ xaa (* 18.4 blc)) (+ yaa (* -13.70 blc))))<BR>                                        ;(setq jhrmpt (list 29.40 -13.6))<BR>                       (SETQ zlss (GETstring "请输入座落:"))<BR>                                        ;(setq zz (rtos (* 4 blc0) 2 2))<BR>                                        ;(princ)<BR>                       (setq zlzd (rtos (* 4 blc) 2 1))<BR>                       (princ zlzd)<BR>                       (command "text" zlpt (rtos (* 4 blc) 2 2) "0" zlss)<BR>                       (SETQ mcss (GETstring "请输入单位名称:"))<BR>                       (command "text" mcpt (rtos (* 4 blc) 2 2) "0" mcss)<BR>                       (SETQ thss (GETstring "请输入分幅图号:"))<BR>                       (command "text" "j" "c" thpt (rtos (* 4 blc) 2 2) "0" thss)<BR>                                        ;(SETQ dhss (GETstring "请输入地号:"))<BR>                       (command "text" "j" "c" dhpt (rtos (* 4 blc) 2 2) "0" zdh)<BR>                                        ;(SETQ blss (GETstring "请输入比例尺:"))<BR>                       (setq s (rtos sbl 2 0))<BR>                       (setq blcss (strcat "1:" s))<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       blcpt<BR>                                       (rtos (* 4 blc) 2 2)<BR>                                       "0"<BR>                                       blcss<BR>                       )<BR>                       (COMMAND "INSERT" "8kh" AA (rtos blc 2 2) (rtos blc 2 2) "")<BR>                       (setq tkzdmjpt (list (+ xaa (* 265.00 blc)) (+ yaa (* 27.7 blc))))<BR>                                        ;(setq tkzdmjpt (list 250.00 27.70))<BR>                       (setq tkzdmj0 (strcat "宗地面积:" arr1 "m"))<BR>                                        ;(setq tkzdmj (strcat tkzdmj0 arr1))<BR>                                        ;(princ tkzdmj)<BR>                       (command "text" tkzdmjpt (rtos (* 3 blc) 2 2) "0" tkzdmj0)<BR>                       (setq tkjzzdmjpt (list (+ xaa (* 265.00 blc))<BR>                                       (+ yaa (* (- 9.46 6.2) blc))<BR>                       )<BR>                                        ;(setq tkjzzdmjpt (list 250.00 27.70))<BR>                       (setq tkjzzdmj0 (strcat "建筑占地面积:" arr1 "m"))<BR>                                        ;(setq tkjzzdmj (strcat tkjzzdmj0 arr1))<BR>                                        ;(princ tkjzzdmj)<BR>                       (command "text"<BR>                                       tkjzzdmjpt<BR>                                       (rtos (* 3 blc) 2 2)<BR>                                       "0"<BR>                                       tkjzzdmj0<BR>                       )<BR>                       (setq tkjzmjpt (list (+ xaa (* 265.00 blc))<BR>                       (+ yaa (* (- 27.7 6.2) blc))<BR>                               ))<BR>                       <BR>                                        ;(setq tkzdmj (strcat dhss "建筑面积:" arr1))<BR>                       (setq jzAR (atof arr1))<BR>                                        ;(setq jgcc (getint "\n please input house's floors:"))<BR>                                        ;(if (&gt; 1 jgcc) (setq tkjzAR (rtos jzAR 2 2))<BR>                                        ;                                                                                                               (setq tkjzAR (rtos (* jzAR jgcc) 2 2))<BR>                                        ;)


                                        ;(command "text" tkjzmjpt ( rtos (* 3 blc) 2 2) "0" tkjzAR)<BR>                       (setq tkftxspt (list (+ xaa (* 265.00 blc))<BR>                       (+ yaa (* (- 15.30 6.20) blc))<BR>                               )<BR>                       )<BR>                       (setq jgcc<BR>                       (getint<BR>                                       "\n 1.砖、2.砖2、3.砖3、4.砖4、5.砖5、6.砖6、7.砖7、8.厕、9.木、0.木2:"<BR>                       )<BR>                       )<BR>                       (if        (&gt; 1 jgcc)<BR>                                       (setq ssjgcc 1)<BR>                                       (setq ssjgcc jgcc)<BR>                       )<BR>                       (setq tkjzAR (rtos (* jzAR ssjgcc) 2 2))<BR>                       (setq tkjzAR0 (strcat "建筑面积:" tkjzAR "m"))<BR>                                        ;(setq tkjzAR (rtos jzAR 2 2))<BR>                                        ;(defun c:zz()<BR>                                        ;(vmon)<BR>                                        ;(SETQ SS 1)<BR>                                        ;(setq s (getint"\n Please input number(1:500)1:" ) )<BR>                                        ;(if (&gt; 100 s)<BR>                                        ;(setq ss1 (* 0.3 (/ 500 100)))<BR>                                        ;(setq ss1 (* (/ s 100) 0.3)))<BR>                                        ;(setq ss2 (* ss1 0.8))<BR>                                        ;(princ "\n 1.砖、2.砖2、3.砖3、4.砖4、5.砖5、6.砖6、7.砖7、8.厕、9.木、0.木2:")<BR>                       (setq ss1 (* 3 (/ sbl 1000.00)))<BR>                       (setq ss2 (* ss1 0.8))<BR>                       (setq jgccaa (list xcen (- ycen (* 6 blc))))<BR>                                        ;(setq ssjgcc (getint "\n choose the number(0-9): "))<BR>                                        ;       (cond ((= ssjgcc 1) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m ))<BR>                                        ;                                                       ((= ssjgcc 2) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       "2"))<BR>                                        ;                                                       ((= ssjgcc 3) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       "3"))<BR>                                        ;                                                       ((= ssjgcc 4) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       "4"))<BR>                                        ;                                                       ((= ssjgcc 5) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       "5"))<BR>                                        ;                                                       ((= ssjgcc 6) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       "6"))<BR>                                        ;                                                       ((= ssjgcc 7) (setq m "砖")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       "7"))<BR>                                        ;                                                       ((= ssjgcc 8) (setq m "厕")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                               (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq p1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                                       (command "text" jgccp1 ss2 "0"       ""))<BR>                                        ;                                                       ((= ssjgcc 9) (setq m "木")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m ))<BR>                                        ;                                                       ((= ssjgcc 0) (setq m "木")<BR>                                        ;                                                                       (command "layer" "M" "zj" "")<BR>                                        ;                                                                       (command "text" jgccaa ss1 "0"       m )<BR>                                        ;                                                                       (setq jgccp1 (polar jgccaa 0.1 ss1))<BR>                                        ;                                                               (command "text" jgccp1 ss2 "0"       "2"))<BR>                                        ;       )


                       (setq wyrmint<BR>                       (getint "\n 外业: 1、叶文军 2、朱林威 3、金义阳 4、谢国胜"<BR>                       )<BR>                       )<BR>                       (if        (&gt; 1 wyrmint)<BR>                                       (setq wyrm 1)<BR>                                       (setq wyrm wyrmint)<BR>                       )<BR>                       (cond ((= wyrm 1) (setq m "叶文军"))<BR>               ((= wyrm 2) (setq m "朱林威"))<BR>               ((= wyrm 3) (setq m "金义阳"))<BR>               ((= wyrm 4) (setq m "谢国胜"))


                       )


                       (setq<BR>                                       newyrmint        (getint<BR>                       "\n 内业: 1、叶文军 2、朱林威 3、金义阳 4、谢国胜"<BR>                )<BR>                       )<BR>                       (if        (&gt; 1 newyrmint)<BR>                                       (setq newyrm 1)<BR>                                       (setq newyrm wyrmint)<BR>                       )<BR>                       (cond ((= newyrm 1) (setq m "叶文军"))<BR>               ((= newyrm 2) (setq m "朱林威"))<BR>               ((= newyrm 3) (setq m "金义阳"))<BR>               ((= newyrm 4) (setq m "谢国胜"))


                       )<BR>                       (command "text" "j" "c" wyrmpt (rtos (* 5 blc) 2 2) "0" m)<BR>                       (command "text" "j" "c" newyrmpt (rtos (* 5 blc) 2 2) "0" m)<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       jhrmpt<BR>                                       (rtos (* 5 blc) 2 2)<BR>                                       "0"<BR>                                       "金晓军"<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       fhrmpt<BR>                                       (rtos (* 5 blc) 2 2)<BR>                                       "0"<BR>                                       "杨昌林"<BR>                       )<BR>                       (command "text" tkjzmjpt (rtos (* 3 blc) 2 2) "0" tkjzAR0)<BR>                       (setq ftAR (atof arr1))<BR>                       (setq jzAR (atof tkjzAR))<BR>                       (setq ftxs0 (/ ftAR jzAR))<BR>                       (setq ftxs (rtos ftxs0 2 8))<BR>                       (setq ftxs (strcat "各户分摊系数:" ftxs))<BR>                                        ;(princ wyyear)(terpri)<BR>;;;2000年1月1日为2451549<BR>;;;2001年1月1日为2451915<BR>;;;2002年1月1日为2452280<BR>;;;2003年1月1日为2452645<BR>;;;2004年1月1日为2453010<BR>;;;2005年1月1日为2453376<BR>;;;2006年1月1日为2453741<BR>;;;2007年1月1日为2454106<BR>;;;2012年12月30日前用!<BR>                                        ;(DEFUN C:Date()<BR>                                        ;(setvar "luprec" 8)<BR>                                        ;(setvar "lunits" 2)<BR>                       (setq nowdate (getvar "date"))<BR>                       (princ nowdate)<BR>                       (terpri)<BR>                       (setq january 31)<BR>                       (setq february 28)<BR>                       (setq march 31)<BR>                       (setq april 30)<BR>                       (setq may 31)<BR>                       (setq june 30)<BR>                       (setq july 31)<BR>                       (setq augual 31)<BR>                       (setq september 30)<BR>                       (setq october 31)<BR>                       (setq november 30)<BR>                       (setq december 31)<BR>                       (if        (&gt; 2451911 nowdate)<BR>                                       (progn<BR>        (setq wyyear 2000)<BR>        (setq newyear 2000)<BR>        (setq olddate 2451879)<BR>        (setq subdays (- (fix nowdate) olddate))<BR>        (princ subdays)<BR>        (terpri)<BR>        (setq newyue 12)<BR>        (setq wyyue newyue)<BR>        (princ newyue)<BR>        (terpri)<BR>        (setq newday subdays)<BR>        (princ newday)<BR>        (terpri)<BR>        (setq wyday (- newday 7))<BR>        (princ newday)<BR>        (terpri)<BR>        (princ wyday)<BR>        (terpri)<BR>                                       )<BR>                                       (progn<BR>        (setq olddate 2451910)<BR>        (setq subdays (fix (- nowdate olddate)))<BR>        (princ subdays)<BR>        (terpri)<BR>        (setq wyyear (+ 2001 (fix (/ (- subdays 1) 365))))<BR>        (setq newyear (+ 2001 (fix (/ (- subdays 1) 365))))<BR>        (princ newyear)<BR>        (terpri)<BR>        (setq subdays (- subdays (* (fix (/ (- subdays 1) 365)) 365)))<BR>        (princ subdays)<BR>        (terpri)


        (if (and (= subdays 1) (&gt;= newyear 2005) (&lt;= newyear 2008))<BR>               (progn<BR>                               (setq subdays 366)<BR>                               (setq wyyear (- newyear 1))<BR>                               (setq newyear (- newyear 1))<BR>               )<BR>        )<BR>        (if (and (&gt; subdays 1) (&gt;= newyear 2005) (&lt;= newyear 2008))<BR>               (setq subdays (- subdays 1))<BR>        )<BR>        (if (and (= subdays 1) (&gt;= newyear 2009) (&lt;= newyear 20012))<BR>               (progn<BR>                               (setq subdays 366)<BR>                               (setq wyyear (- newyear 1))<BR>                               (setq newyear (- newyear 1))<BR>               )<BR>        )<BR>        (if (and (= subdays 2) (&gt;= newyear 2009) (&lt;= newyear 20012))<BR>               (progn<BR>                               (setq subdays 367)<BR>                               (setq wyyear (- newyear 1))<BR>                               (setq newyear (- newyear 1))<BR>               )<BR>        )<BR>        (if (and (&gt; subdays 2) (&gt;= newyear 2009))<BR>               (setq subdays (- subdays 2))<BR>        )<BR>        (if (or (= newyear 2004) (= newyear 2008) (= newyear 2012))<BR>               (setq february 29)<BR>        )<BR>        (if (&gt; (+ 1 january february march april may june) subdays)<BR>               (progn<BR>                               (if        (&gt; (+ 1 january february march) subdays)<BR>                                               (progn<BR>                (if (&gt; (+ 1 january) subdays)<BR>                       (progn<BR>                                       (setq newyue 1)<BR>                                       (princ "january 31")<BR>                                       (terpri)<BR>                                       (setq newday subdays)<BR>                                       (if        (&gt; 8 subdays)<BR>                                                       (progn<BR>                        (setq wyyue 12)<BR>                        (setq wyday (+ 24 newday))<BR>                        (setq wyyear (- wyyear 1))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue 1)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )


                (if (and (&lt; (+ january) subdays)<BR>                       (&gt; (+ 1 january february) subdays)<BR>                                       )<BR>                       (progn<BR>                                       (setq newyue 2)<BR>                                       (princ newyue)<BR>                                       (terpri)<BR>                                       (setq newday (- subdays january))<BR>                                       (princ newday)<BR>                                       (terpri)<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 1)<BR>                        (princ wyyue)<BR>                        (terpri)<BR>                        (setq wyday (+ (- january 7) newday))<BR>                        (princ wyday)<BR>                        (terpri)<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )


                (if (&lt; (+ january february) subdays)<BR>                       (progn<BR>                                        ;(princ february)(terpri)<BR>                                       (setq newyue 3)<BR>                                       (setq newday (- subdays (+ january february)))<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 2)<BR>                        (setq wyday (+ (- february 7) newday))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )<BR>                                               )                                ;progn <BR>                               )                                ;if<BR>                               (if<BR>                                               (and<BR>                (&lt; (+ january february march) subdays)<BR>                (&gt; (+ 1 january february march april may june) subdays)<BR>                                               )<BR>                                                       (progn<BR>               (if (&gt; (+ 1 january february march april) subdays)<BR>                               (progn<BR>                                        ;(princ february)(terpri)<BR>                                               (setq newyue 4)<BR>                                               (setq newday (- subdays (+ january february march)))<BR>                                               (if (&gt; 8 newday)<BR>                                                               (progn<BR>                       (setq wyyue 3)<BR>                       (setq wyday (+ 24 newday))<BR>                                                               )<BR>                                                               (progn<BR>                       (setq wyyue newyue)<BR>                       (setq wyday (- newday 7))<BR>                                                               )<BR>                                               )<BR>                               )<BR>               )<BR>               (if<BR>                               (and        (&lt; (+ january february march april) subdays)<BR>                        (&gt; (+ 1 january february march april may) subdays)<BR>                               )<BR>                                       (progn<BR>                                        ;(princ "february")<BR>                                        ;(princ february)(terpri)<BR>                                                       (setq newyue 5)<BR>                                                       (setq newday (- subdays<BR>                                                                       (+ january february march april)<BR>                                               )<BR>                                                       )<BR>                                                       (if (&gt; 8 newday)<BR>                        (progn<BR>                               (setq wyyue 4)<BR>                               (setq wyday (+ 23 newday))<BR>                        )<BR>                        (progn<BR>                               (setq wyyue newyue)<BR>                               (setq wyday (- newday 7))<BR>                        )<BR>                                                       )<BR>                                       )<BR>               )<BR>               (if (&lt; (+ january february march april may) subdays)<BR>                               (progn<BR>                                        ;(princ february)(terpri)<BR>                                               (setq newyue 6)<BR>                                               (setq<BR>                                                               newday (- subdays<BR>                               (+ january february march april may)<BR>                                                               )<BR>                                               )<BR>                                               (if (&gt; 8 newday)<BR>                                                               (progn<BR>                       (setq wyyue 5)<BR>                       (setq wyday (+ 24 newday))<BR>                                                               )<BR>                                                               (progn<BR>                       (setq wyyue newyue)<BR>                       (setq wyday (- newday 7))<BR>                                                               )<BR>                                               )<BR>                               )<BR>               )<BR>                                                       )<BR>                               )<BR>               )<BR>        )<BR>        (setq sum16 (+ january february march april may june))<BR>        (princ sum16)<BR>        (terpri)<BR>        (if (&lt; (+ january february march april may june) subdays)<BR>               (progn<BR>                               (if        (&gt; (+ 1 sum16 july augual september) subdays)<BR>                                               (progn<BR>                (if (&gt; (+ 1 sum16 july) subdays)<BR>                       (progn<BR>                                       (setq newyue 7)<BR>                                        ;(princ "january 31")(terpri)<BR>                                       (setq newday (- subdays sum16))<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 6)<BR>                        (setq wyday (+ 23 newday))<BR>                                        ;(setq wyyear (- wyyear 1))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )


                (if (and (&lt; (+ sum16 july) subdays)<BR>                       (&gt; (+ 1 sum16 july augual) subdays)<BR>                                       )<BR>                       (progn<BR>                                       (setq newyue 8)<BR>                                       (princ newyue)<BR>                                       (terpri)<BR>                                       (setq newday (- subdays (+ sum16 july)))<BR>                                       (princ newday)<BR>                                       (terpri)<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 7)<BR>                        (princ wyyue)<BR>                        (terpri)<BR>                        (setq wyday (+ (- july 7) newday))<BR>                        (princ wyday)<BR>                        (terpri)<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )


                (if (&lt; (+ sum16 july augual) subdays)<BR>                       (progn<BR>                                        ;(princ february)(terpri)<BR>                                       (setq newyue 9)<BR>                                       (setq newday (- subdays (+ sum16 july augual)))<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 8)<BR>                        (setq wyday (+ (- augual 7) newday))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )<BR>                                               )                                ;progn <BR>                               )                                ;if<BR>                               (setq sum79 (+ july augual september))<BR>                               (setq sum19 (+ sum16 sum79))<BR>                               (if        (&lt; sum19 subdays)<BR>                                               (progn<BR>                (if (&gt; (+ 1 sum19 october) subdays)<BR>                       (progn<BR>                                        ;(princ february)(terpri)<BR>                                       (setq newyue 10)<BR>                                       (setq newday (- subdays sum19))<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 9)<BR>                        (setq wyday (+ 23 newday))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )<BR>                (if (and (&lt; (+ sum19 october) subdays)<BR>                       (&gt; (+ 1 sum19 october november) subdays)<BR>                                       )<BR>                       (progn<BR>                                       (setq newyue 11)<BR>                                       (setq newday (- subdays (+ sum19 october)))<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 10)<BR>                        (setq wyday (+ 24 newday))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )<BR>                (if (&lt; (+ sum19 october november) subdays)<BR>                       (progn<BR>                                        ;(princ february)(terpri)<BR>                                       (setq newyue 12)<BR>                                       (setq newday (- subdays (+ sum19 october november)))<BR>                                       (if        (&gt; 8 newday)<BR>                                                       (progn<BR>                        (setq wyyue 11)<BR>                        (setq wyday (+ 23 newday))<BR>                                                       )<BR>                                                       (progn<BR>                        (setq wyyue newyue)<BR>                        (setq wyday (- newday 7))<BR>                                                       )<BR>                                       )<BR>                       )<BR>                )<BR>                                               )<BR>                               )<BR>               )<BR>        )<BR>                                       )                                        ;progn<BR>                       )                                        ;if<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       wyyearpt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       wyyear<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       wyyuept<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       wyyue<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       wydaypt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       wyday<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       newyearpt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newyear<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       newyuept<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newyue<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       newdaypt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newday<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       jhyearpt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newyear<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       jhyuept<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newyue<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       jhdaypt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newday<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       fhyearpt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newyear<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       fhyuept<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newyue<BR>                       )<BR>                       (command "text"<BR>                                       "j"<BR>                                       "c"<BR>                                       fhdaypt<BR>                                       (rtos (* 3.3 blc) 2 2)<BR>                                       "0"<BR>                                       newday<BR>                       )<BR>                       (command "text" tkftxspt (rtos (* 3 blc) 2 2) "0" ftxs)<BR>                       (princ newyear)<BR>                       (terpri)<BR>                       (setvar "clayer" lay)<BR>                       (setq ll (1- ll))<BR>       )<BR>       (setvar "cmdecho" 1)<BR>       (setvar "lunits" lun)<BR>       (setvar "luprec" lup)<BR>       (setvar "clayer" lay)<BR>)

meflying 发表于 2004-6-2 20:16:00

如果你对程序不怎么懂,建议你不要去修改。。。


如果你想使用,可以有两个方法,


1、说出你的要求,看能不能让别人帮你写一个。。。


2、给出原来程序(必须是正确能用的),然后说说你在功能上需要哪些改动。。。


这样一个经你修改却又有错的程序,找出错误并满足你的需求是很困难的

叶文军 发表于 2004-6-2 20:56:00

可以在这个程序的基础上修改一下吗?要求如下:


1、比例尺,座落,使用人(单位)姓名,图号,地号,宗地面积,建筑面积,建筑占面积,各户分摊系数(建筑面积除以宗地面积),外业(wyrmint),内业(newyrmint),还有时间这些数据都必须要,而且位置就和上面的一个样。


2、我用PL线圈出一个闭合的图形,输入一个zdt8的命令,提示输入比例尺,再提示选择图形,用户点一所需图形,系统自动对其边线的长度进行量算并标注在线中心位置(不要标在线上),并在每个转点画上一个圆(直径为1.5mm)并标上序号(1,2。。。。。),在图形中间注上图形面积。


可以做到吗?谢谢,你让我看到了希望,原来的程序也出错了,我只是在中间加了一个“建筑占地面积”“内业”两项,其它一点没动。谢谢老大

前生 发表于 2004-6-2 21:02:00

程序太长,有写晕。


好想陈伯兄老师关于PLine线的一个例子在网上到处都有啊。

叶文军 发表于 2004-6-2 21:09:00

实际上一点都不长的啦,时间一项不用改,宗地面积不用改,座落、使用者、图号、地号都不用改,还有外业一项也可以不用改,唯一要改的就是建筑占地面积,弧线长度标注,内业这三项要帮忙改一下,其它的都可以正常运行的。可以帮一下忙吗?谢谢了,我到现在一直在等。。。。。。。。

前生 发表于 2004-6-2 21:15:00

呵呵,你很幸福啊。


在网上,不用下来。


.你的程序。可以开很多地方。想什么text 的什么。可以写个小的子函数啊/


程序还是太长,没有心思看。


呵呵

meflying 发表于 2004-6-2 21:48:00

叶文军发表于2004-6-2 20:56:00static/image/common/back.gif可以在这个程序的基础上修改一下吗?要求如下:



1、比例尺,座落,使用人(单位)姓名,图号,地号,宗地面积,建筑面积,建筑占面积,各户分摊系数(建筑面积...


<BR>你说这个程序是你修改过的,我想最好在原程序上改。。。你这个程序哪儿来的?怎么会是一个错误的程序,既然这样你就不应该用它啊。。。


我看你的要求很模糊啊,不知道是要改还是要新写。。。看1,列出那么多东西,不知道做什么,怎么做,好象是改。。。看2,又像是提出了要求,要写。。。希望明确点——注意,由于程序太长,所以不可能去读完了,而且你又说有错的,也无法运行,所以我对这个程序做什么的是一点都不知道的,你说问题的时候应该考虑到这点,不要认为我对这个程序做的事情已经比较清楚了


图可以在这里帖上来的,发帖时输入内容的上方有个上传文件,只要上传图形文件就可以了

alin 发表于 2004-6-2 23:12:00

根本不考虑别人的难处。 程序中有很多(command "layer" "s" ...)的语句,图中没有该图层就会出错,所以一定要上传图形文件。还有,后部有一大段好像在计算日期啥的,要那么复杂吗?没看懂,因为根本不能运行。

叶文军 发表于 2004-6-3 09:53:00

上面的图就是我希望达到的,请各位多多帮小弟一把,谢谢!

meflying 发表于 2004-6-3 10:36:00

还有几个问题:



对于个文字、图形的图层、字体、文字类型、颜色有些什么要求?是否就按图中来,还是不需要考虑


图框大小是否变化,是不是在程序中插入块?块是否需要打散?你块中已有一些姓名,新输入的如何写?


宗地面积是否就是占地面积?


界址点号第一点怎么确定?


还有,用在什么版本的CAD?
页: [1] 2 3
查看完整版本: 有个LISP程序请教!很急很急!!!!!!!