cad二次开发,用lisp语言,image里面没有图像图形

刚刚接触,望各位大牛多多指导。本意效果实际效果DCL代码dia8a:dialog{label="图像辅助(参数设计)范例";:row{:boxed_radio_colum... 刚刚接触,望各位大牛多多指导。
本意效果

实际效果

DCL代码
dia8a:dialog{ label="图像辅助(参数设计)范例"; :row{ :boxed_radio_column{ label="设计样式"; :radio_button{label="L基本型"; key="rb1";} :radio_button{label="L+圆型";key="rb2";} :radio_button{label="L+双圆型";key="rb3";} :radio_button{label="L+弧型";key="rb4";}} :image{ key="kimage"; color=-2; width=30; aspect_radio=0.66; }} :row{ :edit_box{label="宽度ww";key="kww";} :edit_box{label="高度hh";key="khh";}}spacer_1;ok_cancel;}
以上是DCL代码
lisp的代码
(defun c:dia8a() (setvar "cmdecho" 0) (dcl_dia8a) (prin1) )(defun dcl_dia8a() (setq dcl_id (load_dialog "f:\zml")) (new_dialog "dia8a" dcl_id) (sub_rb1) (set_tile "rb1" "1") (set_tile "kww" "100") (set_tile "khh" "100") (action_tile "rb1" "(sub_rb1)") (action_tile "rb2" "(sub_rb2)") (action_tile "rb3" "(sub_rb3)") (action_tile "rb4" "(sub_rb4)") (action_tile "accept" "(ok_dia8a)(done_dialog 1)") (setq dd (start_dialog)) (if (= dd 1)(draw_dia8a)))
(defun sub_rb1() (setq ddtype 1) (show_sld "kimage" "dia8a1") ) (defun sub_rb2() (setq ddtype 2) (show_sld "kimage" "dia8a2") ) (defun sub_rb3() (setq ddtype 3) (show_sld "kimage" "dia8a3") ) (defun sub_rb4() (setq ddtype 4) (show_sld "kimage" "dia8a4") ) (defun show_sld (key sld) (setq x (dimx_tile key)) (setq y (dimy_tile key)) (start_image key) (fill_image 0 0 x y -2) (slide_image 0 0 x y sld) (end_image) ) (defun ok_dia8a() (setq ww (atof (get_tile "kww"))) (setq hh (atof (get_tile "khh"))) ) (defun draw_dia8a() (setq pt1 (getpoint "左下角基准点:")) (setq pt2 (polar pt1 0 ww)) (setq pt3 (polar pt2 (/ pi 2) hh)) (setq pt4 (polar pt3 pi (* ww 0.5))) (setq pt5 (polar pt4 (* pi 1.5)(* hh 0.5))) (setq pt6 (polar pt5 pi (* ww 0.5))) (cond ((= ddtype 1)(command "pline" pt1 pt2 pt3 pt4 pt5 pt6 "c")) ((= ddtype 2)(command "pline" pt6 pt1 pt2 pt3 pt4 "")(command "circle" "2p" pt4 pt6)) ((= ddtype 3)(command "pline" pt1 pt2 pt3 "")(command "pline" pt4 pt5 pt6 "")(command "circle" "2p" pt3 pt4 )(command "circle" "2p" pt6 pt1 )) ((= ddtype 4)(command "pline" pt1 pt2 pt3 pt4 "a" "a" -180 pt6 "l" "c")) ))
可以在CAD里面画出图形,但是image里面显示不出预览。
展开
 我来答
swaywood
2013-08-24 · TA获得超过484个赞
知道小有建树答主
回答量:847
采纳率:0%
帮助的人:149万
展开全部

问题出在load_dialog处,我已经修改好了。

你需要把存放DCL和SLD文件的文件夹加入到搜索路径中。我都放在E:\TEST中,所以增加了下面的路径。

如果解决了问题,请务必设为【采纳回答】哦。




(defun c:dia8a ()

  (setvar "cmdecho" 0)

  (dcl_dia8a)

  (prin1)

)

(defun dcl_dia8a ()

  (setq dcl_id (load_dialog "dia8a.dcl"))

  (if (not (new_dialog "dia8a" dcl_id)) (exit))

  (new_dialog "dia8a" dcl_id)

  (sub_rb1)

  (set_tile "rb1" "1")

  (set_tile "kww" "100")

  (set_tile "khh" "100")

  (action_tile "rb1" "(sub_rb1)")

  (action_tile "rb2" "(sub_rb2)")

  (action_tile "rb3" "(sub_rb3)")

  (action_tile "rb4" "(sub_rb4)")

  (action_tile "accept" "(ok_dia8a)(done_dialog 1)")

  (setq dd (start_dialog))

  (if (= dd 1)

    (draw_dia8a)

  )

)

(defun sub_rb1 ()

  (setq ddtype 1)

  (show_sld "kimage" "dia8a1")

)

(defun sub_rb2 ()

  (setq ddtype 2)

  (show_sld "kimage" "dia8a2")

)

(defun sub_rb3 ()

  (setq ddtype 3)

  (show_sld "kimage" "dia8a3")

)

(defun sub_rb4 ()

  (setq ddtype 4)

  (show_sld "kimage" "dia8a4")

)

(defun show_sld (key sld)

  (setq x (dimx_tile key))

  (setq y (dimy_tile key))

  (start_image key)

  (fill_image 0 0 x y -2)

  (slide_image 0 0 x y sld)

  (end_image)

)

(defun ok_dia8a ()

  (setq ww (atof (get_tile "kww")))

  (setq hh (atof (get_tile "khh")))

)

(defun draw_dia8a ()

  (setq pt1 (getpoint "左下角基准点:"))

  (setq pt2 (polar pt1 0 ww))

  (setq pt3 (polar pt2 (/ pi 2) hh))

  (setq pt4 (polar pt3 pi (* ww 0.5)))

  (setq pt5 (polar pt4 (* pi 1.5) (* hh 0.5)))

  (setq pt6 (polar pt5 pi (* ww 0.5)))

  (cond ((= ddtype 1) (command "pline" pt1 pt2 pt3 pt4 pt5 pt6 "c"))

((= ddtype 2)

(command "pline" pt6 pt1 pt2 pt3 pt4 "")

(command "circle" "2p" pt4 pt6)

)

((= ddtype 3)

(command "pline" pt1 pt2 pt3 "")

(command "pline" pt4 pt5 pt6 "")

(command "circle" "2p" pt3 pt4)

(command "circle" "2p" pt6 pt1)

)

((= ddtype 4)

(command "pline" pt1 pt2 pt3 pt4 "a" "a" -180 pt6 "l" "c")

)

  )

)

追问
成功了,真是太感谢了。我还有1个问题,1.假如我在E盘里建一个名字为“ABC”的文件夹,把每个幻灯片文件放在里面,在执行(show_sld "kimage" "E:\ABC\dia8a1.dcl")时没有DCL对话框出现。只有放在D,E等盘的里面才能出现DCL对话框并执行。这里面是不是有什么知识点?
追答
DCL只有放在CAD的搜索路径下才可以show出来。

sld文件也一样需要放在搜索路径下。可以不需要指定路径,量需要放搜索路径下。
衡阳封云凯律师
2013-08-23 · 律师
个人认证用户
衡阳封云凯律师
采纳数:192 获赞数:3010

向TA提问 私信TA
展开全部
cad二次开发,用lisp语言,image里面没有图像图形

这个问题我知道

推荐您使用“赛思QQ陌生人推广小助手 ”

不用加好友 直接发消息

日引1万独立IP 绝对没有问题
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式