(prompt "\nEarth Model in ACAD - EARTH_MODEL.LSP") (prompt "\nCommands: VIEW_RANGE ") (prompt "\nFunctions: (SETUP_EARTH) (SPLIT_VPORTS) (HEIGHT_INPUT)") (prompt "\nFunctions: ") (prompt "\n ") ;---------------------------------------------------------- ;;;How to measure the distance to the Horizon ;;;By Takaya Iwamoto May 10, 2005 ;;;******************************************************** ;;; Copyright JUly 2006 Takaya Iwamoto ;;;******************************************************** ;;;EARTH_MODEL.LSP ;;; ;;; ;;;TEST ;;;main trial routine (defun c:View_range() (setup_Earth) ;setup parameters (split_vports) ;SPlit into 3 view ports (height_input) ;Input the viewer's elevation (reset_sysvar) );TEST ;;; ;;;SETUP_EARTH ;;;setup for EARTH Model for estimating distance to the Horizon (defun setup_EARTH() (setup_sysvar) (setvar "PDMODE" 32) (command "_.viewres" "_Y" 20000) ;;;Maximum resolution setting for ACAD (setq sun_rad 6.95e5 moon_rad 1.734e3 Earth_rad 6.378e3 sun_dist 1.496e8 moon_dist 3.844e5 moon_ctr '(0 0 0) sun_ctr (list sun_dist 0 0) earth_ctr (list 0 0) building_height 0.381 ;;in kilometer building_base (list 0 Earth_rad) obs_point (list 0 (+ Earth_rad 1.0)) Other_side (list 0 (- Earth_rad)) ) (make_pt "0" 5 earth_ctr) (mAKE_PT "0" 1 building_base) (setq base_pt (entlast)) (make_circle_1 "0" 5 earth_ctr earth_rad) (setq earth (entlast)) (make_line_1 "0" 8 other_side building_base) (make_line_1 "0" 8 building_base obs_point) (setq viewer (entlast)) (command "_.zoom" "_EXTENT" ) ;(command "_.shade") (command "_.regen") );SETUP_EARTH ;;; ;;; (defun split_vports() ;;;split into 3 view ports (command "_.vports" 3 "_Above") (setvar "CVPORT" 2) ;;;Building_base (command "_.zoom" "_Object" base_pt "") (command "_.regen") (setvar "CVPORT" 3) (command "_.zoom" "_Object" Earth "") ;;;Whole Earth (command "_.regen") (TEXTDISPLAY "Earth" '(-2900. -500) 1700. 0. ) (setvar "CVPORT" 4) ;;;Building_base (command "_.zoom" "_Object" viewer "") (command "_.regen") ) ;;; ;;;HEIGTH_INPUT ;;;Input the elevation of the viewer in meter instead of kilometer (defun height_input( ) (setq height (getreal "\nInput the elevation of the viewer in meter (def=381)") ) (if (= height nil) (setq height 381.)) (setq obs_pnt (list 0 (+ earth_rad (/ height 1000.))) ) (make_pt "0" 2 obs_pnt) (make_line_1 "0" 1 building_base obs_pnt) ;;;compute the exact values and output it to the text window (setq exact (sqrt (* (/ height 1000.) (+ (/ height 1000.) (* 2. Earth_rad))) )) (setq result (strcat "view range is: " (rtos exact 2 3) " kilometer") ) (princ result)(terpri) );HEIGHT_INPUT ;;; (princ)