<< Click to Display Table of Contents >> Calculate Annotations |
Please make sure you read through the Calculate simple Example chapter, because we will keep the explanations shorter and you may miss some details.
In this example we calculate the text for the line annotation.
In this picture you see the Tag and it looks like the Tag appears on the line.
There is also an additional (calculated) property "PET_LineAnnotation" which shows the same value.
If we fill out the Insulation Type we see the Tag didn't change, but the annotation now shows an additional -IH.
If we now look at the PET_LineAnnotation we see, that the annotation text appears here.
If we now also add the Insulation Thickness...
... we see the calculated PET_LineAnnotation with the -50 extension.
In the PipeLineSegments class we see the additional property and we also see an new annotation.
If we open the block editor for this annotation we see, that the PET_LineAnnotation property is used.
We also see the Tag property, but this is an invisible attribute.
We define a new calculation for this property.
The expression IsNullOrEmpty([Insulation Type]) checks if the InsulationType property has no value.
Iif(IsNullOrEmpty([Insulation Type]), [Tag],...) if this is the case, then only use Tag for the annotation.
Iif(IsNullOrEmpty([Insulation Thickness]), [Tag] + '-' + [Insulation Type],...) The next level is used of Insulation Type HAS a value. Then we check if the Insulation Thickness has no value. If this is the case, then we combine Tag and Insulation Type with a delimiter in between. [Tag] + '-' + [Insulation Type].
If Insulation Thickness has a value, then we combine Tag, Type and Thickness into one value. [Tag] + '-' + [Insulation Type] + '-' + [Insulation Thickness]
It is advantageous to use the TAB key to structure your expression to make it easier to read in cases where Iif is used.
This is how it looks in the configuration dialog.
Everything seems to be ok.
We save the drawing and see no error either.
And now we can test by typing in a Type.
And then a Thickness.
This example doesn't handle the case, that only the Thickness is given but no Type. In this case the Thickness won't show up.
Next Chapter: Calculate FlowData (complex) with PlantLink