;------------------------------------------------------------------------;
; STAHL - R175                                                           ;
;------------------------------------------------------------------------;
; AW 05.09.2010                                                          ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/layout/STAHL_R175.DCL")))
  (if (not (new_dialog "STAHL_R175" 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(w90400l5)")
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "layout(w90400r5)")
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "layout(s45400l4)")
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "layout(s45400r4)")
  )
  (if (= m_DWG_NAME "4") 
    (slide_image 0 0 breite hoehe "layout(s90400l5)")
  )
  (if (= m_DWG_NAME "5") 
    (slide_image 0 0 breite hoehe "layout(drw500)")
  )
  (if (= m_DWG_NAME "6") 
    (slide_image 0 0 breite hoehe "layout(w45175l4)")
  )
  (if (= m_DWG_NAME "7") 
    (slide_image 0 0 breite hoehe "layout(w45175r4)")
  )
  (if (= m_DWG_NAME "8") 
    (slide_image 0 0 breite hoehe "layout(w90175l4)")
  )
  (if (= m_DWG_NAME "9") 
    (slide_image 0 0 breite hoehe "layout(w90175r4)")
  )
  (if (= m_DWG_NAME "10") 
    (slide_image 0 0 breite hoehe "layout(s45175l4)")
  )
  (if (= m_DWG_NAME "11") 
    (slide_image 0 0 breite hoehe "layout(s45175r4)")
  )
  (if (= m_DWG_NAME "12") 
    (slide_image 0 0 breite hoehe "layout(s90175l4)")
  )
  (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") ; W90-R400-L-500
    (progn
      (setq EBENE "L-2")	  
      (setq BL_NAME "824000021")
    )
  )
  (if (= m_DWG_NAME "1") ; W90-R400-R-500
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824000022")
    )
  )
  (if (= m_DWG_NAME "2") ; S45-R400-L-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084064")
    )
  )
  (if (= m_DWG_NAME "3") ; S45-R400-R-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084063")
    )
  )
  (if (= m_DWG_NAME "4") ; S90-R400-L-500
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084065")
    )
  )
  (if (= m_DWG_NAME "5") ; DRW-500
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824041020")
    )
  )
  (if (= m_DWG_NAME "6") ; W45-R175-L-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824012003")
    )
  )
  (if (= m_DWG_NAME "7") ; W45-R175-R-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824012004")
    )
  )
  (if (= m_DWG_NAME "8") ; W90-R175-L-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824012001")
    )
  )
  (if (= m_DWG_NAME "9") ; W45-R175-R-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824012002")
    )
  )
  (if (= m_DWG_NAME "10") ; S45-R175-L-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084023")
    )
  )
  (if (= m_DWG_NAME "11") ; S45-R175-R-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084022")
    )
  )
  (if (= m_DWG_NAME "12") ; S90-R175-400
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084024")
    )
  )
  
  (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_R175 ( / 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 R175  *******")
  (prompt "")
  (if (null m_DWG_NAME)(setq m_DWG_NAME "0"))     ; Anfangssymbolname 
  (Dbox)
  (prompt "")
  (datain)
  (geometrie)
	(setvar "osmode" ALTFANG)  
)
