home *** CD-ROM | disk | FTP | other *** search
- (defun plate_dialog ( data / x y c sta
- )
-
- (if (not (new_dialog "plate" dcl_id))
- (exit)
- )
-
- (action_tile "accept" "(plate_dialog_ok)")
- (action_tile "std_h" "(set_h)")
- (action_tile "std_w" "(set_w)")
- (action_tile "color1" "(set_color 0)")
- (action_tile "color2" "(set_color 1)")
- (action_tile "color3" "(set_color 2)")
- (action_tile "c01" "(set_color 0)")
- (action_tile "c02" "(set_color 1)")
- (action_tile "c03" "(set_color 2)")
- (setq x (dimx_tile "image"))
- (setq y (dimy_tile "image"))
- (start_image "image")
- (slide_image 0 0 x y "room(platevar)")
- (end_image)
-
- (setq hb_std_h (list "1000.0" "1300.0" "1600.0" "1800.0")
- hb_std_w (list "600.0" "700.0" "900.0"))
- (start_list "std_h")
- (foreach x hb_std_h (add_list x))
- (end_list)
- (start_list "std_w")
- (foreach x hb_std_w (add_list x))
- (end_list)
-
- (set_tile "height" (nth 0 data))
- (set_tile "width" (nth 1 data))
- (set_tile "thick" (nth 2 data))
- (set_tile "h1" (nth 3 data))
- (set_tile "h2" (nth 4 data))
- (set_tile "h3" (nth 5 data))
- (set_tile "t" (nth 7 data))
- (if (= "y" (nth 6 data))
- (set_tile "has_window" "1")
- (set_tile "has_window" "0")
- )
- (setq colors (list (cons 0 (atoi (nth 8 data)))
- (cons 1 (atoi (nth 9 data)))
- (cons 2 (atoi (nth 10 data)))))
-
- (setq c 0)
- (repeat 3
- (setq key (strcat "c0" (itoa (1+ c))))
- (setq x (dimx_tile key))
- (setq y (dimy_tile key))
- (start_image key)
- (fill_image 0 0 x y (cdr (nth c colors)))
- (end_image)
- (setq c (1+ c))
- )
-
- (setq sta (start_dialog))
-
- (if (= sta 1)
- (setq data new_data)
- (setq data nil)
- )
-
- )
-
- (defun set_h ( / )
- (set_tile "height" (nth (atoi (get_tile "std_h")) hb_std_h))
- )
-
- (defun set_w ( / )
- (set_tile "width" (nth (atoi (get_tile "std_w")) hb_std_w))
- )
-
- (defun plate_dialog_ok ( / flag )
-
- (setq flag (get_tile "has_window"))
- (if (= flag "0")
- (setq flag "n")
- (setq flag "y")
- )
- (if ( > (+ (atof (get_tile "h1")) (atof (get_tile "h2")) (atof (get_tile "h3")))
- (atof (get_tile "height")))
- (setq flag "n"))
-
- (setq new_data (list (get_tile "height")
- (get_tile "width")
- (get_tile "thick")
- (get_tile "h1")
- (get_tile "h2")
- (get_tile "h3")
- flag
- (get_tile "t")
- (itoa (cdr (nth 0 colors)))
- (itoa (cdr (nth 1 colors)))
- (itoa (cdr (nth 2 colors)))))
-
- (done_dialog 1)
- )
-
- (defun set_color ( n / cl c x y key )
-
- (setq cl (sel_plate_cl))
- (setq colors (subst (cons n cl) (assoc n colors) colors))
-
- (setq c 0)
- (repeat 3
- (setq key (strcat "c0" (itoa (1+ c))))
- (setq x (dimx_tile key))
- (setq y (dimy_tile key))
- (start_image key)
- (fill_image 0 0 x y (cdr (nth c colors)))
- (end_image)
- (setq c (1+ c))
- )
- )
-
- (defun sel_plate_cl ( / )
-
- (if (not (new_dialog "plate_color" dcl_id))
- (exit)
- )
-
- (action_tile "accept" "(done_dialog 233)")
- (action_tile "c01" "(done_dialog 1)")
- (action_tile "c02" "(done_dialog 253)")
- (action_tile "c03" "(done_dialog 21)")
- (action_tile "c04" "(done_dialog 233)")
- (action_tile "c05" "(done_dialog 231)")
- (action_tile "c06" "(done_dialog 133)")
- (action_tile "c07" "(done_dialog 175)")
- (action_tile "c08" "(done_dialog 245)")
- (action_tile "c09" "(done_dialog 151)")
- (action_tile "c10" "(done_dialog 7)")
- (action_tile "other" "(setq c (acad_colordlg 233))
- (if (/= nil c) (done_dialog c) (done_dialog 233))")
-
- (start_dialog)
- )
-
- (defun plate_1 ( pt l w h c h1 h2 h3 t color1 color2 color3
- / x y z pt1 pt2 pt3 pt4 pt5 pt6 pt7 pt8
- )
-
- (setq x (car pt) y (nth 1 pt) z (nth 2 pt))
- (setq pt1 (list x y z)
- pt2 (list (+ l x) y z )
- pt3 (list (+ l x) (+ y w) z)
- pt4 (list x (+ y w) z )
- pt5 (list x y (+ z h))
- pt6 (list (+ l x) y (+ z h))
- pt7 (list (+ l x) (+ y w) (+ z h))
- pt8 (list x (+ y w) (+ z h))
- )
- (make_3dface pt5 pt6 pt7 pt8 "3D_MESH" 0 0)
- (make_3dface pt2 pt6 pt7 pt3 "3D_MESH" 0 0)
- (make_3dface pt5 pt8 pt4 pt1 "3D_MESH" 0 0)
- (make_3dface pt1 pt2 pt3 pt4 "2D" 0 0)
-
- (setq pt5 (list x y (+ z h1))
- pt6 (list (+ l x) y (+ z h1))
- pt7 (list (+ l x) (+ y w) (+ z h1))
- pt8 (list x (+ y w) (+ z h1))
- )
- (make_3dface pt1 pt2 pt6 pt5 "3D_MESH" color1 0)
- (make_3dface pt4 pt3 pt7 pt8 "3D_MESH" color1 0)
-
- (if (< h (+ h1 h2 t t)) (setq h2 (- h h1)))
- (setq pt1 (list x y (+ z h1 h2))
- pt2 (list (+ l x) y (+ z h1 h2))
- pt3 (list (+ l x) (+ y w) (+ z h1 h2))
- pt4 (list x (+ y w) (+ z h1 h2))
- )
- (make_3dface pt1 pt2 pt6 pt5 "3D_MESH" color2 0)
- (make_3dface pt4 pt3 pt7 pt8 "3D_MESH" color2 0)
-
- (if (> h (+ h1 h2 h3))
- (progn
- (setq pt5 (list x y (+ z (- h h3)))
- pt6 (list (+ l x) y (+ z (- h h3)))
- pt7 (list (+ l x) (+ y w) (+ z (- h h3)))
- pt8 (list x (+ y w) (+ z (- h h3)))
- )
- (make_3dface pt1 pt2 pt6 pt5 "3D_MESH" color3 0)
- (make_3dface pt4 pt3 pt7 pt8 "3D_MESH" color3 0)
- ) ; progn
- ) ; end if
-
- (if (> h (+ h1 h2 t t))
- (progn
- (if (= c "y")
- (progn
- (setq pt1 (list (+ t x) y (+ z (- h h3) t))
- pt2 (list (- (+ l x) t) y (+ z t (- h h3)))
- pt3 (list (- (+ l x) t) (+ y w) (+ z t (- h h3)))
- pt4 (list (+ t x) (+ y w) (+ z t (- h h3)))
- )
- (make_3dface pt1 pt2 pt6 pt5 "3D_MESH" 0 10)
- (make_3dface pt4 pt3 pt7 pt8 "3D_MESH" 0 10)
- (make_3dface pt1 pt2 pt3 pt4 "3D_MESH" 0 0)
-
- (setq pt2 (list x y (+ z h))
- pt3 (list (+ x t) y (- (+ z h) t))
- pt6 (list (+ x t) (+ y w) (- (+ z h) t))
- pt7 (list x (+ y w) (+ z h))
- )
- (make_3dface pt2 pt5 pt1 pt3 "3D_MESH" 0 10)
- (make_3dface pt7 pt8 pt4 pt6 "3D_MESH" 0 10)
- (make_3dface pt1 pt4 pt6 pt3 "3D_MESH" 0 0)
-
-
- (setq pt1 (list (- (+ x l) t) y (- (+ z h) t))
- pt4 (list (+ x l) y (+ z h))
- pt5 (list (+ x l) (+ y w) (+ z h))
- pt8 (list (- (+ x l) t) (+ y w) (- (+ z h) t))
- )
- (make_3dface pt3 pt1 pt4 pt2 "3D_MESH" 0 10)
- (make_3dface pt6 pt8 pt5 pt7 "3D_MESH" 0 10)
- (make_3dface pt3 pt1 pt8 pt6 "3D_MESH" 0 0)
-
- (setq pt2 (list (- (+ x l) t) y (- (+ z h t) h3))
- pt3 (list (+ x l) y (- (+ z h) h3))
- pt6 (list (+ x l) (+ y w) (- (+ z h) h3))
- pt7 (list (- (+ x l) t) (+ y w) (- (+ z h t) h3))
- )
- (make_3dface pt1 pt2 pt3 pt4 "3D_MESH" 0 10)
- (make_3dface pt8 pt7 pt6 pt5 "3D_MESH" 0 10)
- (make_3dface pt8 pt7 pt2 pt1 "3D_MESH" 0 0)
- )
- (progn
-
- (setq pt1 (list x y (+ z h))
- pt2 (list (+ l x) y (+ z h))
- pt3 (list (+ l x) (+ y w) (+ z h))
- pt4 (list x (+ y w) (+ z h))
- )
- (make_3dface pt1 pt2 pt6 pt5 "3D_MESH" color2 0)
- (make_3dface pt4 pt3 pt7 pt8 "3D_MESH" color2 0)
- )
- ) ; end if
- ) ; progn
- ) ; end if
-
- )
-
- (defun plate ( data_inp / data pt h w t c color1 color2 color3 t1
- ang
- )
-
- (setq data (plate_dialog data_inp))
-
- (if (/= nil data)
- (progn
-
- (setq pt (list 0.0 0.0 0.0)
- h (atof (nth 0 data))
- l (atof (nth 1 data))
- w (atof (nth 2 data))
- h1 (atof (nth 3 data))
- h2 (atof (nth 4 data))
- h3 (atof (nth 5 data))
- c (nth 6 data)
- t (atof (nth 7 data))
- color1 (atoi (nth 8 data))
- color2 (atoi (nth 9 data))
- color3 (atoi (nth 10 data)))
-
- (blk_header pt)
-
- (plate_1 pt l w h c h1 h2 h3 t color1 color2 color3)
-
- (blk_end pt 0)
-
- (command "MOVE" (entlast) "" pt)
- (princ MSG016) ; "\nInsert point:"
- (command pause)
- (setq pt (cdr (assoc 10 (entget (entlast)))))
- (command "ROTATE" (entlast) "" pt)
- (princ MSG030) ; "\nRotate angle:"
- (command pause)
- ) )
-
- (princ)
-
- )
-