- (defun setcolor(sname color / sinf)
- (setq sinf (entget sname))
- (if (assoc 62 sinf)
- (setq sinf (subst (cons 62 color) (assoc 62 sinf) sinf))
- (setq sinf (append sinf (list (cons 62 color))))
- )
- (entmod sinf)
- )
- (defun draw(pt flag /)
- (command "_.circle" pt 0.9)
- (if flag
- (setcolor (entlast) 1)
- (setcolor (entlast) 2)
- )
- )
- (defun c:test(/ ss i ent entv pt_s pt_e pts pt)
- (setq ss (ssget '((0 . "*polyline"))))
- (setq os (getvar "osmode"))
- (setq cmd (getvar "cmdecho"))
- (command "_.undo" "be")
- (setvar "osmode" 0)
- (setvar "cmdecho" 0)
- (setq i 0)
- (repeat (sslength ss)
- (setq ent (ssname ss i))
- (setq entv (vlax-ename->vla-object ent))
- (setq pt_s (vlax-curve-getStartPoint entv))
- (setq pt_e (vlax-curve-getEndPoint entv))
- (setq pts (append pts (list pt_s pt_e)))
- (setq i (1+ i))
- )
- (setq i 0)
- (while (< 0 (length pts))
- (setq pt (car pts))
- (setq pts (cdr pts))
- (if (equal pts (setq pts (vl-remove pt pts)))
- (Draw pt nil)
- (Draw pt t)
- )
- )
- (command "_.undo" "e")
- (setvar "osmode" os)
- (setvar "cmdecho" cmd)
- (princ)
- )
|