;-------------------------------------------------------------------; ; Fractal by Paul Silva ; ; wpaulsilva@hotmail.com ; ; This routine selects lines and breaks them into 3 equal lengths. ; ; The middle length is erased and replaced by two other lines with ; ; a 60 degree inclination forming a triangle. Once finished, repeat ; ; routine to continue with the same procedure, doing a fractal. ; ; It is best if you have a polygon or some symmetrical shapes. ; ; All polylines must be exploded into line segments. ; ;-------------------------------------------------------------------; (defun c:Fractal () (setq ss (ssget '((-4 . "")))) (setq ns (sslength ss)) (setq n 0) (while (< n ns) (setq workent (ssname ss n)) (setq blocki (entget workent)) (setq p1 (cdr (assoc 10 blocki))) (setq p2 (cdr (assoc 11 blocki))) (setq an1 (angle p1 p2)) (setq an2 (+ an1 (/ pi 3))) (setq wdist (distance p1 p2)) (setq segment (/ wdist 3)) (setq f1 (polar p1 an1 segment)) (setq f2 (polar f1 an2 segment)) (setq f3 (polar p1 an1 (* segment 2))) (command "line" p1 f1 "") (command "line" f1 f2 "") (command "line" f2 f3 "") (command "line" f3 p2 "") (command "erase" workent "") (setq n (+ n 1)) );end of while (princ) );end of defun