明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1855|回复: 6

[基础] 求助DCL控制画圆

[复制链接]
发表于 2009-10-8 18:25 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2009-10-8 23:16:11 编辑

circle.dcl程序

rect:dialog
{ label="画圆程序" ;
:edit_box //编辑框元件
{ label="输入圆心 : " ;
key="rect_w" ;
edit_limit=16;
edit_width=20;
fixed_width=true;
}
:edit_box //编辑框元件
{ label="输入半径 :" ;
key="rect_h" ;
edit_limit=16;
edit_width=20;
fixed_width=true;
}
ok_cancel;
}

   

circle.lsp程序

(defun c:rect()
 (setq dcl_id (load_dialog "circle"))
 (new_dialog "rect" dcl_id)
 (action_tile "accept" "(sae_alue)")
 (start_dialog) (unload_dialog dcl_id)
)
(defun c:yuan()
 (setq pt (getpoint "输入圆心坐标:"))
 (setq r (getreal "输入半径"))
 (command "circle" pt r )
)
(defun sae_alue ()
 (setq r (atof (get_tile "rect_h"))
 (setq pt (atof (get_tile "rect_w"))
 (done_dialog)
)

求高手帮忙看看这个程序哪里有问题,为什么DCL控制无法实现

发表于 2009-10-9 12:24 | 显示全部楼层

(command "circle" pt r )
这个是画圆

pt是圆心,r是半径

(setq r (atof (get_tile "rect_h"))
这里获取了半径的值

(setq pt (atof (get_tile "rect_w"))
这里获取了圆心坐标-------圆心坐标肯定不是一个float,应该是个list

lz学学调试,这个不难发现错误的!!

明经网友  发表于 2009-10-9 15:57

还是没有解决问题啊,我想知道问题在哪,我觉得好像是圆心坐标那定义有问题

回复 支持 反对

使用道具

 楼主| 发表于 2009-10-9 15:58 | 显示全部楼层

还是没解决问题啊,我想知道问题出在哪,是不是圆心定义的时候有问题啊

发表于 2009-10-9 16:07 | 显示全部楼层

对,圆心错了。

你还不如分开,

一个圆心 X 坐标

一个圆心 Y 坐标

再用 (list x y )

这样可以

发表于 2009-10-9 22:17 | 显示全部楼层
  1. (defun c:tt ()
  2.   (CMDLA0)
  3.   (defun main-pro ()
  4.     (command "circle" (list dx dy dz) r)
  5.   )  
  6.   (xyp-initSet '(dx dy dz r) '(0. 0. 0. 100.))
  7.   (setq Ilst '(("dx" "X" "real" "10")
  8.         ("dy" "Y" "real" "10")
  9.         ("dz" "Z" "real" "10")
  10.         ("r" "R" "real" "10")
  11.        )
  12.   )
  13.   (if (= (xyp-Dcl-Init Ilst "【画圆】" t) 1)
  14.     (main-pro)
  15.   )
  16.   (CMDLA1)
  17. )

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
 楼主| 发表于 2009-10-10 08:42 | 显示全部楼层
谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-10 00:51 , Processed in 0.152756 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表