ICalculatorInitializeCalc Method |
Initializes the calculator and starts calculating using the specified Calc Library Item
Namespace: Tekla.Structural.InteropAssemblies.TeddsCalc
Assembly: Tedds.TeddsCalcIA (in Tedds.TeddsCalcIA.dll) Version: 25.0.0.0
Syntax
void InitializeCalc( string calcFileName, string calcItemName, [OptionalAttribute] string variables, [OptionalAttribute] string sectionName, int sectionId = 0, int pageWidth = 180, int pageHeight = 260 )
Parameters
- calcFileName
- Type: SystemString
File name of the Calc Library file which contains the calc item to calculate - calcItemName
- Type: SystemString
Item name of the Calc Item to calculate - variables (Optional)
- Type: SystemString
Xml string of the variables to initialize the calculator instance with - sectionName (Optional)
- Type: SystemString
Initial section name - sectionId (Optional)
- Type: SystemInt32
Initial section 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
Remarks
The fileName and itemName are required and determine the Calc Item in the specified Calc Library which will
be calculated. If you want to retrieve the document output when calculating is finished the calc item you
calculate must be in the RTF format. Output is obtained by using the
GetOutput method.
If the calculator has been used to perform a calculation and you want to save the variables so that they can
be used at a later date 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 method.
Examples
Example which uses the "Bearing pressures for rectangular footings" calculation
Example which uses the "Bearing pressures for rectangular footings" calculation and specifies the input
for the design
//Library file name and item name of calculation to use string calcFileName = "$(SysLbrDir)Bearing pressure.lbr"; string calcItemName = "Bearing pressures"; //Create Tedds calculator Calculator calculator = new Calculator(); //Start calculating calculator.InitializeCalc(calcFileName, calcItemName);
//Library file name and item name of calculation to use string calcFileName = "$(SysLbrDir)Bearing pressure.lbr"; string calcItemName = "Bearing pressures"; //Create calculator and initialize for setting up input variables only Calculator calculator = new Calculator(); calculator.Initialize(); //Set all required input variables calculator.Functions.SetVar("Lx", 2000, "mm"); calculator.Functions.SetVar("Ly", 2500, "mm"); calculator.Functions.SetVar("Pz", 150, "kN"); calculator.Functions.SetVar("ex", 600, "mm"); calculator.Functions.SetVar("ey", 550, "mm"); //If all the input required has already been specified you can hide the user interface //of the calculation using a special variable which is supported automatically by all //calculations "_CalcUI" //Uncomment the following line to disable the calculations user interface //calculator.Functions.SetVar("_CalcUI", 0); //Get variables as XML string string variables = calculator.GetVariables(); //Initialize for a second time but this time with calculation to start and variables calculator.InitializeCalc(calcFileName, calcItemName, variables); //Query the calculation results double qmax = calculator.Functions.GetVar("qmax").ToDouble("kN/m^(2)"); double bearing = calculator.Functions.GetVar("BearingPercentage").ToDouble();
See Also