若想输出曲线上的点(不一定是控制点),有一个比较好的办法,先用定数(或定距)等分的方法作出曲线上的点,然后将这些点导出即可。
下面这个是我以前写的一个将点保存到文本文件中去的程序。(程序功能没有完善)
(defun C:POINTtofile (/ ffn ff pz ss leng index b1 tc ty xy x y z) (setvar "osmode" 0) (princ "程序功能:将点(POINT对象)的坐标写入文本文件") (setq ffn (getfiled "保存点(POINT对象)坐标到文本文件" "" "txt" 1)) (setq ff (open ffn "w")) (setq pz (getvar "osmode")) (SETQ KDSS (STRCAT "\n需要将Z值写入文件吗?<Y/N>(N)")) (setq hd (strcase (getstring kdss))) (setq ss (ssget)) (setq leng (sslength ss)) (setq index 0) (setvar "CMDECHO" 0) (REPEAT leng (setq b1 (entget (ssname ss index))) (setq tc (assoc 0 b1)) (setq ty (ssname ss index)) (setq index (+ index 1)) (cond ((= (cdr TC) "POINT") (setq xy (cdr (assoc 10 b1))) (setq x (car xy)) (setq y (cadr xy)) (setq z (caddr xy)) (princ x ff) (princ " " ff) (princ y ff)
(if (= hd "Y") (progn (princ " " ff) (princ z ff)
) )
(princ "\n" ff) ) ) ) (princ "\n" ff) (close ff) (setvar "osmode" pz) (setvar "cmdecho" 1) (princ) ) |