可能这对您有帮助(仅适用于3DPOLYLINES)
- (defun c:3dexport (/ *error* file sset pnt ssnm i vn omit )
- (defun *error* (msg)
- (if file (close file))
- (cond
- ((not msg))
- ((member msg '("Function cancelled" "quit / exit abort")))
- ((princ (strcat "\nError:" msg)))
- )
- (princ)
- )
- (if (setq sset (ssget "_:L" '((0 . "POLYLINE"))))
- (progn
- (if (setq file (open [color="red"](getfiled "File to Save" "C:\" "csv" 1)[/color] "w"))
- (progn
- (write-line (strcat "Point No." "," "X" "," "Y" "," "Z") File)
- (setq pnt 1)
- (_Layer "Point_Text" 2)
- (repeat (setq i(sslength sset ))
- (setq ssnm(ssname sset (setq i(1- i))))
- (setq vn (entnext ssnm))
- (while (/= "SEQEND" (cdr (assoc 0 (entget vn))))
- (setq pts(cdr (assoc 10 (entget vn))))
- (_MakeText pts (rtos pnt 2 0) (getvar 'DIMSCALE) (Getvar 'TEXTSTYLE) "Point_Text")
- (setq omit (strcat (rtos pnt 2 0) ","(rtos (car pts) 2 4) "," (rtos (cadr pts) 2 4) "," (rtos (caddr pts) 2 4)))
- (write-line omit file)
- (setq vn(entnext vn))
- (setq pnt(1+ pnt))
- )
-
- )
- (close file)
-
- )
-
- )
- )
- (*error* "Nothing Seleted:")
- )
- (*error* nil)
- (princ)
- )
-
- (defun _MakeTExt(point name ht style layer)
- (entmake (list (cons 0 "TEXT")
- (cons 10 Point)
- (cons 1 name)
- (cons 40 ht)
- (cons 7 style)
- (cons 8 layer)
- )
- )
- )
- (defun _layer(name col)
- (if (not (Tblsearch "LAYER" name))
- (command "_LAYER" "n" name "c" col name "")
- (command "_LAYER" "t" name "ON" name "c" col name "")
- )
- )
|