我只是为了好玩才放在一起的
为什么不让它尽可能多地做呢。
这将绘制到每个顶点的线,并生成一个以逗号分隔的文件,名为lineinfo。txt位于“C:\”
运行程序后,打开excel并导入txt文件。
-
- (defun c:mklns (/ pt1 ss ent lsttxt txlst ff)
- (setq pt1 (getpoint "Pick The Point"));_base point
- (setq ss (ssget '((0 . "LWPOLYLINE"))));_polyline object
- (if ss
- (progn
- (setq ent (entget(ssname ss 0)));_entity info for poly object
- (foreach item ent
- (if (= (car item) 10)
- (progn
- (command "pline" pt1 (cdr item) "");_draw lines
- (setq lsttxt (strcat ;_make comma seperated list of length and angle
- (rtos(distance pt1 (cdr item)))
- ","
- (angtos (angle pt1 (cdr item))0 4)
- );_strcat
- );_setq
- (setq txlst (cons lsttxt txlst));_compiled list of all line length and angles
- );_progn
- );_if
- );_foreach
- (setq ff (open "C:/LineInfo.txt" "w"));_write to file
- (foreach item txlst
- (write-line item ff)
- );_foreach
- (close ff)
- );_progn
- (alert "No Polyline Object Selected")
- );_if
- );_defun
|