明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1223|回复: 4

[函数] 求助如何处理“参数太少”的问题

[复制链接]
发表于 2011-3-25 17:06 | 显示全部楼层 |阅读模式
各位达人,小弟正在学习用autolisp开发对话框,在教材上有这样一段程序

(defun c:shaft(/d l x y id std x1 y1)
  (defun getdata()
  (setq d (atof(get_tile"D_box")))
  (setq l (atof(get_tile"L_box")))
  (setq x (atof(get_tile"X_box")))
  (setq y (atof(get_tile"Y_box")))
  )
(setvar "cmdecho" 0)
(command "layer" "m" "solid" "")
(command "layer" "m" "cen" "c" 1 "" "lt" "center" "" "")
(setq id (load_dialog "e:\\example\\dcl\\12-13"))
(if (< id 0)(exit))
(setq d 50 l 100 x 0 y 0 std 2 p(list 0 0))
(while (> std 1)
   (if(not(new_dialog "zhou" id))(exit))
   (setq x1(dimx_tile "image"))
   (setq y1(dimy_tile "image"))
   (start_image "image")
   (slide_image 0 0 x1 y1 "e:\\example\\sld\\12-13")
   (end_image)
   (set_tile "D_box" (rtos d 2 2))
   (set_tile "L_box" (rtos l 2 2))
   (set_tile "X_box" (rtos x 2 2))
   (set_tile "Y_box" (rtos y 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)
       (progn
          (initget 1)
          (setq p(getpoint"定位点:"))
          (setq x(car p) y(cadr p))
       )
     )
  )
    (if(= std 1)
        (progn
        (command "layer" "m" "solid" "")
        (command "pline"
                 (list x (+ y(* 0.5 d)))
                 (list x (- y(* 0.5 d)))
                 (list (+ x l) (- y(* 0.5 d )))
                 (list (+ x l) (+ y(* 0.5 d )))
                 "c")
        (command "layer" "m" "cen" "")
        (command "line"(polar p pi 10)(polar p 0 (+ l 10)) "")
    )
    )
  (unload_dialog id)
  (princ)
)
加载后显示“参数太少”,我对照了很多遍,都没有发现问题,而且dcl、sld文件都在相应位置,烦请各位指点啊!
发表于 2011-3-25 17:55 | 显示全部楼层
回复 盛麒毓 的帖子

(defun c:shaft(/d l x y id std x1 y1)
==>
(defun c:shaft(/ d l x y id std x1 y1)
发表于 2011-3-25 20:08 | 显示全部楼层
呵呵,最基础的东西,最容易被人忽视。
 楼主| 发表于 2011-3-26 09:41 | 显示全部楼层
谢谢版主,问题解决了,刚开始学,还都不懂的
 楼主| 发表于 2011-3-26 09:44 | 显示全部楼层
回复 Gu_xl 的帖子

谢谢版主,问题解决了,刚开始学,不太懂的。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-18 21:02 , Processed in 0.183862 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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