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

SUB MAIN

 DIM dPX(16)

	DIM i

	const MACROTITLE = "Macro"

 DIM sIni
 DIM F_Title
 DIM BALKEN_LAENGE
 DIM BALKEN_BREITE
 DIM BALKEN_HOEHE
 DIM EBENE
 DIM X_POSITION
 DIM Y_POSITION
 DIM Z_POSITION
 DIM LAENGE
 DIM BREITE
 DIM TIEFE
 DIM INDEX
 DIM WINKEL

' Festwerte
 EBENE      = 5
 Z_POSITION = 0
 INDEX      = 111
 WINKEL     = 0



 '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,MACROTITLE
		  exit sub
		END IF
	END IF

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

' ==========================================================================

	BALKEN_LAENGE = GETPARAM(1)
	BALKEN_BREITE = GETPARAM(2)
	BALKEN_HOEHE = GETPARAM(3)


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

' --- Ebene ---
' DO
'	EBENE = InputBoxFLoc("E:",MACROTITLE,0)
'	IF bInputBoxCancel = 1 THEN
'		EXIT SUB
'	END IF
'	IF (EBENE >= 1 ) and (EBENE <= 4)  THEN
'		EXIT DO
'	ELSE
'	  	F_Title = GETPRIVATEPROFILESTRING("Fehler", "F6", " ", sIni)
'		MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
'	END IF
' LOOP
' ----------------

' --- X_POSITION ---
 DO
	X_POSITION = BALKEN_HOEHE/2
	X_POSITION = InputBoxFLoc("P1:",MACROTITLE,X_POSITION)
	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF
	IF (X_POSITION > 0) and (X_POSITION < BALKEN_HOEHE)  THEN
		EXIT DO
	ELSE
	  	F_Title = GETPRIVATEPROFILESTRING("Fehler", "F6", " ", sIni)
		MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
	END IF
 LOOP
' ----------------

' --- Y_POSITION ---
 DO
	Y_POSITION = BALKEN_BREITE/2
	Y_POSITION = InputBoxF("P2:",MACROTITLE,Y_POSITION)
	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF
	IF (Y_POSITION > 0) and (Y_POSITION < BALKEN_BREITE)  THEN
		EXIT DO
	ELSE
	  	F_Title = GETPRIVATEPROFILESTRING("Fehler", "F6", " ", sIni)
		MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
	END IF
 LOOP
' ----------------

' --- Länge in X ---
 DO
	LAENGE = InputBoxF("P12:",MACROTITLE,20)
 	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF
	IF (LAENGE > 0) and (LAENGE <= BALKEN_HOEHE)  THEN
		EXIT DO
	ELSE
	  	F_Title = GETPRIVATEPROFILESTRING("Fehler", "F6", " ", sIni)
		MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
	END IF
 LOOP
' ----------------

' --- Breite in Y ---
 DO
	BREITE = InputBoxF("P14:",MACROTITLE,50)
 	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF
	IF (BREITE > 0) and (BREITE <= BALKEN_BREITE)  THEN
		EXIT DO
	ELSE
	  	F_Title = GETPRIVATEPROFILESTRING("Fehler", "F6", " ", sIni)
		MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
	END IF
 LOOP
' ----------------

' --- Tiefe ---
 DO
        TIEFE = 50
	TIEFE = InputBoxF("P11:",MACROTITLE,TIEFE)
	IF bInputBoxCancel = 1 THEN
		EXIT SUB
	END IF
	IF (TIEFE > 0) and (TIEFE <= BALKEN_LAENGE)  THEN
		EXIT DO
	ELSE
	  	F_Title = GETPRIVATEPROFILESTRING("Fehler", "F6", " ", sIni)
		MsgBox F_Title,vbOkOnly + vbCritical + vbSystemModal,"Error"
	END IF
 LOOP
' ----------------

'	DIM RETVAL
	PAF EBENE
	PP X_POSITION-(LAENGE/2), Y_POSITION-(BREITE/2), 0-TIEFE, INDEX, WINKEL, Z_POSITION
	PP X_POSITION+(LAENGE/2), Y_POSITION-(BREITE/2), 0-TIEFE, INDEX, WINKEL, Z_POSITION
	PP X_POSITION+(LAENGE/2), Y_POSITION+(BREITE/2), 0-TIEFE, INDEX, WINKEL, Z_POSITION
	PP X_POSITION-(LAENGE/2), Y_POSITION+(BREITE/2), 0-TIEFE, INDEX, WINKEL, Z_POSITION
	PP X_POSITION-(LAENGE/2), Y_POSITION-(BREITE/2), 0-TIEFE, INDEX, WINKEL, Z_POSITION
END SUB
MAIN
