drawing.lisp 3.35 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
8
9
10
11
12
  :hidden-objects ((robot-assembly :type 'robot:assembly)

		   (text-block :type 'robot-text-block
			       :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
13

Dave Cooper's avatar
Dave Cooper committed
14
  :objects
Dave Cooper's avatar
Dave Cooper committed
15
16
17
18
19
20
21
22
23
  ((text-view :type 'base-view
	      :border-box? t
	      :objects (list (the text-block))
	      :length (half (the length))
	      :width (half (the width))
	      :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
24
25
	     :border-box? t
	     :object-roots (list (the robot-assembly robot))
Dave Cooper's avatar
Dave Cooper committed
26
	     :length (half (the length))
Dave Cooper's avatar
Dave Cooper committed
27
28
29
	     :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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	     :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
		  :witness-line-ext 5
		  :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
66
   (front-view :type 'base-view
Dave Cooper's avatar
Dave Cooper committed
67
68
	       :border-box? t
	       :object-roots (list (the robot-assembly robot))
Dave Cooper's avatar
Dave Cooper committed
69
70
71
	       :length (half (the length))
	       :width (half (the width))
	       :center (translate (the center) :front (half (the-child length))
Dave Cooper's avatar
Dave Cooper committed
72
73
				  :right (half (the-child width)))
	       :projection-vector (getf *standard-views* :front))
Dave Cooper's avatar
Dave Cooper committed
74
75
76



Dave Cooper's avatar
Dave Cooper committed
77
78
79

   ))

Dave Cooper's avatar
Dave Cooper committed
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98



(define-object robot-text-block (typeset-block)
  
  :input-slots
  (robot-width robot-length body-angle arm-angle-left head-angle)

  :functions
  ((content
    ()
    (tt:compile-text (:font "Helvetica" :font-size 12.0)
      (tt:paragraph () "Robot Data")
      (tt:table (:col-widths '(220 200))
	(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
99

Dave Cooper's avatar
Dave Cooper committed
100

Dave Cooper's avatar
Dave Cooper committed
101
102