'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright by Weinmann Holzbausystemtechnik GmbH (c) 2004
'
' Filename:             Firstschnitt
'
' Description:          First schnitt
'
' Author:                Zdenek
'
' Date:                        20050609
'
' Version:                V0.01
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

SUB MAIN

 DIM dPX(16)
 DIM i
 DIM sIni
 DIM SLOPE_DEFAULT

 SLOPE_DEFAULT = 30

 '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

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

dPX(0) = 3 'always ebene 3
dPX(6) = 90 ' always perpendicular

'IF MsgBox(GETPRIVATEPROFILESTRING("Anfang/Ende_orientiert", "T1", " ", sIni) & vbCrLf & vbCrLf & _
'   GETPRIVATEPROFILESTRING("Anfang/Ende_orientiert", "T2", " ", sIni), _
'   vbYesNo + vbQuestion, _
'   GETPRIVATEPROFILESTRING("Anfang/Ende_orientiert", "T0", " ", sIni)) = vbYes THEN

   dPX(16) = 2
   dPX(1) = 0
'ELSE
'    dPX(16) = 1
'    dPX(1) = GETPARAM(1) ' balken length
'END IF

dPX(7) = GetTempParam(0)

IF dPX(7) = 0 THEN
   dPX(7) = SLOPE_DEFAULT
END IF

dPX(7) = InputBoxF( _
    GETPRIVATEPROFILESTRING("Firstschnitt", "T1", " ", sIni), _
    GETPRIVATEPROFILESTRING("Firstschnitt", "T0", " ", sIni), _
    dPX(7) )
IF bInputBoxCancel = 1 THEN
   EXIT SUB
END IF
SetTempParam 0,dPX(7)

dPX(7) = 90 - SLOPE_DEFAULT

DIM RETVAL
RETVAL = BTLFUNCTION(dPX(16),10,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
