;------------------------------------------------------------------------;
; STAHL - R650                                                           ;
;------------------------------------------------------------------------;
; AW 05.09.2010                                                          ;
;------------------------------------------------------------------------;

(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/layout/STAHL_TUER_LOESUNGEN.DCL")))
  (if (not (new_dialog "STAHL_TUER_LOESUNGEN" 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(schw400l)")
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "layout(schw400r)")
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "layout(sch1000)")
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "layout(schiebe)")
  )
  (if (= m_DWG_NAME "4") 
    (slide_image 0 0 breite hoehe "layout(tele1000)")
  )
  (if (= m_DWG_NAME "5") 
    (slide_image 0 0 breite hoehe "layout(endp)")
  )
  (if (= m_DWG_NAME "6") 
    (slide_image 0 0 breite hoehe "layout(schst)")
  )
  (if (= m_DWG_NAME "7") 
    (slide_image 0 0 breite hoehe "layout(verbind)")
  )
  (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") ; SS400-L
    (progn
      (setq EBENE "L-2")	  
      (setq BL_NAME "824604002")
    )
  )
  (if (= m_DWG_NAME "1") ; SS400-R
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824604001")
    )
  )
  (if (= m_DWG_NAME "2") ; SS1000
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824604005")
    )
  )
  (if (= m_DWG_NAME "3") ; SCHIEBESCHIENE
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824004020")
    )
  )
  (if (= m_DWG_NAME "4") ; TELESKOP-1000
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "824322010")
    )
  )
  (if (= m_DWG_NAME "5") ;  ENDPLATTE
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821084060")
    )
  )
  (if (= m_DWG_NAME "6") ; SCHRAUBSTOPPER
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "828102010")
    )
  )
  (if (= m_DWG_NAME "7") ; VERBINDUNG INNERHALB BG
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "111111002")
    )
  )
  (if (= m_DWG_NAME "8") ; MUFFE 1" RAL 2000
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "825004005")
    )
  )

  (if (= m_DWG_NAME "9") ; MUFFE 1" RAL 7035
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "825004006")
    )
  )
  
  (if (= m_DWG_NAME "10") ; MUFFE 1" RAL 5018
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "828004005")
    )
  )

  (if (= m_DWG_NAME "11") ; MUFFE 1" SONDERFARBE
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "828004010")
    )
  )

  (if (= m_DWG_NAME "12") ; VERBINDUNGSSET ST/ST OHNE MUFFE
    (progn
      (setq EBENE "L-2")	  	  
      (setq BL_NAME "821114040")
    )
  )
  
  (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_TUER_LOESUNGEN ( / 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_TUER_LOESUNGEN / VERBINDUNGEN *******")
  (prompt "")
  (if (null m_DWG_NAME)(setq m_DWG_NAME "0"))     ; Anfangssymbolname 
  (Dbox)
  (prompt "")
  (datain)
  (geometrie)
  (setvar "osmode" ALTFANG)  
)
