(prompt "\nLunar_phase simulation in ACAD - LUNAR_PHASE.LSP") (prompt "\nCommands: lunar_phase ") (prompt "\nFunctions: (SETUP_LUNARPHASE) ") (prompt "\nFunctions: ") (prompt "\n ") ;---------------------------------------------------------- ;Lunar phase simulation by AutoLISP ;;;By Takaya Iwamoto April 26, 2005 ;;;******************************************************** ;;; Copyright July 2006 Takaya Iwamoto ;;;******************************************************** ;;;LUNAR_PHASE.LSP ;;; ;;;Vport ID is very tricky ;;;The first split ;;; 4 3 ;;; 5 2 ;;;Then the next finer split follow the same rule Anti-Clock wise increment ;;;---------------------------------------- ;;; 4 | 10 9 ;;; 4 | 11 3 ;;;---------------------|------------------ ;;; 7 6 | 13 12 ;;; 8 5 | 14 2 ;;;---------------------------------------- ;;; ;;;lunar_phase ;;;main trial routine (defun c:lunar_phase() (setup_LUNARPHASE) ;setup parameters (split_vports) ;split vports (select_moon) ;select moon's ID for each view port (reset_sysvar) );TEST ;;; ;;;SETUP_LUNARPHASE ;;;setup for Lunar Phase simulation display (defun setup_lunarphase() (setup_sysvar) (setvar "SURFTAB1" 36) (setvar "SURFTAB2" 36) (setvar "FACETRES" 10) (setvar "PDMODE" 32) (command "_.point" '(0 0 0)) (setq lower_left '(-11 -11) upper_right '(11 11) Big_rad 10.0 Moon_rad 1.0 half_pi (* 0.5 pi) sixth_pi (/ pi 6.) ndiv 12 step 0 point_id 0 ) (repeat ndiv (setq theta (+ half_pi (* step sixth_pi)) moon_pos (list (* Big_rad (cos theta)) (* Big_rad (sin theta)) 0.) ) (set (read (strcat "pnt_" (itoa point_id))) moon_pos) (set (read (strcat "moon_" (itoa point_id))) moon_id) (command "_.Sphere" moon_pos Moon_rad) (setq moon_id (entlast)) (setq step (1+ step) point_id (1+ point_id) ) );;;end of repeat loop (command "_.zoom" "_Window" lower_left upper_right) ;(command "_.shade") (command "_.regen") );SETUP_LUNARPHASE ;;; ;;; (defun split_vports() ;;;split into 4 view ports ;(command "_.vports" 4 "Equal") (command "_.vports" 4 ) (command "_.regen") ;;;split vport #5 into 4 equal windows (setvar "CVPORT" 5) ;(command "_.vports" 4 "Equal") (command "_.vports" 4 ) ;;;split vport #3 into 4 equal windows (setvar "CVPORT" 3) ;(command "_.vports" 4 "Equal") (command "_.vports" 4 ) ;;;split vport #2 into 4 equal windows (setvar "CVPORT" 2) ;(command "_.vports" 4 "Equal") (command "_.vports" 4 ) );;;SPLIT_VPORTS ;;; ;;; ;;;SELECT_MOON ;;;Select a single moon for each view port (defun select_moon( ) ;;;**** 1-st 4 phases **** ;;;start from View Port #10 laterally (setvar "CVPORT" 10) (command "_.vpoint" pnt_6) (command "_.zoom" "_Object" moon_0 "") ;;;next : View Port #9 (setvar "CVPORT" 9) (command "_.vpoint" pnt_7) (command "_.zoom" "_Object" moon_1 "") ;;;next : View Port #11 (setvar "CVPORT" 11) (command "_.vpoint" pnt_8) (command "_.zoom" "_Object" moon_2 "") ;;;next : View Port #3 (setvar "CVPORT" 3) (command "_.vpoint" pnt_9) (command "_.zoom" "_Object" moon_3 "") ;;;******** 2-nd 4 phases ******** ;;;next : View Port #7 (setvar "CVPORT" 7) (command "_.vpoint" pnt_10) (command "_.zoom" "_Object" moon_4 "") ;;;next : View Port #6 (setvar "CVPORT" 6) (command "_.vpoint" pnt_11) (command "_.zoom" "_Object" moon_5 "") ;;;next : View Port #13 (setvar "CVPORT" 13) (command "_.vpoint" pnt_0) (command "_.zoom" "_Object" moon_6 "") ;;;next : View Port #12 (setvar "CVPORT" 12) (command "_.vpoint" pnt_1) (command "_.zoom" "_Object" moon_7 "") ;;;******** 3-rd 4 phases ******** ;;;next : View Port #8 (setvar "CVPORT" 8) (command "_.vpoint" pnt_2) (command "_.zoom" "_Object" moon_8 "") ;;;next : View Port #5 (setvar "CVPORT" 5) (command "_.vpoint" pnt_3) (command "_.zoom" "_Object" moon_9 "") ;;;next : View Port #14 (setvar "CVPORT" 14) (command "_.vpoint" pnt_4) (command "_.zoom" "_Object" moon_10 "") ;;;next : View Port #2 (setvar "CVPORT" 2) (command "_.vpoint" pnt_5) (command "_.zoom" "_Object" moon_11 "") );SELECT_MOON ;;; (princ)