;;---------------------------------------------------------------------------;; ;; ;; ;; iceray grammar using nitros ;; ;; by haldane liew ;; ;; ;; ;; 2003.03.31 ;; ;; ;; ;;---------------------------------------------------------------------------;; ;;---------------------------------------------------------------------------;; ;; ;; ;; set up the drawing ;; ;; ;; ;;---------------------------------------------------------------------------;; (command "osnap" "none") (command "layer" "make" "polygon" "color" "yellow" "polygon" "") (command "layer" "make" "numbers" "color" "red" "numbers" "") (command "layer" "set" "polygon" "") (setq *DEBUG* nil) ;;---------------------------------------------------------------------------;; ;; ;; ;; AUXILARY FUNCTIONS ;; ;; ;; ;;---------------------------------------------------------------------------;; ;; ;; ;; utility to print out the value of a symbol ;; ;; ;; (defun debug (symbol) (if *DEBUG* (progn (print) (princ symbol) (princ " = ") (prin1 (eval symbol)) ) ) ) ;;---------------------------------------------------------------------------;; ;; draws a polygon ;; ;; pointslist is a list of xy points ;; ;; ie '( (0 0) (1 0) (1 1) (0 1)) ;; ;;---------------------------------------------------------------------------;; (defun draw_polygon (pointslist / argument_list) (setq argument_list (append (list "pline") pointslist (list "c"))) (apply 'command argument_list) ) ;;---------------------------------------------------------------------------;; ;; function to find a point between pta and ptb at percent from pta ;; ;; pta = (0 0), ptb = (0 1), percent = [0 1] ;; ;;---------------------------------------------------------------------------;; (defun between_points_percent (pta ptb percent / pta-x pta-y ptb-x ptb-y return) (setq pta-x (car pta) pta-y (cadr pta) ptb-x (car ptb) ptb-y (cadr ptb) ) (setq return (list (+ pta-x (* (- ptb-x pta-x) percent)) (+ pta-y (* (- ptb-y pta-y) percent)) ) ) return ) ;;---------------------------------------------------------------------------;; ;; function to find a point between pta and ptb at distance from pta ;; ;; pta = (0 0), ptb = (0 1), distance = 1.0 ;; ;;---------------------------------------------------------------------------;; (defun between_points_distance (pta ptb dist / percentage) (setq percentage (/ (float dist) (distance pta ptb))) (setq return (between_points_percent pta ptb percentage)) return ) ;;---------------------------------------------------------------------------;; ;; find the angle of a line relative to the current ucs in degrees ;; ;;---------------------------------------------------------------------------;; (defun angle_degrees (pt1 pt2) (rad->deg (angle pt1 pt2)) ) ;;---------------------------------------------------------------------------;; ;; function to convert radians to degrees ;; ;;---------------------------------------------------------------------------;; (defun rad->deg (radians) (* 180.0 (/ radians pi)) ) ;;---------------------------------------------------------------------------;; ;; function to convert degrees to radians ;; ;;---------------------------------------------------------------------------;; (defun deg->rad (degrees) (* pi (/ degrees 180.0)) ) ;;---------------------------------------------------------------------------;; ;; shift a list "num" units to the right ;; ;; ie: '(a b c d) -> '(d a b c) ;; ;;---------------------------------------------------------------------------;; (defun shift-right (num alist) (repeat num (setq alist (append (cdr alist) (list (car alist)))) ) ) ;;---------------------------------------------------------------------------;; ;; generic function to split a polygon ;; ;; ;; ;; pointslist = list of points of the polygon in order (list of points) ;; ;; start_side = which side to start the cut [1 - npoly] ;; ;; start_point = where to start the cut on the start side (%) ;; ;; end_side = which side to end the cut [1 - npoly] ;; ;; end_point = where to end the cut on the end side (%) ;; ;; gap_size = how big is the gap (absolute distance) ;; ;; ;; ;; AB = first and second point of START side ;; ;; QR = cut points on the START side ;; ;; M = center point on START side ;; ;; CD = first and second point of END side ;; ;; ST = cut points on the END side ;; ;; N = center point on END side ;; ;; ;; ;; example ;; ;; side 3 ;; ;; D----T--N--S----C ;; ;; | | | ;; ;; side 4 | | | side 2 ;; ;; | | | ;; ;; | | | ;; ;; A----Q--M--R----B ;; ;; side 1 ;; ;;---------------------------------------------------------------------------;; (defun split_polygon (pointslist start_side start_point end_side end_point gap_size / pta ptb ptc ptd ptm ptn polygon-a polygon-b rest distance-qm distance-sn angle-mn angle-cd num-sides num-sides-remain theta theta2 temp ) (if (not (or (> start_side (length pointslist)) (< start_side 0) (> end_side (length pointslist)) (< end_side 0) ) ) (progn ;; swap start and end side numbers if end < start ;; (if (< end_side start_side) (progn (setq temp end_side) (setq end_side start_side) (setq start_side temp) (setq temp start_point) (setq start_point end_point) (setq end_point temp) ) ) ;; modify side numbers so that start_side is 1 ;; (if (not (= start_side 1)) (progn (setq dif (- start_side 1)) (setq start_side (- start_side dif)) (setq end_side (- end_side dif)) (setq pointslist (shift-right dif pointslist)) ) ) ;; calculate points for start_side ;; (debug 'start_point) (setq pta (nth (- start_side 1) pointslist)) (debug 'pta) (setq ptb (nth (if (= start_side (length pointslist)) 0 start_side ) pointslist ) ) (debug 'ptb) ;; ptm is the point between pta & ptb ;; (setq ptm (between_points_percent pta ptb start_point)) (debug 'ptm) ;; calculate points for end_side ;; (setq ptc (nth (- end_side 1) pointslist)) (debug 'ptc) (setq ptd (nth (if (= end_side (length pointslist)) 0 end_side ) pointslist ) ) (debug 'ptd) ;; ptn is the point between pta & ptb ;; (setq ptn (between_points_percent ptc ptd end_point)) (debug 'ptn) ;; find the angles between the lines and from that calculate the ;; ;; distance along the line. ;; ;; theta = (90 - angle of side - angle of bisect line) ;; (setq angle-mn (angle_degrees ptm ptn)) (debug 'angle-mn) (setq angle-ab (angle_degrees pta ptb)) (debug 'angle-ab) (setq theta (+ (- 90 angle-mn) angle-ab)) (debug 'theta) (setq gap_size (* 0.5 gap_size)) ;; distance = (gap size / cos theta) ;; (setq distance-qm (abs (/ gap_size (cos (deg->rad theta))))) (debug 'distance-qm) (setq ptq (between_points_distance ptm pta distance-qm)) (debug 'ptq) (setq ptr (between_points_distance ptm ptb distance-qm)) (debug 'ptr) (setq angle-cd (angle_degrees ptc ptd)) (debug 'angle-cd) (setq theta2 (+ (- 90 angle-mn) angle-cd)) (debug 'theta2) (setq distance-sn (abs (/ gap_size (cos (deg->rad theta2))))) (debug 'distance-sn) (setq pts (between_points_distance ptn ptc distance-sn)) (debug 'pts) (setq ptt (between_points_distance ptn ptd distance-sn)) (debug 'ptt) ;; figure out polygon a ;; (setq polygon-a (list pta ptq ptt)) (setq num-sides (- (+ 4 (length pointslist)) (+ start_side end_side)) ) (debug 'num-sides) (setq rest nil) (debug 'pointslist) (if (> num-sides 3) (setq rest (member ptd pointslist)) ) (debug 'rest) (setq polygon-a (append polygon-a rest)) (debug 'polygon-a) ;; figure out polygon b ;; (setq polygon-b (list ptc pts ptr)) (setq num-sides-remain (- (+ 4 (length pointslist)) num-sides)) (debug 'num-sides-remain) (setq rest nil) (if (> num-sides-remain 3) (progn (setq rest (member ptb pointslist)) (setq i 0) (debug '(- num-sides-remain 3)) (repeat (- num-sides-remain 3) (setq polygon-b (append polygon-b (list (nth i rest)))) (setq i (1+ i)) ) ) ) (debug 'rest) (debug 'polygon-b) ;; returns a list of ordered points for two polygons ;; (list polygon-a polygon-b) ) ;; else return an error message ;; (print "ERROR: start_side or end_side is out of bounds") ) ) ;; test cases ;; ;;;(print ;;; (split_polygon ;;; (list (list 0 0) (list 10 0) (list 10 10) (list 0 10)) ;;; 1 ;;; 0.5 ;;; 3 ;;; 0.5 ;;; 1 ;;; ) ;;;) ;;; ;;;(print ;;; (split_polygon ;;; (list (list 0 0) (list 10 0) (list 10 10) (list 0 10)) ;;; 2 ;;; 0.5 ;;; 4 ;;; 0.5 ;;; 1 ;;; ) ;;;) ;;; ;;;(print ;;; (split_polygon ;;; (list (list 0 0) ;;; (list 10 0) ;;; (list 13.0902 9.5106) ;;; (list 5.0 15.3884) ;;; (list -3.0902 9.5106) ;;; ) ;;; 3 ;;; 0.5 ;;; 5 ;;; 0.5 ;;; 1 ;;; ) ;;;) ;;; ;;;(print ;;; (split_polygon ;;; (list (list 0 0) (list 100 0) (list 100 100)) ;;; 2 ;;; 0.5 ;;; 3 ;;; 0.5 ;;; 1 ;;; ) ;;;) ;;---------------------------------------------------------------------------;; ;; ;; ;; NITROS DEFINITIONS ;; ;; ;; ;;---------------------------------------------------------------------------;; ;;---------------------------------------------------------------------------;; ;; type declarations ;; ;;---------------------------------------------------------------------------;; ;;---------------------------------------------------------------------------;; ;; defines a rectangle frame ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray_rectangle_frame" 'iceray_rectangle_frame '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("width" . 100) ("height" . 50) ) ) ;;---------------------------------------------------------------------------;; ;; defines a rectangle inital shape ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray_rectangle_initial_shape" 'iceray_rectangle_initial_shape '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("width" . 100) ("height" . 50) ) ) ;;---------------------------------------------------------------------------;; ;; initial rectangle shape with frame ;; ;;---------------------------------------------------------------------------;; (defun iceray_rectangle_initial_shape (xo yo zo rot gap width height / outer_frame_plist inner_frame_plist c1 c2 ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) (setq outer_frame_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "width" width) (cons "height" height) ) ) (setq inner_frame_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" gap) (cons "pt1y" gap) (cons "pt2x" (- width gap)) (cons "pt2y" gap) (cons "pt3x" (- width gap)) (cons "pt3y" (- height gap)) (cons "pt4x" gap) (cons "pt4y" (- height gap)) ) ) (setq c1 (list "iceray_rectangle_frame" nil outer_frame_plist)) (setq c2 (list "iceray_4sided" nil inner_frame_plist)) (nt_composit (list c1 c2)) ) (nt_add_seed_type "iceray_rectangle_initial_shape") ;;---------------------------------------------------------------------------;; ;; defines a generic 3-sided polygon ;; ;; ;; ;; /| ;; ;; / | ;; ;; 3 | ;; ;; / 2 ;; ;; / | ;; ;; +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray_3sided" 'iceray_3sided '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 100) ("pt2y" . 0) ("pt3x" . 100) ("pt3y" . 100) ) ) (nt_add_seed_type "iceray_3sided") ;;---------------------------------------------------------------------------;; ;; defines a generic 4-sided polygon ;; ;; ;; ;; +--3--+ ;; ;; | | ;; ;; 4 2 ;; ;; | | ;; ;; +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray_4sided" 'iceray_4sided '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 100) ("pt2y" . 0) ("pt3x" . 100) ("pt3y" . 100) ("pt4x" . 0) ("pt4y" . 100) ) ) (nt_add_seed_type "iceray_4sided") ;;---------------------------------------------------------------------------;; ;; defines a generic 5-sided polygon ;; ;; _ ;; ;; / \ ;; ;; / \ ;; ;; 4 3 ;; ;; / \ ;; ;; / \ ;; ;; \ / ;; ;; 5 2 ;; ;; \ / ;; ;; --1-- ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray_5sided" 'iceray_5sided '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 100) ("pt2y" . 0) ("pt3x" . 130.9017) ("pt3y" . 95.1057) ("pt4x" . 50) ("pt4y" . 153.8842) ("pt5x" . -30.9017) ("pt5y" . 95.1057) ) ) (nt_add_seed_type "iceray_5sided") ;;---------------------------------------------------------------------------;; ;; defines iceray : 3sided -> 3sided + 4sided ;; ;; ;; ;; /| /| ;; ;; / | / | ;; ;; 3 | 3 | ;; ;; / 2 -> / /2 ;; ;; / | / / | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:3->3+4:1-2" 'iceray:3->3+4:1-2 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("loc1" . 0.5) ("loc2" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 3sided -> 3sided + 4sided ;; ;; ;; ;; /| /| ;; ;; / | / | ;; ;; 3 | 3\ | ;; ;; / 2 -> / \2 ;; ;; / | / | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:3->3+4:2-3" 'iceray:3->3+4:2-3 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("loc2" . 0.5) ("loc3" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 3sided -> 3sided + 4sided ;; ;; ;; ;; /| /| ;; ;; / | / | ;; ;; 3 | 3 | ;; ;; / 2 -> /| 2 ;; ;; / | / | | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:3->3+4:3-1" 'iceray:3->3+4:3-1 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("loc1" . 0.5) ("loc3" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 4sided -> 4sided + 4sided ;; ;; ;; ;; +--3--+ +--3--+ ;; ;; | | | | | ;; ;; 4 2 -> 4 | 2 ;; ;; | | | | | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:4->4+4:1-3" 'iceray:4->4+4:1-3 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("pt4x" . 0) ("pt4y" . 10) ("loc1" . 0.5) ("loc3" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 4sided -> 4sided + 4sided ;; ;; ;; ;; +--3--+ +--3--+ ;; ;; | | | | ;; ;; 4 2 -> 4-----2 ;; ;; | | | | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:4->4+4:2-4" 'iceray:4->4+4:2-4 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("pt4x" . 0) ("pt4y" . 10) ("loc2" . 0.5) ("loc4" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 4sided -> 3sided + 5sided ;; ;; ;; ;; +--3--+ +--3--+ ;; ;; | | | | ;; ;; 4 2 -> 4 /2 ;; ;; | | | / | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:4->3+5:1-2" 'iceray:4->3+5:1-2 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("pt4x" . 0) ("pt4y" . 10) ("loc1" . 0.5) ("loc2" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 4sided -> 3sided + 5sided ;; ;; ;; ;; +--3--+ +--3--+ ;; ;; | | | \ | ;; ;; 4 2 -> 4 \2 ;; ;; | | | | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:4->3+5:2-3" 'iceray:4->3+5:2-3 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("pt4x" . 0) ("pt4y" . 10) ("loc2" . 0.5) ("loc3" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 4sided -> 3sided + 5sided ;; ;; ;; ;; +--3--+ +--3--+ ;; ;; | | | / | ;; ;; 4 2 -> 4/ 2 ;; ;; | | | | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:4->3+5:3-4" 'iceray:4->3+5:3-4 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("pt4x" . 0) ("pt4y" . 10) ("loc3" . 0.5) ("loc4" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 4sided -> 3sided + 5sided ;; ;; ;; ;; +--3--+ +--3--+ ;; ;; | | | | ;; ;; 4 2 -> 4\ 2 ;; ;; | | | \ | ;; ;; +--1--+ +--1--+ ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:4->3+5:4-1" 'iceray:4->3+5:4-1 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 10) ("pt3y" . 10) ("pt4x" . 0) ("pt4y" . 10) ("loc4" . 0.5) ("loc1" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 5sided -> 4sided + 5sided ;; ;; ;; ;; _ _ ;; ;; / \ / \ ;; ;; / \ / \ ;; ;; 4 3 4 3 ;; ;; / \ / / \ ;; ;; / \ -> / / \ ;; ;; \ / \ / / ;; ;; 5 2 5 / 2 ;; ;; \ / \ / / ;; ;; --1-- --1-- ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:5->4+5:1-3" 'iceray:5->4+5:1-3 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 13.0902) ("pt3y" . 9.5106) ("pt4x" . 5) ("pt4y" . 15.3884) ("pt5x" . -3.0902) ("pt5y" . 9.5106) ("loc1" . 0.5) ("loc3" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 5sided -> 4sided + 5sided ;; ;; ;; ;; _ _ ;; ;; / \ / \ ;; ;; / \ / \ ;; ;; 4 3 4 3 ;; ;; / \ / \ \ ;; ;; / \ -> / \ \ ;; ;; \ / \ \ / ;; ;; 5 2 5 \ 2 ;; ;; \ / \ \ / ;; ;; --1-- --1-- ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:5->4+5:1-4" 'iceray:5->4+5:1-4 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 13.0902) ("pt3y" . 9.5106) ("pt4x" . 5) ("pt4y" . 15.3884) ("pt5x" . -3.0902) ("pt5y" . 9.5106) ("loc1" . 0.5) ("loc4" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 5sided -> 4sided + 5sided ;; ;; ;; ;; _ _ ;; ;; / \ / \ ;; ;; / \ / \ ;; ;; 4 3 4 3 ;; ;; / \ / \ \ ;; ;; / \ -> / \ \ ;; ;; \ / \ \ / ;; ;; 5 2 5 \2 ;; ;; \ / \ / ;; ;; --1-- --1-- ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:5->4+5:2-4" 'iceray:5->4+5:2-4 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 13.0902) ("pt3y" . 9.5106) ("pt4x" . 5) ("pt4y" . 15.3884) ("pt5x" . -3.0902) ("pt5y" . 9.5106) ("loc2" . 0.5) ("loc4" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 5sided -> 4sided + 5sided ;; ;; ;; ;; _ _ ;; ;; / \ / \ ;; ;; / \ / \ ;; ;; 4 3 4 3 ;; ;; / \ / \ ;; ;; / \ -> / \ ;; ;; \ / \ / ;; ;; 5 2 5-------2 ;; ;; \ / \ / ;; ;; --1-- --1-- ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:5->4+5:2-5" 'iceray:5->4+5:2-5 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 13.0902) ("pt3y" . 9.5106) ("pt4x" . 5) ("pt4y" . 15.3884) ("pt5x" . -3.0902) ("pt5y" . 9.5106) ("loc2" . 0.5) ("loc5" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; defines iceray : 5sided -> 4sided + 5sided ;; ;; ;; ;; _ _ ;; ;; / \ / \ ;; ;; / \ / \ ;; ;; 4 3 4 3 ;; ;; / \ / / \ ;; ;; / \ -> / / \ ;; ;; \ / \ / / ;; ;; 5 2 5/ 2 ;; ;; \ / \ / ;; ;; --1-- --1-- ;; ;;---------------------------------------------------------------------------;; (nt_def_type "iceray:5->4+5:3-5" 'iceray:5->4+5:3-5 '(("xo" . 0) ("yo" . 0) ("zo" . 0) ("rot" . 0) ("gap" . 1) ("pt1x" . 0) ("pt1y" . 0) ("pt2x" . 10) ("pt2y" . 0) ("pt3x" . 13.0902) ("pt3y" . 9.5106) ("pt4x" . 5) ("pt4y" . 15.3884) ("pt5x" . -3.0902) ("pt5y" . 9.5106) ("loc3" . 0.5) ("loc5" . 0.5) ) ) ;;---------------------------------------------------------------------------;; ;; geometry definitions ;; ;;---------------------------------------------------------------------------;; ;;---------------------------------------------------------------------------;; ;; how to draw a rectangular frame ;; ;;---------------------------------------------------------------------------;; (defun iceray_rectangle_frame (xo yo zo rot width height) (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) (command "layer" "set" "polygon" "") (command "pline" (list 0 0) (list width 0) (list width height) (list 0 height) "c" ) (entlast) ) ;;---------------------------------------------------------------------------;; ;; how to draw a n-sided polygon ;; ;;---------------------------------------------------------------------------;; (defun iceray_polygon (xo yo zo rot gap points / arguments shape) (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) (debug 'xo) (debug 'yo) (debug 'zo) (debug 'rot) (debug 'gap) (debug 'points) (command "layer" "set" "polygon" "") (setq arguments (append (list "pline") points (list "c"))) (apply 'command arguments) (setq shape (entlast)) (command "ucs" "world") shape ) ;;---------------------------------------------------------------------------;; ;; how to draw a n-sided polygon with numbers ;; ;;---------------------------------------------------------------------------;; (defun iceray_polygon_numbers (xo yo zo rot gap points / arguments shape numbers pta ptb midpoint) (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) (debug 'xo) (debug 'yo) (debug 'zo) (debug 'rot) (debug 'gap) (debug 'points) (command "layer" "set" "polygon" "") (setq arguments (append (list "pline") points (list "c"))) (apply 'command arguments) (setq shape (entlast)) (setq i 0) (repeat (length points) (setq pta (nth i points)) (if (> (+ i 2) (length points)) (setq ptb (nth 0 points)) (setq ptb (nth (+ i 1) points)) ) (debug 'pta) (debug 'ptb) (setq midpoint (list (* 0.5 (+ (car pta) (car ptb))) (* 0.5 (+ (cadr pta) (cadr ptb))) ) ) (debug 'midpoint) (command "layer" "set" "numbers" "") (command "text" "justify" "mc" midpoint (* 2 gap) (- rot) (+ i 1) ) (setq numbers (cons (entlast) numbers)) (debug 'numbers) (setq i (1+ i)) ) (command "ucs" "world") (nt_make_ablock (append (list shape) numbers)) ) ;;---------------------------------------------------------------------------;; ;; how to draw a 3-sided polygon ;; ;;---------------------------------------------------------------------------;; (defun iceray_3sided (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y) (iceray_polygon_numbers xo yo zo rot gap (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) ) ) ) ;;---------------------------------------------------------------------------;; ;; how to draw a 4-sided polygon ;; ;;---------------------------------------------------------------------------;; (defun iceray_4sided (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y) (iceray_polygon_numbers xo yo zo rot gap (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) ) ;;---------------------------------------------------------------------------;; ;; how to draw a 5-sided polygon ;; ;;---------------------------------------------------------------------------;; (defun iceray_5sided (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y pt5x pt5y) (iceray_polygon_numbers xo yo zo rot gap (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) (list pt5x pt5y) ) ) ) ;;---------------------------------------------------------------------------;; ;; parameter definitions ;; ;; ;; ;; how does the new shape relate with the old shape? ;; ;;---------------------------------------------------------------------------;; ;;---------------------------------------------------------------------------;; ;; 3sided -> 3sided + 4sided : 1-2 ;; ;;---------------------------------------------------------------------------;; (defun iceray:3->3+4:1-2 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y loc1 loc2 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) ) ) (debug 'points) (setq new-polygons (split_polygon points 1 loc1 2 loc2 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 4) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 3sided -> 3sided + 4sided : 2-3 ;; ;;---------------------------------------------------------------------------;; (defun iceray:3->3+4:2-3 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y loc2 loc3 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) ) ) (debug 'points) (setq new-polygons (split_polygon points 2 loc2 3 loc3 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 4) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 3sided -> 3sided + 4sided : 3-1 ;; ;;---------------------------------------------------------------------------;; (defun iceray:3->3+4:3-1 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y loc3 loc1 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) ) ) (debug 'points) (setq new-polygons (split_polygon points 3 loc3 1 loc1 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 4) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 4sided + 4sided : 1-3 ;; ;;---------------------------------------------------------------------------;; (defun iceray:4->4+4:1-3 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y loc1 loc3 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) (debug 'loc1) (debug 'loc3) (debug 'points) (setq new-polygons (split_polygon points 1 loc1 3 loc3 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (debug 'poly1_plist) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (debug 'poly2_plist) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 4sided + 4sided : 2-4 ;; ;;---------------------------------------------------------------------------;; (defun iceray:4->4+4:2-4 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y loc2 loc4 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) (debug 'points) (setq new-polygons (split_polygon points 2 loc2 4 loc4 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (debug 'poly1_plist) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (debug 'poly2_plist) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 1-2 ;; ;;---------------------------------------------------------------------------;; (defun iceray:4->3+5:1-2 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y loc1 loc2 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) (debug 'points) (setq new-polygons (split_polygon points 1 loc1 2 loc2 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 2-3 ;; ;;---------------------------------------------------------------------------;; (defun iceray:4->3+5:2-3 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y loc2 loc3 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) (debug 'points) (setq new-polygons (split_polygon points 2 loc2 3 loc3 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 3-4 ;; ;;---------------------------------------------------------------------------;; (defun iceray:4->3+5:3-4 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y loc3 loc4 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) (debug 'points) (setq new-polygons (split_polygon points 3 loc3 4 loc4 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 4-1 ;; ;;---------------------------------------------------------------------------;; (defun iceray:4->3+5:4-1 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y loc4 loc1 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) ) ) (debug 'points) (setq new-polygons (split_polygon points 4 loc4 1 loc1 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_3sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_3sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 1-3 ;; ;;---------------------------------------------------------------------------;; (defun iceray:5->4+5:1-3 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y pt5x pt5y loc1 loc3 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) (list pt5x pt5y) ) ) (debug 'points) (setq new-polygons (split_polygon points 1 loc1 3 loc3 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 1-4 ;; ;;---------------------------------------------------------------------------;; (defun iceray:5->4+5:1-4 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y pt5x pt5y loc1 loc4 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) (list pt5x pt5y) ) ) (debug 'points) (setq new-polygons (split_polygon points 1 loc1 4 loc4 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 2-4 ;; ;;---------------------------------------------------------------------------;; (defun iceray:5->4+5:2-4 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y pt5x pt5y loc2 loc4 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) (list pt5x pt5y) ) ) (debug 'points) (setq new-polygons (split_polygon points 2 loc2 4 loc4 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 2-5 ;; ;;---------------------------------------------------------------------------;; (defun iceray:5->4+5:2-5 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y pt5x pt5y loc2 loc5 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) (list pt5x pt5y) ) ) (debug 'points) (setq new-polygons (split_polygon points 2 loc2 5 loc5 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 3-5 ;; ;;---------------------------------------------------------------------------;; (defun iceray:5->4+5:3-5 (xo yo zo rot gap pt1x pt1y pt2x pt2y pt3x pt3y pt4x pt4y pt5x pt5y loc3 loc5 / new-polygons polygon-a polygon-b poly1_plist poly2_plist c1 c2 points ) ;; adjust the ucs ;; (command "ucs" "world") (command "ucs" "origin" (list xo yo zo)) (command "ucs" "z" rot) ;; calculate the required points ;; (setq points (list (list pt1x pt1y) (list pt2x pt2y) (list pt3x pt3y) (list pt4x pt4y) (list pt5x pt5y) ) ) (debug 'points) (setq new-polygons (split_polygon points 3 loc3 5 loc5 gap)) (debug 'new-polygons) (setq polygon-a (car new-polygons)) (debug 'polygon-a) (setq polygon-b (cadr new-polygons)) (debug 'polygon-b) (command "ucs" "world") (if (= (length polygon-a) 5) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) (cons "pt5x" (car (nth 4 polygon-a))) (cons "pt5y" (cadr (nth 4 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) ) ) (setq c1 (list "iceray_5sided" nil poly1_plist)) (setq c2 (list "iceray_4sided" nil poly2_plist)) ) (progn (setq poly1_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-a))) (cons "pt1y" (cadr (nth 0 polygon-a))) (cons "pt2x" (car (nth 1 polygon-a))) (cons "pt2y" (cadr (nth 1 polygon-a))) (cons "pt3x" (car (nth 2 polygon-a))) (cons "pt3y" (cadr (nth 2 polygon-a))) (cons "pt4x" (car (nth 3 polygon-a))) (cons "pt4y" (cadr (nth 3 polygon-a))) ) ) (setq poly2_plist (list (cons "xo" xo) (cons "yo" yo) (cons "zo" zo) (cons "rot" rot) (cons "gap" gap) (cons "pt1x" (car (nth 0 polygon-b))) (cons "pt1y" (cadr (nth 0 polygon-b))) (cons "pt2x" (car (nth 1 polygon-b))) (cons "pt2y" (cadr (nth 1 polygon-b))) (cons "pt3x" (car (nth 2 polygon-b))) (cons "pt3y" (cadr (nth 2 polygon-b))) (cons "pt4x" (car (nth 3 polygon-b))) (cons "pt4y" (cadr (nth 3 polygon-b))) (cons "pt5x" (car (nth 4 polygon-b))) (cons "pt5y" (cadr (nth 4 polygon-b))) ) ) (setq c1 (list "iceray_4sided" nil poly1_plist)) (setq c2 (list "iceray_5sided" nil poly2_plist)) ) ) (debug 'poly1_plist) (debug 'poly2_plist) (nt_composit (list c1 c2)) ) ;;---------------------------------------------------------------------------;; ;; transformation declarations ;; ;;---------------------------------------------------------------------------;; ;; transformations for 3->3+4 ;; (nt_def_trans '("iceray_3sided") "iceray:3->3+4:1-2" 'make:3->3+4:1-2 nil 'replace) (nt_def_trans '("iceray_3sided") "iceray:3->3+4:2-3" 'make:3->3+4:2-3 nil 'replace) (nt_def_trans '("iceray_3sided") "iceray:3->3+4:3-1" 'make:3->3+4:3-1 nil 'replace) ;; transformations for 4->4+4 ;; (nt_def_trans '("iceray_4sided") "iceray:4->4+4:1-3" 'make:4->4+4:1-3 nil 'replace) (nt_def_trans '("iceray_4sided") "iceray:4->4+4:2-4" 'make:4->4+4:2-4 nil 'replace) ;; transformations for 4->3+5 ;; (nt_def_trans '("iceray_4sided") "iceray:4->3+5:1-2" 'make:4->3+5:1-2 nil 'replace) (nt_def_trans '("iceray_4sided") "iceray:4->3+5:2-3" 'make:4->3+5:2-3 nil 'replace) (nt_def_trans '("iceray_4sided") "iceray:4->3+5:3-4" 'make:4->3+5:3-4 nil 'replace) (nt_def_trans '("iceray_4sided") "iceray:4->3+5:4-1" 'make:4->3+5:4-1 nil 'replace) ;; transformations for 5->4+5 ;; (nt_def_trans '("iceray_5sided") "iceray:5->4+5:1-3" 'make:5->4+5:1-3 nil 'replace) (nt_def_trans '("iceray_5sided") "iceray:5->4+5:1-4" 'make:5->4+5:1-4 nil 'replace) (nt_def_trans '("iceray_5sided") "iceray:5->4+5:2-4" 'make:5->4+5:2-4 nil 'replace) (nt_def_trans '("iceray_5sided") "iceray:5->4+5:2-5" 'make:5->4+5:2-5 nil 'replace) (nt_def_trans '("iceray_5sided") "iceray:5->4+5:3-5" 'make:5->4+5:3-5 nil 'replace) ;;---------------------------------------------------------------------------;; ;; transformation definitions ;; ;;---------------------------------------------------------------------------;; ;;---------------------------------------------------------------------------;; ;; 3sided -> 3sided + 4sided : 1-2 ;; ;;---------------------------------------------------------------------------;; (defun make:3->3+4:1-2 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "loc1" 0.5) (cons "loc2" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 3sided -> 3sided + 4sided : 2-3 ;; ;;---------------------------------------------------------------------------;; (defun make:3->3+4:2-3 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "loc2" 0.5) (cons "loc3" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 3sided -> 3sided + 4sided : 3-1 ;; ;;---------------------------------------------------------------------------;; (defun make:3->3+4:3-1 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "loc3" 0.5) (cons "loc1" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 4sided + 4sided : 1-3 ;; ;;---------------------------------------------------------------------------;; (defun make:4->4+4:1-3 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (debug 'poly_plist) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "loc1" 0.5) (cons "loc3" 0.5) ) ) (debug 'c_plist) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 4sided + 4sided : 2-4 ;; ;;---------------------------------------------------------------------------;; (defun make:4->4+4:2-4 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (debug 'poly_plist) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "loc2" 0.5) (cons "loc4" 0.5) ) ) (debug 'c_plist) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 1-2 ;; ;;---------------------------------------------------------------------------;; (defun make:4->3+5:1-2 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "loc1" 0.5) (cons "loc2" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 2-3 ;; ;;---------------------------------------------------------------------------;; (defun make:4->3+5:2-3 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "loc2" 0.5) (cons "loc3" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 3-4 ;; ;;---------------------------------------------------------------------------;; (defun make:4->3+5:3-4 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "loc3" 0.5) (cons "loc4" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 4sided -> 3sided + 5sided : 4-1 ;; ;;---------------------------------------------------------------------------;; (defun make:4->3+5:4-1 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "loc4" 0.5) (cons "loc1" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 1-3 ;; ;;---------------------------------------------------------------------------;; (defun make:5->4+5:1-3 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "pt5x" (nt_val "pt5x" poly_plist)) (cons "pt5y" (nt_val "pt5y" poly_plist)) (cons "loc1" 0.5) (cons "loc3" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 1-4 ;; ;;---------------------------------------------------------------------------;; (defun make:5->4+5:1-4 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "pt5x" (nt_val "pt5x" poly_plist)) (cons "pt5y" (nt_val "pt5y" poly_plist)) (cons "loc1" 0.5) (cons "loc4" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 2-4 ;; ;;---------------------------------------------------------------------------;; (defun make:5->4+5:2-4 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "pt5x" (nt_val "pt5x" poly_plist)) (cons "pt5y" (nt_val "pt5y" poly_plist)) (cons "loc2" 0.5) (cons "loc4" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 2-5 ;; ;;---------------------------------------------------------------------------;; (defun make:5->4+5:2-5 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "pt5x" (nt_val "pt5x" poly_plist)) (cons "pt5y" (nt_val "pt5y" poly_plist)) (cons "loc2" 0.5) (cons "loc5" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; 5sided -> 4sided + 5sided : 3-5 ;; ;;---------------------------------------------------------------------------;; (defun make:5->4+5:3-5 (polygon_list trans_list / poly_plist c_plist) (setq poly_plist (nt_plist (car polygon_list))) (setq c_plist (list (cons "xo" (nt_val "xo" poly_plist)) (cons "yo" (nt_val "yo" poly_plist)) (cons "zo" (nt_val "zo" poly_plist)) (cons "rot" (nt_val "rot" poly_plist)) (cons "gap" (nt_val "gap" poly_plist)) (cons "pt1x" (nt_val "pt1x" poly_plist)) (cons "pt1y" (nt_val "pt1y" poly_plist)) (cons "pt2x" (nt_val "pt2x" poly_plist)) (cons "pt2y" (nt_val "pt2y" poly_plist)) (cons "pt3x" (nt_val "pt3x" poly_plist)) (cons "pt3y" (nt_val "pt3y" poly_plist)) (cons "pt4x" (nt_val "pt4x" poly_plist)) (cons "pt4y" (nt_val "pt4y" poly_plist)) (cons "pt5x" (nt_val "pt5x" poly_plist)) (cons "pt5y" (nt_val "pt5y" poly_plist)) (cons "loc3" 0.5) (cons "loc5" 0.5) ) ) (list nil c_plist) ) ;;---------------------------------------------------------------------------;; ;; ;; ;; end of file ;; ;; ;; ;;---------------------------------------------------------------------------;;