备注:我认为他/她想说,用lisp从圈到甜甜圈很好,但他/她需要相反的过程。
@比恩达:当OverKill成为ExpressTool的一部分时,它用来将“甜甜圈”转换成圆圈,但现在不再了(2014年没有了。我没有2013年的测试)。
^^^^这应该是你的线程的名称^^^^
试试这个:
- (defun c:test ( / file_name open_file selected_donuts
- center_ocs center_wcs
- donut_elist index
- first_point second_point z_value normal)
- (if
- (and
- (setq file_name (getfiled "Save text file" (getvar 'dwgprefix) "txt" 1))
- (setq selected_donuts (ssget
- '((0 . "LWPOLYLINE")
- ;;; (8 . "0") ; add layer filter
- (90 . 2)
- (70 . 1)
- (-4 . "=")
- (42 . 1)
- )
- )
- )
- (setq index 0)
- )
- (progn
- (setq open_file (open file_name "w"))
- (repeat (sslength selected_donuts)
- (setq donut_elist (entget (ssname selected_donuts index))
- normal (cdr (assoc 210 donut_elist))
- z_value (cdr (assoc 38 donut_elist))
- first_point (cdr (assoc 10 donut_elist))
- second_point (cdr (assoc 10 (reverse donut_elist)))
- center_OCS (mapcar '(lambda (a b) (/ (+ a b) 2.0)) first_point second_point)
- center_WCS (trans (append center_OCS (list z_value)) normal 0)
- index (1+ index)
- )
- (princ (rtos (car center_WCS) 2 (getvar 'luprec)) open_file); x position
- (princ "\t" open_file)
- (princ (rtos (cadr center_WCS) 2 (getvar 'luprec)) open_file); y position
- ;;; (princ "\t" open_file)
- ;;; (princ (rtos (caddr center_WCS) 2 (getvar 'luprec)) open_file); z position
- (princ "\n" open_file)
- )
- (startapp "notepad" file_name)
- (close open_file)
- )
- )
- (princ)
- )
|