弄了个保温棉和防火棉的lisp .总是出错。有知道原因的吗?
;;from lionguns;;from lionguns;;from lionguns;;from lionguns;;from lionguns;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;------------------------------防火棉绘制-----------------------------;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:fg()
(fhliongunserrorstart)
(command "undo" "be" )
(command "-layer" "new" "防火棉" "color" "1" "防火棉""")
(command "-layer" "set" "防火棉" "")
(SETQ kkk(getint"\n请输入防火棉类型--100(1),50(5):<5>"))(princ"\n指定防火棉的起点、终点及所在一侧")
(command "ortho" "off" "line"pause pause"")
(setq xxx1(ssget "L"))
(SETQ XX1(entget (ssname xxx1 0)))
(setq pp1(assoc '10 xx1))
(setq x1(cadr pp1))(setq Y1(caddr pp1))(setq p1(list x1 y1))
(setq pp2(assoc '11 xx1))
(setq x2(cadr pp2))(setq Y2(caddr pp2))(setq p2(list x2 y2))
(if(and(=x1 x2)(< y1 y2))(setq a1 (* 1 (/ pi 2))))
(if(and(=x1 x2)(> y1 y2))(setq a1 (* 3 (/ pi 2))))
(if(< x1 x2)(setq a1(atan (/ (- y2 y1)(- x2 x1)))))
(if(> x1 x2)(setq a1(+ pi (atan (/ (- y2 y1)(- x2 x1))))))
(command "line" "non" p2 "non" pause"")
(setq xxx2(ssget "L"))
(SETQ XX2(entget (ssname xxx2 0)))
(setq pp3(assoc '11 xx2))
(setq x3(cadr pp3))(setq Y3(caddr pp3))(setq p3(list x3 y3))
(if(and(=x2 x3)(< y2 y3))(setq a2 (* 1 (/ pi 2))))
(if(and(=x2 x3)(> y2 y3))(setq a2 (* 3 (/ pi 2))))
(if(< x2 x3)(setq a2(atan (/ (- y3 y2)(- x3 x2)))))
(if(> x2 x3)(setq a2(+ pi (atan (/ (- y3 y2)(- x3 x2))))))
(if(= kkk nil)(setq kkk 5))
(if(or(= kkk 5)(= kkk 50))
(progn
(setq p01(polar p1(+ a1 (* 3 (/ pi 2))) 5.68194955))
(setq p4 (polar p1(+ a1 (* 3 (/ pi 2)))44.68194955))
(setq p5 (polar p01 (+ a1pi ) 5.00))
(setq p6 (polar p01 (+ a10.0 ) 5.00))
(setq p02(polar p4(+ a10.0 ) 5.00))
(setq p7 (polar p4(+ a10.0 )10.00))
(setq p8 (polar p02 (+ a1 (* 3 (/ pi 2))) 5.68194955))
))
(if(or(= kkk 1)(= kkk 100))
(progn
(setq p01(polar p1(+ a1 (* 3 (/ pi 2))) 5.68194955))
(setq p4 (polar p1(+ a1 (* 3 (/ pi 2)))94.68194955))
(setq p5 (polar p01 (+ a1pi ) 5.00))
(setq p6 (polar p01 (+ a10.0 ) 5.00))
(setq p02(polar p4(+ a10.0 ) 5.00))
(setq p7 (polar p4(+ a10.0 )10.00))
(setq p8 (polar p02 (+ a1 (* 3 (/ pi 2))) 5.68194955))
))
(setq x4(car p4))(setq y4(cadr p4))
(if(and(=x1 x4)(< y1 y4))(setq a3(* 1 (/ pi 2))))
(if(and(=x1 x4)(> y1 y4))(setq a3(* 3 (/ pi 2))))
(if(< x1 x4)(setq a3(atan (/ (- y4 y1)(- x4 x1)))))
(if(> x1 x4)(setq a3(+ pi (atan (/ (- y4 y1)(- x4 x1))))))
(setq p10 (polar p1(+ a1 (* 1(/ pi 2))) 19.79304119))
(setq p11 (polar p1(+ a1 (* 3(/ pi 2))) 19.79304119))
(setq d310 (distance p3 p10))
(setq d311 (distance p3 p11))
(command "erase" xxx1 "")
(command "erase" xxx2 "")
(command "pline" "non" p4 "w" "0" "0" "non" p5 "A" "non" p6 "L" "non" P4 "A" "non" p7 "L" "non" P6 "")
(setq xxx3(ssget "L"))
(if (< d310d311)(command "move" xxx3 "" "non" p8 "non" p1))
(setq LL(distance p1 p2))
(repeat(fix(/ LL 10.0))
(setq p9(polar p8 a1 10.0))
(command "copy" "last" "" "non" p8 "non" p9 )
(setq p8 p9)
)
(command "-layer" "set" "防火棉" "")
(command "ortho" "on")(command "undo" "e" )
(liongunserrorend)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;------------------------------保温棉绘制--------------------------------;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:bw()
(fhliongunserrorstart)
(command "undo" "be" )
(command "-layer" "new" "保温棉" "color" "95" "保温棉""")
(command "-layer" "set" "保温棉" "")
(command "ortho" "off" "line"pause pause"")
(setq xxx1(ssget "L"))
(SETQ XX1(entget (ssname xxx1 0)))
(setq pp1(assoc '10 xx1))
(setq x1(cadr pp1))(setq Y1(caddr pp1))(setq p1(list x1 y1))
(setq pp2(assoc '11 xx1))
(setq x2(cadr pp2))(setq Y2(caddr pp2))(setq p2(list x2 y2))
(if(and(=x1 x2)(< y1 y2))(setq a1 (* 1 (/ pi 2))))
(if(and(=x1 x2)(> y1 y2))(setq a1 (* 3 (/ pi 2))))
(if(< x1 x2)(setq a1(atan (/ (- y2 y1)(- x2 x1)))))
(if(> x1 x2)(setq a1(+ pi (atan (/ (- y2 y1)(- x2 x1))))))
(command "line" "non" p2 "non" pause"")
(setq xxx2(ssget "L"))
(SETQ XX2(entget (ssname xxx2 0)))
(setq pp3(assoc '11 xx2))
(setq x3(cadr pp3))(setq Y3(caddr pp3))(setq p3(list x3 y3))
(if(and(=x2 x3)(< y2 y3))(setq a2 (* 1 (/ pi 2))))
(if(and(=x2 x3)(> y2 y3))(setq a2 (* 3 (/ pi 2))))
(if(< x2 x3)(setq a2(atan (/ (- y3 y2)(- x3 x2)))))
(if(> x2 x3)(setq a2(+ pi (atan (/ (- y3 y2)(- x3 x2))))))
(setq aaa1(* 67.71576140 (/ pi 180)))
(setq aaa2(* 52.20882813 (/ pi 180)))
(setq p4(polar p1(+ a1 aaa1) 19.79304119))
(setq p5(polar p1(+ a1 aaa2) 32.03391003))
(setq p6(polar p4(+ a1 0.00) 16.16580754))
(setq p9(polar p4(+ a1 aaa1 pi) 39.58608239))
(setq p7(polar p6(+ a1 aaa1 pi) 39.58608239))
(setq p8(polar p5(+ a1 aaa1 pi) 55.64787119))
(setq p10 (polar p1(+ a1 (* 1(/ pi 2))) 19.79304119))
(setq p11 (polar p1(+ a1 (* 3(/ pi 2))) 19.79304119))
(setq d310 (distance p3 p10))
(setq d311 (distance p3 p11))
(command "erase" xxx1 "")
(command "erase" xxx2 "")
(command "pline" "non" p9 "w" "0" "0" "non" p4 "A" "non" p5 "non" p6 "L" "non" P7 "A" "non" p8 "non" p9 "")
(setq xxx3(ssget "L"))
(if(< d310 d311)(command "move" xxx3 "" "non" p8 "non" p1))
(if(> d310 d311)(command "move" xxx3 "" "non" p5 "non" p1))
(setq LL(distance p1 p2))
(repeat(fix(+ (/ LL 16.16580754) 1))
(command "copy" "last" "" "non" p4 "non" p6 )
)
(command "ortho" "on")
(command "-layer" "set" "保温棉" "")(command "undo" "e" )
(liongunserrorend)
(princ)
)
;;;;;防火保温棉错误函数
(defun fhliongunserror (msg)
(if msg
(princ (strcat "\n*取消*: " "函数取消,命令中止!"))
)(command "undo" "e" "undo""")
(YSCSFY)
(setq *error* olderr) ;
(princ)
)
;;;;防火保温棉错误函数放在函数开始
(defun fhliongunserrorstart ()
(setq olderr *error*
*error* fhliongunserror)
(setq ocmd (getvar "cmdecho"))
(setq oOSM (getvar "OSMODE"))
(setq odyn (getvar "dynmode"))
(setq oorth (getvar "ORTHOMODE"))
(setq ocla (getvar "CLAYER"))
(setq oplwd (getvar "plinewid"))
(princ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 正如错误示的,起码缺少YSCSFY函数的定义,把YSCSFY函数补上再试试! ;;from lionguns;;from lionguns;;from lionguns;;from lionguns;;from lionguns
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;------------------------------防火棉绘制-----------------------------;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:fg()
(fhliongunserrorstart)
(command "undo" "be" )
(command "-layer" "new" "防火棉" "color" "1" "防火棉""")
(command "-layer" "set" "防火棉" "")
(SETQ kkk(getint"\n请输入防火棉类型--100(1),50(5):<5>"))(princ"\n指定防火棉的起点、终点及所在一侧")
(command "ortho" "off" "line"pause pause"")
(setq xxx1(ssget "L"))
(SETQ XX1(entget (ssname xxx1 0)))
(setq pp1(assoc '10 xx1))
(setq x1(cadr pp1))(setq Y1(caddr pp1))(setq p1(list x1 y1))
(setq pp2(assoc '11 xx1))
(setq x2(cadr pp2))(setq Y2(caddr pp2))(setq p2(list x2 y2))
(if(and(=x1 x2)(< y1 y2))(setq a1 (* 1 (/ pi 2))))
(if(and(=x1 x2)(> y1 y2))(setq a1 (* 3 (/ pi 2))))
(if(< x1 x2)(setq a1(atan (/ (- y2 y1)(- x2 x1)))))
(if(> x1 x2)(setq a1(+ pi (atan (/ (- y2 y1)(- x2 x1))))))
(command "line" "non" p2 "non" pause"")
(setq xxx2(ssget "L"))
(SETQ XX2(entget (ssname xxx2 0)))
(setq pp3(assoc '11 xx2))
(setq x3(cadr pp3))(setq Y3(caddr pp3))(setq p3(list x3 y3))
(if(and(=x2 x3)(< y2 y3))(setq a2 (* 1 (/ pi 2))))
(if(and(=x2 x3)(> y2 y3))(setq a2 (* 3 (/ pi 2))))
(if(< x2 x3)(setq a2(atan (/ (- y3 y2)(- x3 x2)))))
(if(> x2 x3)(setq a2(+ pi (atan (/ (- y3 y2)(- x3 x2))))))
(if(= kkk nil)(setq kkk 5))
(if(or(= kkk 5)(= kkk 50))
(progn
(setq p01(polar p1(+ a1 (* 3 (/ pi 2))) 5.68194955))
(setq p4 (polar p1(+ a1 (* 3 (/ pi 2)))44.68194955))
(setq p5 (polar p01 (+ a1pi ) 5.00))
(setq p6 (polar p01 (+ a10.0 ) 5.00))
(setq p02(polar p4(+ a10.0 ) 5.00))
(setq p7 (polar p4(+ a10.0 )10.00))
(setq p8 (polar p02 (+ a1 (* 3 (/ pi 2))) 5.68194955))
))
(if(or(= kkk 1)(= kkk 100))
(progn
(setq p01(polar p1(+ a1 (* 3 (/ pi 2))) 5.68194955))
(setq p4 (polar p1(+ a1 (* 3 (/ pi 2)))94.68194955))
(setq p5 (polar p01 (+ a1pi ) 5.00))
(setq p6 (polar p01 (+ a10.0 ) 5.00))
(setq p02(polar p4(+ a10.0 ) 5.00))
(setq p7 (polar p4(+ a10.0 )10.00))
(setq p8 (polar p02 (+ a1 (* 3 (/ pi 2))) 5.68194955))
))
(setq x4(car p4))(setq y4(cadr p4))
(if(and(=x1 x4)(< y1 y4))(setq a3(* 1 (/ pi 2))))
(if(and(=x1 x4)(> y1 y4))(setq a3(* 3 (/ pi 2))))
(if(< x1 x4)(setq a3(atan (/ (- y4 y1)(- x4 x1)))))
(if(> x1 x4)(setq a3(+ pi (atan (/ (- y4 y1)(- x4 x1))))))
(setq p10 (polar p1(+ a1 (* 1(/ pi 2))) 19.79304119))
(setq p11 (polar p1(+ a1 (* 3(/ pi 2))) 19.79304119))
(setq d310 (distance p3 p10))
(setq d311 (distance p3 p11))
(command "erase" xxx1 "")
(command "erase" xxx2 "")
(command "pline" "non" p4 "w" "0" "0" "non" p5 "A" "non" p6 "L" "non" P4 "A" "non" p7 "L" "non" P6 "")
(setq xxx3(ssget "L"))
(if (< d310d311)(command "move" xxx3 "" "non" p8 "non" p1))
(setq LL(distance p1 p2))
(repeat(fix(/ LL 10.0))
(setq p9(polar p8 a1 10.0))
(command "copy" "last" "" "non" p8 "non" p9 )
(setq p8 p9)
)
(command "-layer" "set" "防火棉" "")
(command "ortho" "on")(command "undo" "e" )
(liongunserrorend)
(princ)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;------------------------------保温棉绘制--------------------------------;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:bw()
(fhliongunserrorstart)
(command "undo" "be" )
(command "-layer" "new" "保温棉" "color" "95" "保温棉""")
(command "-layer" "set" "保温棉" "")
(command "ortho" "off" "line"pause pause"")
(setq xxx1(ssget "L"))
(SETQ XX1(entget (ssname xxx1 0)))
(setq pp1(assoc '10 xx1))
(setq x1(cadr pp1))(setq Y1(caddr pp1))(setq p1(list x1 y1))
(setq pp2(assoc '11 xx1))
(setq x2(cadr pp2))(setq Y2(caddr pp2))(setq p2(list x2 y2))
(if(and(=x1 x2)(< y1 y2))(setq a1 (* 1 (/ pi 2))))
(if(and(=x1 x2)(> y1 y2))(setq a1 (* 3 (/ pi 2))))
(if(< x1 x2)(setq a1(atan (/ (- y2 y1)(- x2 x1)))))
(if(> x1 x2)(setq a1(+ pi (atan (/ (- y2 y1)(- x2 x1))))))
(command "line" "non" p2 "non" pause"")
(setq xxx2(ssget "L"))
(SETQ XX2(entget (ssname xxx2 0)))
(setq pp3(assoc '11 xx2))
(setq x3(cadr pp3))(setq Y3(caddr pp3))(setq p3(list x3 y3))
(if(and(=x2 x3)(< y2 y3))(setq a2 (* 1 (/ pi 2))))
(if(and(=x2 x3)(> y2 y3))(setq a2 (* 3 (/ pi 2))))
(if(< x2 x3)(setq a2(atan (/ (- y3 y2)(- x3 x2)))))
(if(> x2 x3)(setq a2(+ pi (atan (/ (- y3 y2)(- x3 x2))))))
(setq aaa1(* 67.71576140 (/ pi 180)))
(setq aaa2(* 52.20882813 (/ pi 180)))
(setq p4(polar p1(+ a1 aaa1) 19.79304119))
(setq p5(polar p1(+ a1 aaa2) 32.03391003))
(setq p6(polar p4(+ a1 0.00) 16.16580754))
(setq p9(polar p4(+ a1 aaa1 pi) 39.58608239))
(setq p7(polar p6(+ a1 aaa1 pi) 39.58608239))
(setq p8(polar p5(+ a1 aaa1 pi) 55.64787119))
(setq p10 (polar p1(+ a1 (* 1(/ pi 2))) 19.79304119))
(setq p11 (polar p1(+ a1 (* 3(/ pi 2))) 19.79304119))
(setq d310 (distance p3 p10))
(setq d311 (distance p3 p11))
(command "erase" xxx1 "")
(command "erase" xxx2 "")
(command "pline" "non" p9 "w" "0" "0" "non" p4 "A" "non" p5 "non" p6 "L" "non" P7 "A" "non" p8 "non" p9 "")
(setq xxx3(ssget "L"))
(if(< d310 d311)(command "move" xxx3 "" "non" p8 "non" p1))
(if(> d310 d311)(command "move" xxx3 "" "non" p5 "non" p1))
(setq LL(distance p1 p2))
(repeat(fix(+ (/ LL 16.16580754) 1))
(command "copy" "last" "" "non" p4 "non" p6 )
)
(command "ortho" "on")
(command "-layer" "set" "保温棉" "")(command "undo" "e" )
(liongunserrorend)
(princ)
)
;;;;;防火保温棉错误函数
(defun fhliongunserror (msg)
(if msg
(princ (strcat "\n*取消*: " "函数取消,命令中止!"))
)(command "undo" "e" "undo""")
(setvar "cmdecho" ocmd)
(setvar "OSMODE" oOSM)
(setvar "dynmode" odyn)
(setvar "ORTHOMODE" oorth)
(setvar "CLAYER" ocla)
(setvar "plinewid" oplwd)
(setq *error* olderr) ;
(princ)
)
;;;;防火保温棉错误函数放在函数开始
(defun fhliongunserrorstart ()
(setq olderr *error*
*error* fhliongunserror)
(setq ocmd (getvar "cmdecho"))
(setq oOSM (getvar "OSMODE"))
(setq odyn (getvar "dynmode"))
(setq oorth (getvar "ORTHOMODE"))
(setq ocla (getvar "CLAYER"))
(setq oplwd (getvar "plinewid"))
(princ))
(defun liongunserrorend ()
(setvar "cmdecho" ocmd)
(setvar "OSMODE" oOSM)
(setvar "dynmode" odyn)
(setvar "ORTHOMODE" oorth)
(setvar "CLAYER" ocla)
(setvar "plinewid" oplwd)
(setq *error* olderr)
)
页:
[1]