- (defun c:test( / f str pts pts2 ptm1 ptm2 ptc ang)
- (setq f (open "e:\\a.txt" "r"))
- (while (setq str (read-line f))
- (setq str (vl-string-translate "," " " str))
- (setq str (read (strcat "(" str ")")))
- (setq pts (append pts (list (cddr str))))
- )
- (close f)
- (setq pts2 (mapcar '(lambda(e1 e2) (list (distance e1 e2) e1 e2)) (reverse (cdr (reverse pts))) (cdr pts)))
- (setq pts2 (vl-sort pts2 '(lambda(e1 e2) (> (car e1) (car e2)))))
- (command "_.line")
- (mapcar 'command pts)
- (command "")
- (setq ptm1 (cadar pts2) ptm2 (caddar pts2))
- (setq ptc (mapcar '(lambda(e1 e2) (/ (+ e1 e2) 2)) ptm1 ptm2))
- (setq ang (angle ptm1 ptm2))
- (command "_.text" ptc "" (angtos ang) "bm1001")
- (princ)
- )
|