@Anonymous wrote:
The cube size is dependent on the random multiplier number and the distances from corner points gets in the scientific notation e6 or something like that.
Lets start with the cube first, now it creates solids and points but of different colors, no layers yet, no rotation on z axis for now.
Using @ronjonp's working code and an updated dialog

(defun c:Nebula ( / lm:rand dch lm:randrange a d ms p sp )
;; ronjonp | pbe | Lee Mac ;;
;; http://www.lee-mac.com/random.html
;; Rand - Lee Mac
;; PRNG implementing a linear congruential generator with
;; parameters derived from the book 'Numerical Recipes'
(defun lm:rand (/ a c m)
(setq m 4294967296.0
a 1664525.0
c 1013904223.0
$xn (rem (+ c
(* a
(cond ($xn)
((getvar 'date))
)
)
)
m
)
)
(/ $xn m)
)
(defun lm:randrange (a b) (+ (min a b) (fix (* (lm:rand) (1+ (abs (- a b)))))))
(or InitVal
(setq InitVal '(("size" "250000")
("dcnt" "2000")
("scnt" "100")
("srot" "0")
)
)
)
(foreach Var InitVal
(if (setq dflt (eval (read (car var))))
dflt (set (read (car var)) (cadr var))
)
)
(cond
( (<= (setq dch (load_dialog "Galaxy 2.0.dcl")) 0)
(princ "\nUnable to find/load Nebula.dcl file.")
)
( (not (new_dialog "Nebula" dch))
(princ "\nUnable to display dialog.")
)
( (set_tile "mine" (strcat (getvar 'loginname) "'s Galaxy"))
(foreach key '("size" "dcnt" "scnt" "srot")
(set_tile key (eval (read key)))
(action_tile key
(vl-prin1-to-string (quote
(set (read $key) (get_tile $key))
)
)
)
)
(mode_tile "srot" 1)
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq flag (start_dialog))
)
)
(if (< 0 dch) (unload_dialog dch))
(if (zerop flag)
(princ "\n<<< User cancelled >>>")
(progn
(setq ms (vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
)
(setq d (distof size))
(setq a (lm:randrange 1 (/ d 20.)));<-- we will do this later ;;
;; For now we are using 3DSolid ;;
(repeat (atoi scnt)
(setq p (list (lm:randrange (- d) d) (lm:randrange (- d) d) (lm:randrange (- d) d)))
(if (setq sp (vlax-invoke ms 'addsphere p (lm:randrange 1 a)))
(vla-put-color sp (lm:randrange 1 255))
)
)
(repeat (atoi dcnt)
(setq p (list (lm:randrange (- d) d) (lm:randrange (- d) d) (lm:randrange (- d) d)))
(entmake (list '(0 . "POINT") (cons 10 p) (cons 62 (lm:randrange 1 255))))
)
)
)
(princ)
)
DCL Code (to be saved as Galaxy 2.0.dcl):
dcl_settings : default_dcl_settings { audit_level = 3; }
ed : edit_box { fixed_width = true; width = 6; alignment = right;}
tx : text {alignment = left; height = 0.1;}
Nebula : dialog {
//label = "Create virtual galaxy";
key = "mine";
: boxed_column {
label = "Quantities of...";
: row {
: column {
spacer_0 ;
: tx { label = "\tGalaxy Size:" ; }
: tx { label = "\tDust particles:" ; }
: tx { label = "\tStars:" ; }
: tx { label = "\tStar axis rotation increment:" ; }
}
: column {
: ed { key = "size"; }
: ed { key = "dcnt"; }
: ed { key = "scnt"; }
: ed { key = "srot"; }
}
}
spacer ;
}//bc1
spacer_1;
ok_cancel;
}
@Anonymous wrote:
There is one particle application from the routine and that is to provide a visual idea of distance in space...by connecting points with a line and then use the 3d Orbit to inspect the line(s).
We will deal with that later, we need to know the requirements for the connection
HTH