错误: 参数类型错误: 二维/三维点: nil
看了好长,还没发现。就是一直出现错误: 参数类型错误: 二维/三维点: nil。请大家帮帮我,到底哪里出错了,我估计是(setq cp (getpoint "请插入中心点:"))这一行有错,但不知道怎么改。以下是程序和DCL
(defun c:lm()
(setq dcl_id(load_dialog "lm.dcl"))
(if (not (new_dialog"lm" dcl_id)) (exit))
(action_tile "accept" "(getdrawlm)")
(start_dialog)
(unload_dialog dcl_id)
(drawlm)
(princ)
)
(defun getdrawlm()
(setq cp (getpoint "请插入中心点:"))
(setq x (car cp))
(setq y (car(cdr cp)))
(setq rd (atof (get_tile "kj")))
(setq rx (atof (get_tile "nb")))
(setq p1 (polar cp (/ pi 6) (* (/ rd 2) (/ 2 (sqrt 3)))))
(setq p2 (polar cp (/ pi (- 0 6)) (* (/ rd 2) (/ 2 (sqrt 3)))))
(setq p3 (list x (- y (+ 4 (/ rd 2)))))
(setq p4 (list x (+ y (+ 4 (/ rd 2)))))
(setq p5 (list (- x (+ 4 (/ rd 2))) y))
(setq p6 (list (+ x (+ 4 (/ rd 2))) y))
)
(defun drawlm()
(command "line" p1 p2 "")
(command "array" "l" "" "p" cp "6" "" "y")
(command "circle" cp "d" rd)
(command "circle" cp "d" rx)
(command "line" p3 p4 "")
(command "line" p5 p6 "")
(setq cc (list (- x (* 0.55 rx )) y))
(command "arc" "c" cp cc "a" "270.0")
)
lm:dialog{
label="螺母正视图绘制器";
:text{
label="输入数据,然后单击确定";
}
:boxed_row{
label="螺母轮廓尺寸参数";
:edit_box{
label="螺母口径";
key="kj";
edit_limit=20;
edit_width=5;
}
:edit_box{
label="螺母内孔半径";
key="nb";
edit_limit=20;
edit_width=5;
}
}
ok_only;
}
把所有点list都加上Z坐标0试试。 未退出对话框无法取点,而退出对话框后又无法读参数,真是矛盾呀。
下面是改过的程序。
(defun c:lm()
(if (> (setq dcl_id(load_dialog "lm.dcl")) 0) (progn
(if (new_dialog "lm" dcl_id) (progn
(action_tile "accept" "(getdrawlm) (done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq re (start_dialog))
)
(princ "\n无法显示对话框!")
)
(unload_dialog dcl_id)
)
(princ "\n无法加载对话框!")
)
(if (= re 1) (drawlm))
(princ)
)
(defun getdrawlm()
(setq rd (atof (get_tile "kj")))
(setq rx (atof (get_tile "nb")))
)
(defun drawlm()
(setq cp (getpoint "请插入中心点:"))
(setq x (car cp))
(setq y (cadr cp))
(setq p1 (polar cp (/ pi 6) (* (/ rd 2) (/ 2 (sqrt 3.0)))))
(setq p2 (polar cp (/ pi -6) (* (/ rd 2) (/ 2 (sqrt 3.0)))))
(setq p3 (list x (- y (+ 4 (/ rd 2)))))
(setq p4 (list x (+ y (+ 4 (/ rd 2)))))
(setq p5 (list (- x (+ 4 (/ rd 2))) y))
(setq p6 (list (+ x (+ 4 (/ rd 2))) y))
(command "line" p1 p2 "")
(command "array" "l" "" "p" cp "6" "" "y")
(command "circle" cp "d" rd)
(command "circle" cp "d" rx)
(command "line" p3 p4 "")
(command "line" p5 p6 "")
(setq cc (list (- x (* 0.55 rx )) y))
(command "arc" "c" cp cc "a" "270.0")
)
非常感谢版主,接触Lisp有一段时间,以前都是从网站下载的,现在刚刚认真在学,这个例子从书上的。这个论坛太好了,让我接触到LISP的魅力。 现在也遇到了这个问题,向楼主学习 正好遇到这个问题了,希望学习一下 我也碰到了这个问题 谢谢大神的解答 谢谢大神的解答
页:
[1]