我写了一个,不过测出的坐标跟你的图不对应。你的图上的坐标自己标的?不对应CAD的坐标系 - (defun c:cs(/ X YH_BO YH_FILE YH_LE YH_PT1 YH_PTL)
- (vl-load-com)
- (command)
- (setq YH_pt1 (getpoint "\n选择空内部点或者右键选择孔边界:"))
- (if YH_pt1
- (progn
- (setq YH_le (entlast)
- YH_ptl '()
- )
- (command "boundary" "a" "i" "n" "" "" YH_pt1 "")
- (setq YH_bo (entlast))
- (if (eq YH_le YH_bo)
- (alert "错误,所选区域不封闭!")
- (progn
- (mapcar '(lambda (x) (if (= (car x) 10) (setq YH_ptl (append YH_ptl (list (cdr x)))))) (entget YH_bo))
- (setq YH_file (open "C:\\1.txt" "W"))
- (mapcar '(lambda (x) (write-line (strcat "X" (rtos (car X)) "Y" (rtos (cadr X))) YH_file)) YH_ptl)
- (close YH_file)
- (startapp "notepad" "C:\\1.txt")
- (entdel YH_bo)
- )
- )
- )
- (alert "此功能未完成")
- )
- )
|