找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1687|回复: 1

[求助] autolisp程序运行后参数类型错误numberp:nil

[复制链接]
发表于 2015-3-27 19:49:52 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
autolisp程序运行后参数类型错误numberp:nil
想了两天,没找到错误在哪

                               
登录/注册后可看大图

                               
登录/注册后可看大图

以下是我的程序,求帮忙分析一下
lsp文件
(defun C:ring()
   (setq key 0)
   (dialog)
   (if (= key 1)((drawing)))
)
(defun dialog()
  (setq dcl_id (load_dialog "ring.dcl"))
  (if (not (new_dialog "ring" dcl_id))(exit))
  (show_sld "kimage" "ring")
  (action_tile "accept" "(ok_ring) (done_dialog)")
  (start_dialog)
  (unload_dialog dcl_id)
)
(defun drawing()
  (if (= pick 1.0) (setq p0 (getpoint"请用鼠标选插入点(轴心位置)")))
  (setq pai 6.28318)
  (command "circle" p0 r1)
  (command "circle" p0 r3)
  (setq r (/ (+ r1 r3) 2))
  (command "layer" "M" "1" "C" "BLUE" "1" "L" "CENTER" "1" "S" "1")
  (command "circle" p0 r)
  (command "layer" "M" "2" "C" "RED" "2" "S" "2")
  (setq gle 0)
  (setq k 1)
  (while (<= k n)
      (setq gle (+ gle (/ pai n)))
      (setq ptn (polar p0 gle r))
      (command "circle" ptn r2)
      (setq k (+ 1 k))
)
(defun ok_ring()                                
  (setq pick (atof (get_tile "pick_pt")))
  (setq r1 (atof (get_tile "r1")))
  (setq r2 (atof (get_tile "r2")))
  (setq r3 (atof (get_tile "r3")))
  (setq n (atof (get_tile "n")))
  (setq x0 (atof (get_tile "x0")))
  (setq y0 (atof (get_tile "y0")))
  (setq kimage (atof (get_tile "kimage")))
  (setq p0 (list x0 y0))
  (setq key 1)
)
(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)
)
dcl文件
  label="绘制圆环组:";
  :row {
     :boxed_column {
       label="圆环参数";
        :edit_box {
          label="内圆半径:";
          key="r1";
          value="200";}
        :edit_box {
          label="小圆半径:";
          key="r2";
          value="20";}
        :edit_box {
          label="外圆半径:";
          key="r3";
          value="250";}
        :edit_box {
          label="小圆个数:";
          key="n";
          value="12";}
     }
    :image{
       label="图例";
       key="kimage";
       color=-2;
       width=30;
       aspect_ratio=0.66;
     }
   }
:row {
   label="圆心坐标";
         :edit_box {
          label="X轴";
          key="x0";
          value="0";}
         :edit_box {
          label="Y轴";
          key="y0";
          value="0";}
          :toggle {
           label="点选插入点&P";
           key="pick_pt";         
           fixed_width=true;
           alignment=centered;}
}
  ok_cancel;
}



论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 1742个

财富等级: 堆金积玉

发表于 2015-4-8 10:11:52 | 显示全部楼层
检查get_tile返回的值  看看是否可以atof
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-4-28 11:51 , Processed in 0.284518 second(s), 40 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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