'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright by Weinmann Holzbausystemtechnik GmbH (c) 2005
'
' Filename:                Makro_4.WMK
'
' Description:        Bau Vila Makrodefinition, Makro 4
'
' Author:                Mikan
'
' Date:                        20050510
'
' Version:                V0.01
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

const MACROTITLE = "Macro"

SUB MAIN

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
DIM sIni
DIM F_Title
DIM BALKEN_WIDTH
DIM EBENE
DIM DEPTH_RESERVE
DIM KORREKTUR
DIM WINKEL_ALPHA
DIM WINKEL_GAMMA
DIM WINKEL_STEIGUNG
DIM WINKEL_SEMA

DIM WIDTH_HALF
DIM DEPTH_CUT

'INITIALISIERUNG DER KONSTANTEN
EBENE = 1        'Bezugsebene
DEPTH_RESERVE = 0 '50 mm ausfahren
KORREKTUR = 2    'keine korrektur
WINKEL_ALPHA = 90    '
WINKEL_GAMMA = 135    '
WINKEL_STEIGUNG = 0    ' gilotina
WINKEL_SEMA = 0          ' do not convert

'Holen Parameterbezeichnungen abhaengig von der Landessprache
sIni = "BV_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_WIDTH = GETPARAM(2)


WIDTH_HALF = BALKEN_WIDTH/2     'Cut point

DO
  DEPTH_RESERVE = InputBoxFLoc( _
    GETPRIVATEPROFILESTRING("DepthReserve", "T0", " ", sIni) & vbCrLf & vbCrLf & _
    GETPRIVATEPROFILESTRING("DepthReserve", "T1", " ", sIni), MACROTITLE, DEPTH_RESERVE)

  IF bInputBoxCancel = 1 THEN
     EXIT SUB
  END IF
  IF (0 <= DEPTH_RESERVE) and (DEPTH_RESERVE <= WIDTH_HALF)  THEN
    EXIT DO
  ELSE
  MsgBox GETPRIVATEPROFILESTRING("Fehler", "F4", " ", sIni),vbOkOnly+vbCritical+vbSystemModal,MACROTITLE
  END IF
LOOP

DEPTH_CUT = WIDTH_HALF + DEPTH_RESERVE

SG WIDTH_HALF, BALKEN_WIDTH, 0, WINKEL_ALPHA, WINKEL_GAMMA, DEPTH_CUT, EBENE, KORREKTUR, WINKEL_STEIGUNG, WINKEL_SEMA

END SUB
MAIN