;------------------------------------------------------------------------;
; ILS 2100 - ANGEBOTSMODULE                                              ;
;------------------------------------------------------------------------;
; AW 17.10.06                                                            ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/ils2100/ILS_ANGEBOT_MODULE.DCL")))
  (if (not (new_dialog "ILS_ANGEBOT_MODULE" Dat)) (exit))
  (set_tile "DWG_NAME" m_DWG_NAME); Blockname
  (set_tile "ART"     m_ART)  
  (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 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 "ils2100(modul1)")
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "ils2100(modul2)")
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "ils2100(modul3)")
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "ils2100(modul4)")
  )
  (if (= m_DWG_NAME "4") 
    (slide_image 0 0 breite hoehe "ils2100(modul5)")
  )
  (if (= m_DWG_NAME "5") 
    (slide_image 0 0 breite hoehe "ils2100(modul1_3)")
  )
  (if (= m_DWG_NAME "6") 
    (slide_image 0 0 breite hoehe "ils2100(modul2_3)")
  )
  (end_image)
)

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

(defun setpara()
  (setq m_DWG_NAME (get_tile "DWG_NAME"))
  (setq m_ART    (get_tile "ART"))  
)

(defun datain ()  
  (setq dummy nil)
)

(defun geometrie()
  (if (= m_DWG_NAME "0") 
    (progn
      (setq NEV "SEPARATOR LINKS - RAD")
      (setq BL_NAME "829432001")
      (PNEUM_SEP)
    )
  )
  (if (= m_DWG_NAME "1") 
    (progn
      (setq NEV "SEPARATOR RECHTS - RAD")    
      (setq BL_NAME "829432002")
      (PNEUM_SEP)
    )
  )
  (if (= m_DWG_NAME "2") 
    (progn
      (setq NEV "SEPARATOR LINKS - LP")    
      (setq BL_NAME "829432003")
      (PNEUM_SEP)
    )
  )
  (if (= m_DWG_NAME "3") 
    (progn
      (setq NEV "SEPARATOR RECHTS - LP")    
      (setq BL_NAME "829432004")
      (PNEUM_SEP)
    )
  )
  (if (= m_DWG_NAME "4") 
    (progn
      (setq NEV "SEPARATOR SP")    
      (setq BL_NAME "829432005")
      (PNEUM_GEFAELLE)
    )
  )
  (if (= m_DWG_NAME "5") 
    (progn
      (setq NEV "STOPPER - SP")    
      (setq BL_NAME "829432006")
      (PNEUM_GEFAELLE)      
    )
  )
  

  (command "_layer" "_m" "ILS-COMPONENTS" "_c" "8" "" "")
  (setq P0  (getpoint "\nPick insert point: "))
  (bl-name P0) ;--> Block-Name definieren -> Rckgabe: element-name          
  (setq BL_NAME (strcat lw "/acadsst/ils2100/" BL_NAME))
  (command "_insert" BL_NAME P0 "" "" pause)
  (attribute-aendern "" "" "" "" "" block-kennung "" "" "" "")		

  (setq AUSWAHL-SATZ (ssget "_L"))
  (EINZELTEIL E_ARTINR E_BEZEICHNUNG "1")
  (mach-block P0 "0" AUSWAHL-SATZ)
  (attribute-aendern "0" "2" "3" "0" "0" block-kennung "333333333" (strcat NEV "MIT " E_BEZEICHNUNG) "1" "")

)

(defun EINZELTEIL (E_ARTINR E_BEZEICHNUNG E_MENGE)
  (command "_layer" "_m" "ILS-COMPONENTS" "_c" "8" "" "")  
  (command "_insert" (strcat lw "/acadsst/ils2100/d_einzel") P0 "" "" "0") 
  (attribute-aendern "0" "0" "23" "" "" block-kennung E_ARTINR E_BEZEICHNUNG E_MENGE "")     
  (ssadd (entlast) AUSWAHL-SATZ)
)

(defun PNEUM_SEP ()
  (if (= m_PNEUM "PNEUM_1")
    (progn
      (setq E_ARTINR "829 434 101")
      (setq E_BEZEICHNUNG "BOSCH-PNEUMATIK-SATZ")
    )
  )
  (if (= m_PNEUM "PNEUM_2")
    (progn
      (setq E_ARTINR "829 434 121")
      (setq E_BEZEICHNUNG "SMC-PNEUMATIK-SATZ")
    )
  )
)

(defun PNEUM_GEFAELLE ()
  (if (= m_PNEUM "PNEUM_1")
    (progn
      (setq E_ARTINR "829434100")
      (setq E_BEZEICHNUNG "BOSCH-PNEUMATIK-SATZ")
    )
  )
  (if (= m_PNEUM "PNEUM_2")
    (progn
      (setq E_ARTINR "829434120")
      (setq E_BEZEICHNUNG "SMC-PNEUMATIK-SATZ")
    )
  )
)

;------------------------------------------------------------------------------
(defun c:ILS_ANBAU_STR ( / 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 "**** ILS SEPARATORS/STOPPER *******")
  (prompt "")
  (if (null m_DWG_NAME)(setq m_DWG_NAME "0"))        ; Anfangssymbolname 
  (if (null m_PNEUM)    (setq m_PNEUM "PNEUM_1"))    ; Pneumatik  
  (Dbox)
  (prompt "")
  (datain)
  (geometrie)
	(setvar "osmode" ALTFANG)  
)
