明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1682|回复: 6

请教各位,怎样每循环对话框得到的数据成一个表格式。在线等回答

[复制链接]
发表于 2007-6-7 14:49 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2007-6-7 14:56:34 编辑

我写的是这样的

(setq n 1)
 (setq nn (atof (get_tile "floor")))
(while (<= n nn)
   (if (> (setq dcl_id (load_dialog "support")) 0)
     (if (new_dialog "floor_height" dcl_id)
       (progn
  (set_tile "prompt1"
     (strcat "请输入第" (rtos n 2) "层高")
     )
  (action_tile "accept" "(GetData44) (done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq dlgans (start_dialog))
  (unload_dialog dcl_id)
       )
     )
   )
   (setq n (1+ n))
 )

nn是总共层数,现在我只能得到最后层高,每层高得不到,求各位帮我解答

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2007-6-7 19:05 | 显示全部楼层
  1. 不知道(GetData44)是怎么写的,主程序可以这样写:
  2. (if (> (setq dcl_id (load_dialog "support")) 0) (progn
  3.   (setq n 1)
  4.   (setq nn (atof (get_tile "floor")))
  5.   (while (and (<= n nn) (= dlgans 1))
  6.    (if (new_dialog "floor_height" dcl_id) (progn
  7.     (set_tile "prompt1" (strcat "请输入第" (rtos n 2) "层高"))
  8.     (action_tile "accept" "(GetData44) (done_dialog 1)")
  9.     (action_tile "cancel" "(done_dialog 0)")
  10.     (setq dlgans (start_dialog))
  11.    )
  12.     (princ "\nUnable display dialog box!")
  13.    )
  14.    (setq n (1+ n))
  15.   )
  16.   (unload_dialog dcl_id)
  17. )
  18.   (princ "\nUnable load dialog box!")
  19. )
 楼主| 发表于 2007-6-7 22:06 | 显示全部楼层
本帖最后由 作者 于 2007-6-7 22:08:05 编辑

谢谢ls的我忘了把GetData复制上来了是这样写的

(defun GetData44 ()
      (setq floor_height (get_tile "data"))
    )

问题是while循环只读取最后一次循环得值也就是floor_height只有我最后一次输入的层高数据,我要的是我每次循环写进去的层高数据都要,不知道怎么办了,谢谢帮我回答不胜感激

发表于 2007-6-7 22:25 | 显示全部楼层
  1. ;将数据放到表中。
  2. (if (> (setq dcl_id (load_dialog "support")) 0) (progn
  3.   (SETQ FHLIST (LIST));空表
  4.   (setq n 1)
  5.   (setq nn (atof (get_tile "floor")))
  6.   (while (and (<= n nn) (= dlgans 1))
  7.    (if (new_dialog "floor_height" dcl_id) (progn
  8.     (set_tile "prompt1" (strcat "请输入第" (rtos n 2) "层高"))
  9.     (action_tile "accept" "(GetData44) (done_dialog 1)")
  10.     (action_tile "cancel" "(done_dialog 0)")
  11.     (setq dlgans (start_dialog))
  12.    )
  13.     (princ "\nUnable display dialog box!")
  14.    )
  15.    (setq n (1+ n))
  16.   )
  17.   (unload_dialog dcl_id)
  18. )
  19.   (princ "\nUnable load dialog box!")
  20. )
  21. (defun GetData44 ()
  22.   (setq floor_height (get_tile "data"))
  23.   (SETQ FHLIST (APPEND FHLIST (LIST (STOR floor_height)))) ;加到表的未尾
  24. )
 楼主| 发表于 2007-6-8 00:03 | 显示全部楼层

请问

(SETQ FHLIST (APPEND FHLIST (LIST (STOR floor_height)))) ;加到表的未尾

这一句里的STOR变量是什么意思??谢谢斑竹阿

发表于 2007-6-8 07:49 | 显示全部楼层
本帖最后由 作者 于 2007-6-8 7:50:06 编辑

函数写错了!应该是ATOF,或者用函数READ也行。
 楼主| 发表于 2007-6-8 09:48 | 显示全部楼层
谢谢斑竹阿,有事在请问你
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-19 03:36 , Processed in 0.166416 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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