Hello Everyone,
i have an string type property for PIPE, "CUT_LEN" added in the schema.
string expression is set as IIF(this.EC_CLASS_NAME = "PIPE", (this.LENGTH + this.FIELD_FIT_LENGTH) & " mm", "1")
Everything works fine but the precision value in CUT_LEN property shows multiple digits.i.e. CUT_LEN=4877.82456595192 mm
how to round of this values?
that means CUT_LEN= 4877 mm
Thanks in Advance!
Regards,
Vishal
Hello Vishal,
Thank you for posting your query on Bentley Communities. We will forward this query to the concerned person.Meanwhile can you specify the Tool that you asking the query about.You can refer to the following article which describes the similar scenario for OpenPlant:-
Also adding the below article which will guide you to modify the dimension precision:-
Regards,Devendra WarkeBentley Systems
You did not indicate which version of product you are using, however, in V8i, you can take advantage of .NET System.Math functions. The example below was used in OpenPlant PID but should be applicable elsewhere. This is NOT an example specific to your requirement, but IS an example to provide guidance.
Using System.Math.Round to round a value (double) and store it in a string propertyThis method of using System strings will use the System.Math symbol set to take a value from a property that is atype of double, round it to a whole number and store this on a property of type string.
1. Load the Bentley Class Editor.2. Locate the PIPING_NETWORK_SYSTEM class.3. Switch to the Properties tab and select the INSULATION property.4. Add a Calculated ECProperty Specification custom attribute and fill it in as shown below.
5. Save the schema.6. To test this – launch OpenPlant PID and create a drawing. Execute the Major Pipeline task. Locate the Nominal Length property on the pipeline and enter a value of 4.44.
Note that the Insulation property gets this value rounded to the nearest whole number – 4.
7. Breaking down the ECExpression we get:
Section
Description
NOTES
System.Math
Starts the Expression
Is Required
Round
System math method
This forces the value to be rounded based on basic math rounding principals – 1.1 to 1.5 will round to 1. 1.51 to 1.99 will round to 2.
this.NOMINAL_LENGTH
The property whose value you want to populate Insulation
8. An alternative expression would be System.Math.Round(this.NOMINAL_SIZE, 1). This would round the value to 1 decimal place. Likewise a value of “2” would round to 2 decimal places and so on.
I hope this helps,
Tony DeRosa
Senior Application Engineer
Bentley Plant
Answer Verified By: Vishal Girase
Thanks Tony & Devendra for your reply!
Am using Open plant modeler v8i ss6 and version 08.11.11.87
as suggested by Tony, the changes are made in the schema but not get the correct results.
i have an EC expression having summation of two properties.
following screen shot is attached for reference
hope this will gives more clarity.
Thanks
Hi Tony and Devendra,
i got the solution as suggested by Tony,
the formula should be
IIF(this.EC_CLASS_NAME = "PIPE",System.Math.Round(this.LENGTH + this.FIELD_FIT_LENGTH) & " mm", "1")
i get the precision value as set by above expression.
thanks both of you