;------------------------------------------------------------------------;
; ALU-KOMPONENTEN - ILS_AE_ELEM.LSP                                          ;
;------------------------------------------------------------------------;
; AW 14.06.97 / 15.8.98 / 20.9.06                                        ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/ils2100/ILS_AE_ELEM.DCL")))
  (if (not (new_dialog "ILS_AE_ELEM" Dat)) (exit))
  (set_tile "DWG_NAME" m_DWG_NAME); Blockname
  (set_tile "PNEUM"     m_PNEUM)  
  (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(29412018)")   ; AS LINKS [BG]
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "ils2100(29412020)")   ; AS RECHTS [BG]
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "ils2100(29412021)")   ; ES LINKS
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "ils2100(29412017)")   ; ES RECHTS
  )
  (if (= m_DWG_NAME "4") 
    (slide_image 0 0 breite hoehe "ils2100(29412022)")   ; AS LINKS MIT SMC PNEUMATIK
  )
  (if (= m_DWG_NAME "5") 
    (slide_image 0 0 breite hoehe "ils2100(29412023)")   ; AS RECHTS MIT SMC PNEUMATIK
  )
  (end_image)
)

(defun zeig_dia()
  (setq m_DWG_NAME (get_tile "DWG_NAME"))
  (setq m_PNEUM    (get_tile "PNEUM"))
  (if (or (= m_DWG_NAME "0") (= m_DWG_NAME "1
				"))  ; AS LINKS oder RECHTS als BG
    (progn
      (mode_tile "PNEUM_1" 0)
      (mode_tile "PNEUM_2" 0)
    )
    (progn
      (mode_tile "PNEUM_1" 1)
      (mode_tile "PNEUM_2" 1)
    )
  )
  (SetDia)
)

(defun setpara()
  (setq m_DWG_NAME (get_tile "DWG_NAME"))
  (setq m_PNEUM    (get_tile "PNEUM"))  
)

(defun datain ()  
  (setq dummy nil)
)

(defun geometrie()
  (if (= m_DWG_NAME "0") 
    (progn
      (setq BL_NAME "829412018")
      (setq NEV "AS-ELEMENT LINKS ")
      (if (= m_PNEUM "PNEUM_1")
        (progn
          (setq E_ARTINR "829434103")
          (setq E_BEZEICHNUNG "BOSCH-PNEUMATIK-SATZ [829434103]")
        )
      )
      (if (= m_PNEUM "PNEUM_2")
        (progn
          (setq E_ARTINR "829434123")
          (setq E_BEZEICHNUNG "SMC-PNEUMATIK-SATZ [829434123]")
        )
      )
    )
  )
  (if (= m_DWG_NAME "1") 
    (progn
      (setq NEV "AS-ELEMENT RECHTS ")    
      (setq BL_NAME "829412020")
      (if (= m_PNEUM "PNEUM_1")
        (progn
          (setq E_ARTINR "829434103")
          (setq E_BEZEICHNUNG "BOSCH-PNEUMATIK-SATZ [829434103]")
        )
      )
      (if (= m_PNEUM "PNEUM_2")
        (progn
          (setq E_ARTINR "829434123")
          (setq E_BEZEICHNUNG "SMC-PNEUMATIK-SATZ [829434123]")
        )
      )
    )  
  )
  (if (= m_DWG_NAME "2") 
    (progn
      (setq NEV "")
      (setq BL_NAME "829412021")
      (setq E_ARTINR "")
      (setq E_BEZEICHNUNG "")
    )  
  )
  (if (= m_DWG_NAME "3") 
    (progn
      (setq NEV "")
      (setq BL_NAME "829412017")
      (setq E_ARTINR "")
      (setq E_BEZEICHNUNG "")
    )  
  )
  (if (= m_DWG_NAME "4") 
    (progn
      (setq NEV "")
      (setq BL_NAME "829412022")
      (setq E_ARTINR "")
      (setq E_BEZEICHNUNG "")
    )  
  )
  (if (= m_DWG_NAME "5") 
    (progn
      (setq NEV "")
      (setq BL_NAME "829412023")
      (setq E_ARTINR "")
      (setq E_BEZEICHNUNG "")
    )  
  )
  (command "_layer" "_m" "ILS-AE-AS" "_c" "4" "" "")
  (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 "" "" "" "")  
  
  (if (or (= m_DWG_NAME "0") (= m_DWG_NAME "1"))  ; AS-Element als BG
    (progn
      (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" "7" "" "")  
  (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 c:ILS_AE_ELEM ( / 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 MODULS *******")
  (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)  
)
