Tharwat 发表于 2022-7-6 10:52:45

拾取aut的其余点

大家好。
 
(setq points (getint"\n Nos. of X Points: ") ;; <--- any number of points
   Dist (getint"\nLength of Distance: ");; <--- any length
   start (getpoint"\nSpecify the start point:")
   )

(setq pt1........
pt2..........
pt3........... and so on
 
当做

MSasu 发表于 2022-7-6 11:07:46

我会把它们列在一个列表中。如果您为每个点定义变量,那么尝试访问每个点将非常有趣。
 
 
如。
(setq theIndex 1)
(repeat points
(set (read (strcat "pt" (itoa theIndex))) (getpoint (strcat "\nIndicate point " (itoa theIndex) ": ")))
(setq theIndex (1+ theIndex))
)

alanjt 发表于 2022-7-6 11:19:33

非常感谢msasu
 
但我用以下代码进行了尝试。。。它给了我一个错误来修复NUMP???
(defun test (/ num dist lst pt)
(initget 6)
(if (and (setq num (getint "\nSpecify number of X points: "))
          (not (initget 6))
          (setq dist (getdist "\nSpecify distance: "))
          (car (setq lst (list (getpoint "\nSpecify first point: "))))
   )
   (progn
   (while (> num (length lst))
       (if (setq pt (getpoint
                      (car lst)
                      (strcat "\n"
                              (itoa (- num (length lst)))
                              " point(s) left.\nSpecify next point: "
                      )
                  )
         )
         (grdraw (cadr (setq lst (cons pt lst))) pt 3 1)
       )
   )
   (redraw)
   (reverse lst)
   )
)
)
 
有完整的例子吗?
 
忠实的
塔瓦特

Tharwat 发表于 2022-7-6 11:26:14

代码应该如下所示:
 
(defun c:qq (/ theindex points)
(setq theIndex (getint"\n Nos. of X Points: "))
(repeat points
(set (read (strcat "pt" (itoa theIndex)))
   (getpoint (strcat "\nIndicate point " (itoa theIndex) ": ")))
(setq theIndex (1+ theIndex))
))
 
当做

MSasu 发表于 2022-7-6 11:41:15

当然,@alanjt建议的方法非常用户友好(我的意思是程序员友好)。。。
 
当做

MSasu 发表于 2022-7-6 11:45:13

谢谢msasu。

alanjt 发表于 2022-7-6 11:58:37

页: [1]
查看完整版本: 拾取aut的其余点