ICalculatorInitialize Method

Initializes the calculator to start calculating

Namespace:  Tekla.Structural.InteropAssemblies.TeddsCalc
Assembly:  Tedds.TeddsCalcIA (in Tedds.TeddsCalcIA.dll) Version:
void Initialize(
	[OptionalAttribute] string inputRtf,
	[OptionalAttribute] string variables,
	[OptionalAttribute] string sectionName,
	int sectionId = 0,
	int pageWidth = 180,
	int pageHeight = 260


inputRtf (Optional)
Type: SystemString
Optional input formatted in Microsoft Rich Text Format(RTF) which will be calculated
variables (Optional)
Type: SystemString
Xml string of the variables to initialize the calculator with, usually created by GetVariables
sectionName (Optional)
Type: SystemString
Calc Section name
sectionId (Optional)
Type: SystemInt32
Calc Section unique numeric identifier
pageWidth (Optional)
Type: SystemInt32
Output page width in twips, default is 180 twips
pageHeight (Optional)
Type: SystemInt32
Output page height in twips, default is 260 twips

The initialize method is often used without any parameters, the optional parameters are required to run an existing calculation or to retrieve the final output, however also consider using InitializeCalc.

The inputRtf is required if you want to calculate an existing RTF source, for example if you wanted to integrate Tedds with an alternative word processor you would get the RTF from the document and pass it as this parameter so that Tedds would calculate the expressions in the RTF. The inputRtf is also required if you want to obtain output RTF once calculating is finished. Output is obtained by using the GetOutput method but if no inputRtf has been specified to the Initialize function (or the InitializeCalc function) then GetOutput will not return any output.

If the calculator has been used to perform a calculation and you want to save the variables so that they can be used for re-calculating then you can use the optional variables parameter to initialise the calculator with the previously saved variables. The variables from a previous calculation are retrieved by using the GetVariables function.

//Create calculator
ICalculator calculator = new Calculator();

//Initialize first time

//Set all required variables
calculator.functions.SetVar("L", 1500, "mm");
calculator.functions.SetVar("W", 750, "mm");

//Calculate an expression
double area = calculator.Functions.Eval("L * W").ToDouble("mm^(2)");
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.