'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright by Weinmann Holzbausystemtechnik GmbH (c) 2004
'
' Filename:
'
' Description:
'
' Author:		tb32sot
'
' Date:			20040121
'
' Version:		V0.01
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

SUB MAIN

 DIM dPX(16)

	DIM i

 DIM sIni
 DIM P0_Title
 DIM P1_Title
 DIM P2_Title
 DIM P6_Title
 DIM P7_Title
 DIM P11_Title
 DIM P12_Title
 DIM T0_Title
 DIM T1_Title
 DIM T2_Title
 DIM T3_Title
 DIM T4_Title
 DIM T5_Title
 DIM T6_Title
 DIM F_Title

 DIM LS_LENGTH
 DIM LS_WIDTH
 DIM LS_HEIGHT

 DIM Default_P11
 const MACROTITLE = "Macro"

 'Holen Parameterbezeichnungen abhaengig von der Landessprache
 sIni = "l" + GETACTUALLANGUAGE() + ".ini"

IF NOT FINDFIRSTSELECTED THEN
	DIM BEAMCOUNTER

	BEAMCOUNTER = GETCOUNTTYPE(CalcType("LS"))
	BEAMCOUNTER = BEAMCOUNTER + GETCOUNTTYPE(CalcType("QS"))
	BEAMCOUNTER = BEAMCOUNTER + GETCOUNTTYPE(CalcType("BT4"))
	BEAMCOUNTER = BEAMCOUNTER + GETCOUNTTYPE(CalcType("BT6"))

	IF BEAMCOUNTER = 1 THEN
		IF GETCOUNTTYPE(CalcType("LS")) = 1 THEN
			FINDFIRSTTYPE(CalcType("LS"))
		END IF
		IF GETCOUNTTYPE(CalcType("QS")) = 1 THEN
			FINDFIRSTTYPE(CalcType("QS"))
		END IF
		IF GETCOUNTTYPE(CalcType("BT4")) = 1 THEN
			FINDFIRSTTYPE(CalcType("BT4"))
		END IF
		IF GETCOUNTTYPE(CalcType("BT6")) = 1 THEN
			FINDFIRSTTYPE(CalcType("BT6"))
		END IF
	ELSE
	  MsgBox GETPRIVATEPROFILESTRING("Fehler", "F1", " ", sIni), _
		vbOkOnly + vbCritical + vbSystemModal,"Error"
	  exit sub
	END IF
END IF

IF NOT ( ISBEAM OR ( ISBEAMPROCESSING AND SELECTPARENTBEAM() ) ) THEN
  MsgBox GETPRIVATEPROFILESTRING("Fehler", "F2", " ", sIni), _
    vbOkOnly + vbCritical + vbSystemModal,"Error"
  exit sub
END IF

 'Balkendimensionen holen
 'SELECTPARENT
 LS_LENGTH = GETPARAM(1)
 LS_WIDTH  = GETPARAM(2)
 LS_HEIGHT = GETPARAM(3)


' P0_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P0", " ", sIni)
' P1_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P1", " ", sIni)
' P2_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P2", " ", sIni)
' P6_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P6", " ", sIni)
' P7_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P7", " ", sIni)
' P11_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P11", " ", sIni)
' P12_Title = GETPRIVATEPROFILESTRING("Bohrloch", "P12", " ", sIni)


	FOR i = LBOUND(dPX) TO UBOUND(dPX)
		dPX(i) = 0.0
	NEXT

' T0_Title = GETPRIVATEPROFILESTRING("Anfang/Ende_orientiert", "T0", " ", sIni)
' T1_Title = GETPRIVATEPROFILESTRING("Anfang/Ende_orientiert", "T1", " ", sIni)
' T2_Title = GETPRIVATEPROFILESTRING("Anfang/Ende_orientiert", "T2", " ", sIni)


' IF MsgBox(T1_Title & vbCrLf & vbCrLf & T2_Title, vbYesNo + vbQuestion, MACROTITLE) = vbYes THEN
'		dPX(16) = 4
'	ELSE
'		dPX(16) = 3
'	END IF
 dPX(16) = 4

	DO
  T1_Title = GETPRIVATEPROFILESTRING("Ebene", "T1", " ", sIni)
  T2_Title = GETPRIVATEPROFILESTRING("Ebene", "T2", " ", sIni)
  T3_Title = GETPRIVATEPROFILESTRING("Ebene", "T3", " ", sIni)
  T4_Title = GETPRIVATEPROFILESTRING("Ebene", "T4", " ", sIni)
  T5_Title = GETPRIVATEPROFILESTRING("Ebene", "T5", " ", sIni)
  T6_Title = GETPRIVATEPROFILESTRING("Ebene", "T6", " ", sIni)

'		dPX(0) = InputBoxI(T1_Title & vbCrLf & vbCrLf & T2_Title & vbCrLf & vbCrLf & T3_Title & vbCrLf & T4_Title & vbCrLf & T5_Title & vbCrLf & T6_Title & vbCrLf & vbCrLf,MACROTITLE,3)
		dPX(0) = 4

		IF bInputBoxCancel = 1 THEN
			EXIT SUB
		END IF

		IF (1 <= dPX(0)) and (dPX(0) <= 4)  THEN
			EXIT DO
		ELSE
   F_Title = GETPRIVATEPROFILESTRING("Fehler", "F3", " ", sIni)
			MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
		END IF
	LOOP


	dPX(1) = InputBoxF("P1:" & vbCrLf & vbCrLf & P1_Title,MACROTITLE,0)

	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF

'	dPX(2) = InputBoxF("P2:" & vbCrLf & vbCrLf & P2_Title,MACROTITLE,20)
	dPX(2) = InputBoxF("P2:" & vbCrLf & vbCrLf & P2_Title,MACROTITLE,(LS_WIDTH/2))

	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF

'	new do not use
'	dPX(3) = InputBoxF("P3:" & vbCrLf & vbCrLf Abstand von der Bezugsflaeche zum Bezugspunkt. Dieser Parameter sollte nioht benutzt werden.",MACROTITLE,0)

'	IF bInputBoxCancel = 1 THEN
'		EXIT SUB
'	END IF


'	Vorrübergehende ausgeblendet, Funktion nicht aktiv
'	dPX(6) = InputBoxF("P6:" & vbCrLf & vbCrLf & P6_Title,MACROTITLE,90)
'	IF bInputBoxCancel = 1 THEN
'		EXIT SUB
'	END IF
	dPX(6) = 90

'	Vorrübergehende ausgeblendet, Funktion nicht aktiv
'	dPX(7) = InputBoxF("P7:" & vbCrLf & vbCrLf & P7_Title,MACROTITLE,90)
'	IF bInputBoxCancel = 1 THEN
'		EXIT SUB
'	END IF
	dPX(7) = 90


	IF dPX(0) = 1 OR dPX(0) = 3 THEN
		Default_P11 = LS_WIDTH
	ELSE
		Default_P11 = LS_HEIGHT
	END IF

	dPX(11) = InputBoxF("P11:" & vbCrLf & vbCrLf & P11_Title,MACROTITLE,Default_P11)
	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF

	dPX(12) = InputBoxF("P12:" & vbCrLf & vbCrLf & P12_Title,MACROTITLE,12)
	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF

 DIM RETVAL
	RETVAL = BTLFUNCTION(dPX(16),40,dPX(0),dPX(1),dPX(2),dPX(3),dPX(4),dPX(5),dPX(6),dPX(7),dPX(8),dPX(9),dPX(10),dPX(11),dPX(12),dPX(13),dPX(14),dPX(15))

	IF NOT RETVAL THEN
		MsgBox GETLASTERROR,vbOkOnly + vbCritical + vbSystemModal,"Error"
	END IF

END SUB

MAIN
