你好,Marbenorallo,
只需添加如下路径:
- (defun c:test (/ fn fo pt)
- (if
- (and
- (setq fn "C:\\Documents and Settings\\Administrator\\My Documents\\My Coordinates\\Coordinates.txt")
- (setq fo (open fn "w")); (make "w" --> "a" and it will append
- ) ;_and
- (progn
- (while (setq pt (getpoint "\nPick Point: "))
- (write-line (apply 'strcat (mapcar 'strcat (mapcar 'rtos (trans pt 1 0)) '("," "," ""))) fo)
- ) ;_while
- (close fo)
- (startapp "notepad" fn)
- ) ;_progn
- ) ;_if
- (princ)
- ) ;_defun
记住“w”,它会使文件“coordinates.txt”在每次使用该程序时自动覆盖。
如果将其更改为“a”,则现有文件将保留,坐标将附加到文件中。
@李:希望你不要介意,我不想“踩到你的脚趾”(英语?)
请您向我/我们解释一下这一部分:
- (apply 'strcat (mapcar 'strcat (mapcar 'rtos (trans pt 1 0)) '("," ","
- "")))
Trans我只能理解两次“mapcar”和al的组合“,”。。。
我知道你用delimeters将其格式化为字符串,但我需要理解代码。 |