drawing.lisp 3.69 KB
Newer Older
Dave Cooper's avatar
Dave Cooper committed
1
2
3
(in-package :gdl-user)

(define-object robot-drawing (base-drawing)
Dave Cooper's avatar
Dave Cooper committed
4

Dave Cooper's avatar
Dave Cooper committed
5
6
7
  :hidden-objects ((robot-assembly :type 'robot:assembly)

		   (text-block :type 'robot-text-block
8
			       :margins (twice (twice (the text-view left-margin)))
Dave Cooper's avatar
Dave Cooper committed
9
10
			       :width (the text-view width)
			       :length (the text-view length)
Dave Cooper's avatar
Dave Cooper committed
11
12
13
14
15
			       :robot-width (the robot-assembly height)
			       :robot-length (the robot-assembly length)
			       :arm-angle-left (the robot-assembly arm-angle-left)
			       :head-angle (the robot-assembly head-angle)
			       :body-angle (the robot-assembly body-angle)))
Dave Cooper's avatar
Dave Cooper committed
16
17


18
 
Dave Cooper's avatar
Dave Cooper committed
19
  :objects
Dave Cooper's avatar
Dave Cooper committed
20
  ((text-view :type 'base-view
21
22
	      ;;:left-margin 0
	      ;;:front-margin 0
Dave Cooper's avatar
Dave Cooper committed
23
24
25
26
	      :border-box? t
	      :objects (list (the text-block))
	      :length (half (the length))
	      :width (half (the width))
Dave Cooper's avatar
Dave Cooper committed
27
	      :projection-vector (getf *standard-views* :top)
Dave Cooper's avatar
Dave Cooper committed
28
29
30
31
	      :center (translate (the center) :rear (half (the-child length))
				 :right (half (the-child width))))

   (tri-view :type 'base-view
Dave Cooper's avatar
Dave Cooper committed
32
33
	     :border-box? t
	     :object-roots (list (the robot-assembly robot))
Dave Cooper's avatar
Dave Cooper committed
34
	     :length (half (the length))
Dave Cooper's avatar
Dave Cooper committed
35
36
37
	     :width (half (the width))
	     :center (translate (the center) :rear (half (the-child length))
				:left (half (the-child width)))
Dave Cooper's avatar
Dave Cooper committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	     :projection-vector (getf *standard-views* :trimetric))

   (top-view :type 'base-view
	     :border-box? t
	     :object-roots (list (the robot-assembly robot))
	     :annotation-objects (list (the top-width-dim)
				       (the top-length-dim))
	     :view-scale (* 0.80 (getf (the-child view-contents-data) :view-scale))
	     :length (half (the length))
	     :width (half (the width))
	     :center (translate (the center) :front (half (the-child length))
				:left (half (the-child width)))
	     :projection-vector (getf *standard-views* :top))


   (top-width-dim :type 'horizontal-dimension
		  :character-size 10
		  :dim-scale (/ (the top-view view-scale))
		  :witness-line-length 20
		  :witness-line-gap 70
Dave Cooper's avatar
Dave Cooper committed
58
		  :witness-line-ext 5 
Dave Cooper's avatar
Dave Cooper committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
		  :start-point (the top-view (view-point (the robot-assembly robot body (arms 0) (vertex :rear :left :top))))
		  :end-point (the top-view (view-point (the robot-assembly robot body (arms 1) (vertex :rear :right :top)))))

   (top-length-dim :type 'vertical-dimension
		   :dim-scale (/ (the top-view view-scale))
		   :character-size 10
		   :witness-line-length 15
		   :witness-line-gap 25
		   :witness-line-ext 3
		   :flip-leaders? t
		   :start-point (the top-view (view-point (the robot-assembly robot body base foot (vertex :rear :left :top))))
		   :end-point (the top-view (view-point (the robot-assembly robot body base foot (vertex :front :left :top)))))



Dave Cooper's avatar
Dave Cooper committed
74
   (front-view :type 'base-view
Dave Cooper's avatar
Dave Cooper committed
75
76
	       :border-box? t
	       :object-roots (list (the robot-assembly robot))
Dave Cooper's avatar
Dave Cooper committed
77
78
79
	       :length (half (the length))
	       :width (half (the width))
	       :center (translate (the center) :front (half (the-child length))
Dave Cooper's avatar
Dave Cooper committed
80
81
				  :right (half (the-child width)))
	       :projection-vector (getf *standard-views* :front))
Dave Cooper's avatar
Dave Cooper committed
82
83
84



Dave Cooper's avatar
Dave Cooper committed
85
86
87

   ))

Dave Cooper's avatar
Dave Cooper committed
88
89
90
91

(define-object robot-text-block (typeset-block)
  
  :input-slots
92
  (robot-width robot-length body-angle arm-angle-left head-angle margins)
Dave Cooper's avatar
Dave Cooper committed
93
94
95
96
97

  :functions
  ((content
    ()
    (tt:compile-text (:font "Helvetica" :font-size 12.0)
Dave Cooper's avatar
Dave Cooper committed
98
      (tt:vspace 100)
99

Dave Cooper's avatar
Dave Cooper committed
100
      (tt:paragraph () "Robot Data")
101
102
103
104
105
106
107
      (let ((width (- (the width) (the margins))))
	(tt:table (:col-widths (list (* 2/3 width) (* 1/3 width)))
	  (dolist (slot (list :robot-width :robot-length :body-angle :arm-angle-left :head-angle))
	    (tt:row ()
	      (tt:cell (:background-color "#00FF00") (tt:put-string (format nil "~a" (string-capitalize slot))))
	      (tt:cell () 
		(tt:paragraph (:h-align :center) (tt:put-string (format nil "~a" (the (evaluate slot))))))))))))))
Dave Cooper's avatar
Dave Cooper committed
108

Dave Cooper's avatar
Dave Cooper committed
109

Dave Cooper's avatar
Dave Cooper committed
110
111