(defun c:wsgfj();主函数,wsgfj为命令
(defun getdata();定义getdata 函数,其功能是获取编辑框的最终数据
(setq xc(atof(get_tile "X")))
(setq yc(atof(get_tile "Y")))
(setq ad(atof(get_tile "A")))
(setq bd(atof(get_tile "B")))
(setq drd(atof(get_tile "dr")))
(setq xrd(atof(get_tile "xr")))
)
(setvar "osmode" 0);关闭目标捕捉状态
(setvar "cmdecho" 0);抑制普通命令的提示
(command "layer" "m" "solid" "")
(command "layer" "m" "cen" "c" 1 "" "lt" "center" "" "")
(setq id(load_dialog "D:\\autoCAD\\dcl\\ws.dcl"));装入DCL文件
(if (< id 0)(exit)) ;如果装入失败则退出
(setq ad 20 bd 10 drd 5 xrd 4 xc 0 yc 0 std 2 p (list 0 0));设变量初值
(while (> std 1);while开始循环
(if (not (new_dialog "ws" id))(exit));显示名字为zxp的对话框,如果失败则退出
(setq x1(dimx_tile "img_cr"))
(setq y1(dimy_tile "img_cr"))
(start_image "img_cr")
(slide_image 0 0 x1 y1 "D:\\autoCAD\\\SLD\\ws")
(end_image)
(set_tile "A" (rtos ad 2 2))
(set_tile "B" (rtos bd 2 2))
(set_tile "dr" (rtos drd 2 2))
(set_tile "xr" (rtos xrd 2 2))
(set_tile "X" (rtos xc 2 2))
(set_tile "Y" (rtos yc 2 2))
(action_tile "pick" "(getdata)(done_dialog 2)" );设置屏幕取点按钮的活动
(action_tile "accept" "(getdata) (done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq std (start_dialog))
(if(= std 2);由于单击了"屏幕取点按钮",注意:该表达式在while内部
(progn
(initget 1);禁止空输入
(setq p(getpoint "定位点:"));在屏幕上获取p点
(setq xc (car p) yc (cadr p));p点的X、Y坐标分别赋给变量x、y
);取点之后,重新开始循环
)
);while循环结束
(if (= std 1)
(progn
(command "layer" "m" "solid" "")
(setq p0 (list xc yc))
(setq p01 (polar p0 (* 0.5 pi) (* 0.5 b)))
(setq p1 (polar p0 0 (* b 0.5)))
(setq p2 (polar p01 0 (* 0.25 b)))
(setq p3 (polar p01 0 (* 0.5 a)))
(setq o1 (polar p3 (* 0.5 pi) R1))
(setq p4 (polar p3 (* 0.5 pi) (* 2 R1)))
(setq p02 (polar p4 pi (* 0.5 a)))
(setq p5 (polar p4 pi a))
(setq o2 (polar o1 pi a))
(setq p6 (polar p3 pi a))
(setq p7 (polar p01 pi (* b 0.25)))
(setq p8 (polar p1 pi b))
(command "pline" p6 p3 "a" p4 "l" p5 "a" p6 "")
(command "circle" o1 r2)
(command "circle" o2 r2)
(command "pline" p7 p8 p1 p2 "")
)
)
(unload_dialog id);卸载对话框文件
(princ)
)
编写的cad lisp中错线了numberp: nil这个错误,怎么修改...求指教
答案:2 悬赏:50 手机版
解决时间 2021-03-12 12:06
- 提问者网友:我是我
- 2021-03-12 07:36
最佳答案
- 五星知识达人网友:鱼忧
- 2021-03-12 09:04
(slide_image 0 0 x1 y1 "D:\\autoCAD\\\SLD\\ws")里边这个目录 "D:\\autoCAD\\\SLD\\ws"是不是应该写为 "D:\\autoCAD\\SLD\\ws"?
全部回答
- 1楼网友:污到你湿
- 2021-03-12 09:51
你好!
你把dcl的文件给看一下
仅代表个人观点,不喜勿喷,谢谢。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯