;; Copyright © 2026 Genworks International
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.  Distributed WITHOUT
;; ANY WARRANTY; see <https://www.gnu.org/licenses/agpl-3.0.html>.

(in-package :gdl-user)

(define-object assembly-8 (base-object)
  :input-slots
  ((box-lengths (list 2 5 8 12)))
  :computed-slots
  ((number-of-boxes (if (> (length (the box-lengths)) 3)
			3
			(length (the box-lengths))))

   (box-centers (case (the number-of-boxes)
		  (1 (list (make-point 0 0 0)))
		  (2 (list (make-point 0 0 0)
			   (make-point 6 0 0)))
		  (3 (list (make-point 0 0 0)
			    (make-point 6 0 0)
			    (make-point 12 0 0)))))
   
   
   (box-volumes (list-elements (the my-box) (the-element volume)))
   (box-1-volume (nth 0 (the box-volumes))))

  :objects
  ((my-box :type 'box
	   :sequence (:size (the number-of-boxes))
	   :length (nth (the-child index) (the box-lengths))
	   :width 2
	   :height 1
	   :center (nth (the-child index) (the box-centers)))))
