我自己写的第一个LSP程序,加载后运行DZB,然后点取需要的坐标点,能输出该点的XYZ坐标,但还不会自定义输出文件,学习中 (defun c:dzb() (graphscr) (setvar "osmode" 16255) (princ "\n开始点取等高线上的坐标点:") (setq a1 1) (setq count 1) (setq Fn (getstring T "请输入文件名:")) (setq Fname(strcat "f:\\" fn ".txt")) (setq file1 (open Fname "a")) (while (> count 0) (setq p0 (getpoint "\n点取等高线上的点:")) (setq x1 (car p0) y1 (cadr p0) z1 (caddr p0) ) (setq count z1) (setq str1 (strcat (itoa a1) "," " " "," (rtos x1 2 3) "," (rtos y1 2 3) "," (rtos z1 2 3) ) ) (write-line str1 file1) (setq a1 (1+ a1)) ) (close fp1) ) |