'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright by Weinmann Holzbausystemtechnik GmbH (c) 2003
'
' Filename:		BT4.WMK
'
' Description:	Macro used to create a beam
'
' Author:  		TB32HVR
'
' Date:			20060110
'
' Version:		V0.01
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

SUB MAIN

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' variables and their initializing

DIM BT4_LENGTH			' Laenge des BT4 in X
BT4_LENGTH = 1000
DIM BT4_WIDTH			' Breite des BT4 in Y
BT4_WIDTH = 89
DIM BT4_HEIGHT			' Hoehe des BT4 in Z
BT4_HEIGHT = 38
DIM BT4_XLU			' Punkt links unten in X
BT4_XLU = 200
DIM BT4_YLU			' Punkt links unten in Y
BT4_YLU =60
DIM BT4_XRU			' Punkt rechts unten in X
BT4_XRU = 0
DIM BT4_YRU			' Punkt rechts unten in Y
BT4_YRU =0
DIM BT4_XRO			' Punkt rechts oben in X
BT4_XRO = 2000
DIM BT4_YRO			' Punkt rechts oben in Y
BT4_YRO = 0
DIM BT4_XLO			' Punkt links oben in X
BT4_XLO = 1800
DIM BT4_YLO			' Punkt links oben in Y
BT4_YLO = 60
DIM BT4_INDEX			' Index des BT4
BT4_INDEX = 0
DIM BT4_NAME			' Name BT4
BT4_NAME = "BT4"
DIM BT4_COUNT			' Stueckzahl BT4
BT4_COUNT = 1
DIM BT4_ANGLE_V			' Winkel vorne(naeher X0)
BT4_ANGLE_V = 30.0
DIM BT4_ANGLE_H			' Winkel hinten(naeher X Ende)
BT4_ANGLE_H = 90.0
DIM BT4_TAN_V
BT4_TAN_V = 1.0
DIM BT4_TAN_H
BT4_TAN_H = 1.0
DIM BT4_OFFSET_U
BT4_OFFSET_U = 0
DIM BT4_OFFSET_O
BT4_OFFSET_O = 0
DIM sIni
DIM P0_Title
DIM Offset_Y
Offset_Y = 0


const MACROTITLE = "Macro"

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


P0_Title = GETPRIVATEPROFILESTRING("GENERAL", "P0", " ", sIni)

BT4_LENGTH = InputBoxF("P1:",MACROTITLE,BT4_LENGTH)

IF bInputBoxCancel = 1 THEN
	EXIT SUB	'	WScript.Quit 1
END IF

BT4_WIDTH = InputBoxF("P2:",MACROTITLE,BT4_WIDTH)

IF bInputBoxCancel = 1 THEN
	EXIT SUB	'	WScript.Quit 1
END IF

BT4_HEIGHT = InputBoxF("P3:",MACROTITLE,BT4_HEIGHT)

IF bInputBoxCancel = 1 THEN
	EXIT SUB	'	WScript.Quit 1
END IF

BT4_ANGLE_V = InputBoxF("P4:",MACROTITLE,BT4_ANGLE_V)

IF bInputBoxCancel = 1 THEN
	EXIT SUB	'	WScript.Quit 1
END IF

BT4_ANGLE_H = InputBoxF("P5:",MACROTITLE,BT4_ANGLE_H)

IF bInputBoxCancel = 1 THEN
	EXIT SUB	'	WScript.Quit 1
END IF

BT4_COUNT = InputBoxI(P0_Title,MACROTITLE,BT4_COUNT)

IF bInputBoxCancel = 1 THEN
	EXIT SUB	'	WScript.Quit 1
END IF


BT4_TAN_V = TAN(BT4_ANGLE_V*PI/180)
BT4_TAN_H = TAN(BT4_ANGLE_H*PI/180)

IF BT4_ANGLE_V < 0 THEN
 BT4_ANGLE_V = (BT4_ANGLE_V * -1) + 90
END IF

IF BT4_ANGLE_V < 90 THEN
	BT4_XLU = 0
	BT4_XRU = (BT4_WIDTH/BT4_TAN_V)
ELSE
	IF BT4_ANGLE_V > 90 THEN
		BT4_XLU = ABS(BT4_WIDTH/BT4_TAN_V)
		BT4_XRU = 0
 ELSE
		BT4_XRU = 0
		BT4_XLU = 0
	END IF
END IF

IF BT4_ANGLE_H < 0 THEN
 BT4_ANGLE_H = (BT4_ANGLE_H * -1) + 90
END IF

IF BT4_ANGLE_H < 90 THEN
	BT4_XLO = BT4_LENGTH
	BT4_XRO = BT4_LENGTH - (BT4_WIDTH/BT4_TAN_H)
ELSE
	IF BT4_ANGLE_H > 90 THEN
		BT4_XLO = BT4_LENGTH - ABS(BT4_WIDTH/BT4_TAN_H)
		BT4_XRO = BT4_LENGTH
	ELSE
		BT4_XLO = BT4_LENGTH
		BT4_XRO = BT4_LENGTH
	END IF
END IF

BT4_YLU = BT4_WIDTH
BT4_YRU = 0
BT4_YRO = 0
BT4_YLO = BT4_WIDTH

DIM I

FOR I = 1 TO BT4_COUNT
	BT4 BT4_LENGTH, BT4_WIDTH, BT4_HEIGHT, BT4_XLU, BT4_YLU+Offset_Y, BT4_XRU, BT4_YRU+Offset_Y, BT4_XRO, BT4_YRO+Offset_Y, BT4_XLO, BT4_YLO+Offset_Y, BT4_INDEX, BT4_NAME, 0
	Offset_Y = I*(BT4_WIDTH+50)
NEXT

END SUB

MAIN
