(prompt "\nFractal by AutoCAD - BLANCMANGE.LSP") (prompt "\nCommands: Blancmange ") (prompt "\n ") ;---------------------------------------------------------- ;; David Tall used this curve to illustrate the idea of a mathematical ;; curve which has no definite derivative at any points. ;; Robert Dixon p 175 ;fractal function blancmange ;;; ;;;****BLANCMANGE.LSP ;;;main ;;; (defun c:blancmange() (setup_blancmange) (while (= (Yes_or_No "Go to next step ?") "_Y") (make_blancmange) );;;end of while loop (reset_sysvar) );;BLANCMANGE ;;; (defun setup_blancmange() (setup_sysvar) (setvar "OSMODE" 0) ;;;no snap mode (setq lower_left '(-0.1 -0.1) upper_right '(1.1 1.0) ) (make_line_1 "0" 8 '(0 0) '(1 0)) (command "_.zoom" "W" lower_left upper_right) (setq h_ratio (getreal "Input height ratio (default = 0.375) :")) (terpri) (if (= h_ratio nil) (setq h_ratio 0.375)) (make_blancmange) (alert "\nThis is the basic pattern") ) ;; ;;; (defun make_blancmange(/ line_set n index pnt1 pnt2 x1 x2 y1 y2 del_x mid_pnt_x mid_pnt_y mid_pnt ent_list) (setq line_set (ssget "X" (list (cons 0 "line"))) ) (setq n (sslength line_set)) (setq index 0) (repeat n ; loop for all line entities (setq ent_list (entget (ssname line_set index)) pnt1 (cdr (assoc 10 ent_list)) pnt2 (cdr (assoc 11 ent_list)) x1 (car pnt1) y1 (cadr pnt1) x2 (car pnt2) y2 (cadr pnt2) del_x (- x2 x1) mid_pnt_x (/ (+ x1 x2) 2) mid_pnt_y (+ (/ (+ y1 y2) 2) (* del_x h_ratio)) mid_pnt (list mid_pnt_x mid_pnt_y) ) (command "_.line" pnt1 mid_pnt pnt2 "") (entdel (ssname line_set index)) (setq index (1+ index)) ) (prin1 index)(terpri) ;number of line segments ) ;;;