;------------------------------------------------------------------------;
; ALU-KOMPONENTEN - HFS_MOD.LSP                                          ;
;------------------------------------------------------------------------;
; AW 14.06.97 / 15.8.98 / 19.9.06 / 11.01.07                             ;
;------------------------------------------------------------------------;
(defun Dbox (/ Dat)
  (setq Dat (load_dialog (strcat lw "/acadsst/ils2100/ILS_ANBAU_STR.DCL")))
  (if (not (new_dialog "ILS_ANBAU_STR" Dat)) (exit))

  (set_tile "DWG_NAME" m_DWG_NAME); Blockname
  (set_tile "PNEUM" m_PNEUM)
  (set_tile "ANBAU" m_ANBAU)
  (set_tile "ABHANG" m_ABHANG)    

  (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(SEP_EH_A)") ; rapid fire LINKS
  )
  (if (= m_DWG_NAME "1") 
    (slide_image 0 0 breite hoehe "ils2100(SEP_EH_B)") ; rapid fire RECHTS
  )
  (if (= m_DWG_NAME "2") 
    (slide_image 0 0 breite hoehe "ils2100(SEP_DH_A)") ; Separator Doppel-Hub (Gefälle) LINKS
  )
  (if (= m_DWG_NAME "3") 
    (slide_image 0 0 breite hoehe "ils2100(SEP_DH_B)") ; *SONDER* Separator Doppel-Hub (Gefälle) RECHTS
  )
  (end_image)
)

(defun zeig_dia()
  (setq m_DWG_NAME (get_tile "DWG_NAME"))
  (if (or (= m_DWG_NAME "0") (= m_DWG_NAME "1"))  ; Einfach-Hub Separator LINKS oder RECHTS  
    (progn
			(mode_tile "PNEUM" 0)
			(mode_tile "ANBAU" 1)  
			(mode_tile "ABHANG" 0)  
		)
	)
  (if (= m_DWG_NAME "2")  ; Doppel-Hub Separator  LINKS
    (progn
    	(setq m_ANBAU "ANBAU_2") 
		  (set_tile "ANBAU" "ANBAU_2")
			(mode_tile "PNEUM" 0)
			(mode_tile "ANBAU" 0)  
			(mode_tile "ABHANG" 1)  
		)
	)
  (if (= m_DWG_NAME "3")  ; Doppel-Hub Separator SONDER RECHTS  
    (progn
    	(setq m_ANBAU "ANBAU_3") 
		  (set_tile "ANBAU" "ANBAU_3")
			(mode_tile "PNEUM" 0)
			(mode_tile "ANBAU" 0)  
			(mode_tile "ABHANG" 1)  
		)
	)
	(SetDia)
)

(defun setpara()
  (setq m_DWG_NAME (get_tile "DWG_NAME"))
  (setq m_PNEUM    (get_tile "PNEUM"))  
  (setq m_ABHANG   (get_tile "ABHANG"))  
  (setq m_ANBAU    (get_tile "ANBAU"))  
)

(defun datain ()  
  (setq dummy nil)
)

(defun geometrie()
  (if (= m_DWG_NAME "0") 
    (progn
      (setq NEV "SEPARATOR 1-HUB LINKS")
      (setq BL_NAME "829432001A")
      (PNEUM_SEP)
    )
  )
  (if (= m_DWG_NAME "1") 
    (progn
      (setq NEV "SEPARATOR 1-HUB RECHTS")    
      (setq BL_NAME "829432001B")
      (PNEUM_SEP)
    )
  )
  (if (= m_DWG_NAME "2") 
    (progn
      (setq NEV "SEPARATOR 2-HUEBE LINKS")    
      (setq BL_NAME "829432005A")
      (PNEUM_GEFAELLE)
    )
  )
  (if (= m_DWG_NAME "3") 
    (progn
      (setq NEV "SEPARATOR 2-HUEBE RECHTS [*SONDER*]")    
      (setq BL_NAME "829432005B")
      (PNEUM_GEFAELLE)
    )
  )

  (command "_layer" "_m" "ILS-COMPONENTS" "_c" "7" "" "")
  (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"))
  
	;<<< Pneumatik setzen
  (EINZELTEIL E_ARTINR E_BEZEICHNUNG "1" "0")
	;<<< Abhänger für Einfach-Hub Separator
	(if (or (= m_DWG_NAME "0") (= m_DWG_NAME "1"))
		(ABHAENGER)
	)
	;<<< Für Separator in Gefälle immer das gleiche Profil
	(if (or (= m_DWG_NAME "2") (= m_DWG_NAME "3"))
		(progn
			(EINZELTEIL "829434312" "ABHAENGUNG F.SEP.GEFAELLESTRECKE KPL." "1" "20")
			(setq NEV (strcat NEV "+" "ABH.GEFAELLE"))
		)
	)
	
	;<<< Anbau [LINKS ]für Separator Doppel-Hub
	(if (or (= m_DWG_NAME "2") (= m_DWG_NAME "3"))
	  (progn
		(if (= m_ANBAU "ANBAU_2")
			(progn
				(EINZELTEIL "829434320" "ANBAU [LINKS] MT-TRAVERSENSTOPPER AN SEP. KPL." "1" "30")
				(setq NEV (strcat NEV "+" "ANBAU [LINKS] MT"))
			)
		)
		(if (= m_ANBAU "ANBAU_3")
			(progn
				(EINZELTEIL "829434321" "ANBAU [RECHTS] MT-TRAVERSENSTOPPER AN SEP. KPL." "1" "30")
				(setq NEV (strcat NEV "+" "ANBAU [RECHTS] MT"))
			)
		)
		)
	)
	
  (mach-block P0 "0" AUSWAHL-SATZ)
	(setq NEV (strcat NEV " KPL."))
  (attribute-aendern "0" "2" "3" "0" "0" block-kennung "333333333" NEV "1" "")

)

(defun PNEUM_SEP ()
  (if (= m_PNEUM "PNEUM_1")
    (progn
      (setq E_ARTINR "829434101")
      (setq E_BEZEICHNUNG "BOSCH-PNEUM.F.EINFACH-HUB KPL.[829434101]")
      (setq NEV (strcat NEV "+" "BOSCH"))
    )
  )
  (if (= m_PNEUM "PNEUM_2")
    (progn
      (setq E_ARTINR "829434121")
      (setq E_BEZEICHNUNG "SMC-PNEUM.F:EINFACH-HUB KPL.[829434121]")
      (setq NEV (strcat NEV "+" "SMC"))      
    )
  )
)

(defun PNEUM_GEFAELLE ()
  (if (= m_PNEUM "PNEUM_1")
    (progn
      (setq E_ARTINR "829434100")
      (setq E_BEZEICHNUNG "BOSCH-PNEUM.F.DOPPEL-HUB KPL.[829434100]")
      (setq NEV (strcat NEV "+" "BOSCH"))    
    )
  )
  (if (= m_PNEUM "PNEUM_2")
    (progn
      (setq E_ARTINR "829434120")
      (setq E_BEZEICHNUNG "SMC-PNEU.F.DOPPEL-HUB KPL.[829434120]")
      (setq NEV (strcat NEV "+" "SMC"))      
    )
  )
)

(defun ABHAENGER ()
  (if (= m_ABHANG "ABHANG_1")  ; Abhängung an Monster-Profil LP
  	(progn
			(EINZELTEIL "829434310" "ABHAENGUNG F.SEP.AN TRAEGERPROFIL" "1" "10")
			(setq NEV (strcat NEV "+" "ABH.MONSTER-LP"))
    )
	)    
  (if (= m_ABHANG "ABHANG_2")  ; Abhängung an Monster-Profil LP für PIN
  	(progn
			(EINZELTEIL "829434310" "ABHAENGUNG F.SEP.AN TRAEGERPROFIL" "1" "10")
			(setq NEV (strcat NEV "+" "ABH.MONSTER-LP F.PIN"))
    )
	)    
  (if (= m_ABHANG "ABHANG_3")	; Abhängung an LP
  	(progn
			(EINZELTEIL "829434311" "ABHAENGUNG F.SEP.AN LP KPL." "1" "10")
			(setq NEV (strcat NEV "+" "ABH.AN LP"))
		)
  )
)

(defun EINZELTEIL (E_ARTINR E_BEZEICHNUNG E_MENGE WINKEL)
  (command "_layer" "_m" "ILS-COMPONENTS" "_c" "7" "" "")  
  (command "_insert" (strcat lw "/acadsst/ils2100/d_einzel") P0 "" "" WINKEL) 
  (attribute-aendern "0" "0" "23" "" "" block-kennung E_ARTINR E_BEZEICHNUNG E_MENGE "")     
  (ssadd (entlast) AUSWAHL-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 SEPARATOR/STOPPER *******")
  (prompt "")
  (if (null m_DWG_NAME) (setq m_DWG_NAME "0"))          ; Anfangssymbolname 
  (if (null m_PNEUM)    (setq m_PNEUM "PNEUM_2"))       ; SMC Pneumatik  
  (if (null m_ABHANG)   (setq m_ABHANG "ABHANG_1"))     ; Abhänger  
  (if (null m_ANBAU)    (setq m_ANBAU "ANBAU_1"))       ; Anbaubaugruppe für Separator Doppelhub
   
  (Dbox)
  (prompt "")
  (datain)
  (geometrie)
	(setvar "osmode" ALTFANG)  
)
