autolisp 出现 numberp nil
本来是画法兰的,我删减了大部分代码,这只是最简单的画一个矩形,可是一加载就出现numberpnil到底是哪里出错了啊,我都快郁闷死了(defunc:jxfl()(setq...
本来是画法兰的,我删减了大部分代码,这只是最简单的画一个矩形,可是一加载就出现numberp nil 到底是哪里出错了啊,我都快郁闷死了(defun c:jxfl () (setq dcl_id (load_dialog "d:/dcl调用程序/甲型法兰.dcl"))
(if (not (new_dialog "jxfl" dcl_id))
(exit)
)
(defun data () (setq dn (atof (get_tile "DN")))
(setq d3 (atof (get_tile "D3")))
(setq d1 (atof (get_tile "D1")))
(setq d (atof (get_tile "D")))
(setq b (atof (get_tile "B")))
(setq dl (atof (get_tile "DL")))
(setq h (atof (get_tile "H")))
(setq h1 (atof (get_tile "H1")))
(setq h2 (atof (get_tile "H2")))
(setq jd1 (atof (get_tile "J1")))
(setq jd2 (atof (get_tile "J2")))
(setq jd3 (atof (get_tile "J3")))
(setq x (atof (get_tile "X")))
(setq y (atof (get_tile "Y")))
)
(defun draw () (setvar "osmode" 0)
(setvar "clayer" "0")
(setq fa (* pi (/ jd1 180)))
(setq fb (* pi (/ jd2 180)))
(setq fc (* pi (/ jd3 180)))
(setq p1 (list x y)) (setq p2 (list (+ x (/ (- d d1 dl) 2)) y))
(setq P3 (list (+ x (/ (+ (- d d1) dl) 2)) y))
(setq p4 (list (+ x (- (/ (- d dn) 2) (* h1 (+ (/ (sin fb) (cos fb)) (/ (cos fc) (sin fc)))))) y ))
(setq p5 (list (+ x (- (/ (- d dn) 2) (* h1 (/ (cos fc) (sin fc))))) (+ y h1) ))
(setq p6 (list (+ x (- (/ (- d dn) 2) (* h1 (/ (cos fc) (sin fc))))) (+ y h) ))
(setq p7 (list (+ x (/ (- d dn) 2)) (+ y h h1)))
(setq p8 (list (+ x (/ (- d dn) 2)) (+ y b)))
(setq p9 (list (+ x (/ (- d d3) 2)) (+ y b)))
(setq p10 (list (+ x (/ (+ (- d d1) dl) 2)) (- (+ y b) h2)))
(setq p11 (list (+ x (/ (- d d1 dl) 2)) (- (+ y b) h2)))
(setq p12 (list x (- (+ y b) h2)))
(command "pline" p1 p2 p11 p12 p1 "")
)
(setq w (dimx_tile "img") d (dimy_tile "img")
)
(start_image "img")
(fill_image 0 0 w d -9)
(slide_image 0 0 w d "jxfl.sld")
(end_image)
(start_dialog)
(unload_dialog dcl_id)
(setq ok (start_dialog))
(if (= ok 1)
(data)
(draw)
)
(princ)
) 展开
(if (not (new_dialog "jxfl" dcl_id))
(exit)
)
(defun data () (setq dn (atof (get_tile "DN")))
(setq d3 (atof (get_tile "D3")))
(setq d1 (atof (get_tile "D1")))
(setq d (atof (get_tile "D")))
(setq b (atof (get_tile "B")))
(setq dl (atof (get_tile "DL")))
(setq h (atof (get_tile "H")))
(setq h1 (atof (get_tile "H1")))
(setq h2 (atof (get_tile "H2")))
(setq jd1 (atof (get_tile "J1")))
(setq jd2 (atof (get_tile "J2")))
(setq jd3 (atof (get_tile "J3")))
(setq x (atof (get_tile "X")))
(setq y (atof (get_tile "Y")))
)
(defun draw () (setvar "osmode" 0)
(setvar "clayer" "0")
(setq fa (* pi (/ jd1 180)))
(setq fb (* pi (/ jd2 180)))
(setq fc (* pi (/ jd3 180)))
(setq p1 (list x y)) (setq p2 (list (+ x (/ (- d d1 dl) 2)) y))
(setq P3 (list (+ x (/ (+ (- d d1) dl) 2)) y))
(setq p4 (list (+ x (- (/ (- d dn) 2) (* h1 (+ (/ (sin fb) (cos fb)) (/ (cos fc) (sin fc)))))) y ))
(setq p5 (list (+ x (- (/ (- d dn) 2) (* h1 (/ (cos fc) (sin fc))))) (+ y h1) ))
(setq p6 (list (+ x (- (/ (- d dn) 2) (* h1 (/ (cos fc) (sin fc))))) (+ y h) ))
(setq p7 (list (+ x (/ (- d dn) 2)) (+ y h h1)))
(setq p8 (list (+ x (/ (- d dn) 2)) (+ y b)))
(setq p9 (list (+ x (/ (- d d3) 2)) (+ y b)))
(setq p10 (list (+ x (/ (+ (- d d1) dl) 2)) (- (+ y b) h2)))
(setq p11 (list (+ x (/ (- d d1 dl) 2)) (- (+ y b) h2)))
(setq p12 (list x (- (+ y b) h2)))
(command "pline" p1 p2 p11 p12 p1 "")
)
(setq w (dimx_tile "img") d (dimy_tile "img")
)
(start_image "img")
(fill_image 0 0 w d -9)
(slide_image 0 0 w d "jxfl.sld")
(end_image)
(start_dialog)
(unload_dialog dcl_id)
(setq ok (start_dialog))
(if (= ok 1)
(data)
(draw)
)
(princ)
) 展开
2个回答
展开全部
(setq fa (* pi (/ jd1 180)))换成(setq fa (* jd1 (/ pi 180)))至于原因我也不太明白
追问
首先要谢谢你,这个问题其实我已经解决了,原因嘛,就是/ jd1 180 会因为jd1和180都是整数而得到0
追答
整数除整数得0?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果只要画一个矩形,你何必搞那么长的代码?直接调用cad本身的REC命令不是更简单?
追问
不是的,我只是摘了前面的一部分,画的是一个法兰,我就是不明白,为什么我的CAD老是出现numberp nil还有stringp nil
追答
你的这部份代码里,所调用的有些参数没有定义或者类型不对,就会出现这情况
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询