;------------------------------------------------------------------------;
; STAHL - R650                                                           ;
;------------------------------------------------------------------------;
; AW 05.09.2010                                                          ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/layout/STAHL_R650.DCL")))
  (if (not (new_dialog "STAHL_R650" 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(w45650l4)")
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "layout(w45650r4)")
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "layout(w90650l8)")
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "layout(w90650r8)")
  )
  (if (= m_DWG_NAME "4") 
    (slide_image 0 0 breite hoehe "layout(s45650l4)")
  )
  (if (= m_DWG_NAME "5") 
    (slide_image 0 0 breite hoehe "layout(s45650r4)")
  )
  (if (= m_DWG_NAME "6") 
    (slide_image 0 0 breite hoehe "layout(s90650l8)")
  )
  (if (= m_DWG_NAME "7") 
    (slide_image 0 0 breite hoehe "layout(drw1600x)")
  )
  (if (= m_DWG_NAME "8") 
    (slide_image 0 0 breite hoehe "layout(dw1600xx)")
  )
  (if (= m_DWG_NAME "9") 
    (slide_image 0 0 breite hoehe "layout(dw800xxx)")
  )
  (if (= m_DWG_NAME "10") 
    (slide_image 0 0 breite hoehe "layout(kwp300)")
  )
  (if (= m_DWG_NAME "11") 
    (slide_image 0 0 breite hoehe "layout(kw300)")
  )
  (if (= m_DWG_NAME "12") 
    (slide_image 0 0 breite hoehe "layout(kw800_8x)")
  )
  (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-45L-400
    (progn
      (setq EBENE "L-2")	  
      (setq BL_NAME "824052012")
    )
  )
  (if (= m_DWG_NAME "1") ; W-45R-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824052011")
    )
  )
  (if (= m_DWG_NAME "2") ; W-90L-800
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824052002")
    )
  )
  (if (= m_DWG_NAME "3") ; W-90R-800
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824052001")
    )
  )
  (if (= m_DWG_NAME "4") ; S-45L-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084124")
    )
  )
  (if (= m_DWG_NAME "5") ; S-45R-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084123")
    )
  )
  (if (= m_DWG_NAME "6") ; S-90L-800
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084116")
    )
  )
  (if (= m_DWG_NAME "7") ; DRW-1600
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824041002")
    )
  )
  (if (= m_DWG_NAME "8") ; DW-1600
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824062003")
    )
  )
  (if (= m_DWG_NAME "9") ; DW-800
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824062001")
    )
  )
  (if (= m_DWG_NAME "10") ; KWP-300
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824312017")
    )
  )
  (if (= m_DWG_NAME "11") ; KW-300
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824312016")
    )
  )
  (if (= m_DWG_NAME "12") ; KW-800-8
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824312014")
    )
  )
  
  (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 ( / 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)  
)
