;------------------------------------------------------------------------;
; STAHL - R650                                                           ;
;------------------------------------------------------------------------;
; AW 05.09.2010                                                          ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/layout/STAHL_R650_1.DCL")))
  (if (not (new_dialog "STAHL_R650_1" Dat)) (exit))
  (set_tile "DWG_NAME" m_DWG_NAME); Blockname
  (mode_tile "anzeige" 0)
  (SetDia)

  (ACTION_TILE "DWG_NAME" "(zeig_dia)")
  (action_tile "accept" "(SetPara) (done_dialog)")
  (action_tile "cancel" "(exit) (done_dialog)")

  (start_dialog)

  (unload_dialog Dat)
)

(defun zeig_dia()
  (setq m_DWG_NAME (get_tile "DWG_NAME"))
  (SetDia)
)

(defun SetDia()
  (setq breite (dimx_tile "anzeige"))
  (setq hoehe  (dimy_tile "anzeige"))

  (start_image "anzeige")
  (FILL_IMAGE 0 0 breite hoehe -18)
  (if (= m_DWG_NAME "0") 
    (slide_image 0 0 breite hoehe "layout(w45650l3)")
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "layout(w45650r3)")
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "layout(w90650l7)")
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "layout(w90650r7)")
  )
  (if (= m_DWG_NAME "4") 
    (slide_image 0 0 breite hoehe "layout(s45650l3)")
  )
  (if (= m_DWG_NAME "5") 
    (slide_image 0 0 breite hoehe "layout(s45650r3)")
  )
  (if (= m_DWG_NAME "6") 
    (slide_image 0 0 breite hoehe "layout(drw1400x)")
  )
  (if (= m_DWG_NAME "7") 
    (slide_image 0 0 breite hoehe "layout(dw1400xx)")
  )
  (end_image)
)

(defun setpara()
    (setq m_DWG_NAME (get_tile "DWG_NAME"))
    (setq m_AUSF     (get_tile "AUSF"))
)

(defun datain ()  
  (setq dummy nil)
)


(defun geometrie()
  (if (= m_DWG_NAME "0") ; W-R650-45L-350
    (progn
      (setq EBENE "L-2")	  
      (setq BL_NAME "824052010")
    )
  )
  (if (= m_DWG_NAME "1") ; W-R650-45R-350
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824052009")
    )
  )
  (if (= m_DWG_NAME "2") ; W-R650-90L-700
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824052020")
    )
  )
  (if (= m_DWG_NAME "3") ; W-R650-90R-700
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824052019")
    )
  )
  (if (= m_DWG_NAME "4") ; S-R650-45L-350
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084122")
    )
  )
  (if (= m_DWG_NAME "5") ; S-R650-45R-350
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084121")
    )
  )
  (if (= m_DWG_NAME "6") ; DRW-R650-1400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824041001")
    )
  )
  (if (= m_DWG_NAME "7") ; DW-R650-1400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824062002")
    )
  )
  
  (command "_layer" "_m" EBENE "_c" "2" "" "")
  (setq P0  (getpoint "\nPick insert point: "))
  (bl-name P0) ;--> Block-Name definieren -> Rückgabe: element-name  
  (setq BL_NAME (strcat lw "/acadsst/layout/" BL_NAME))
  (command "_insert" BL_NAME P0 "" "" pause)

)

;------------------------------------------------------------------------------
(defun c:STAHL_R650_1 ( / DWG_NAME BL_NAME P0) 
  (setvar "limcheck" 0)
  (setvar "CMDECHO" 0)
  (setvar "BLIPMODE" 0)
  (setq ALTFANG (getvar "osmode"))  
  (setq EINZEL 0) ; fuer EINZEL=0 Baugruppen / EINZEL=1 fuer APB
  (prompt "**** STAHL R650  *******")
  (prompt "")
  (if (null m_DWG_NAME)(setq m_DWG_NAME "0"))     ; Anfangssymbolname 
  (Dbox)
  (prompt "")
  (datain)
  (geometrie)
	(setvar "osmode" ALTFANG)  
)
