Calculate Annotations

<< Click to Display Table of Contents >>

Navigation:  PlantExpressTools > How to use > Calculations >

Calculate Annotations

Previous pageReturn to chapter overviewNext page

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.

Calculations 25

There is also an additional (calculated) property "PET_LineAnnotation" which shows the same value.

Calculations 28

If we fill out the Insulation Type we see the Tag didn't change, but the annotation now shows an additional -IH.

Calculations 29

If we now look at the PET_LineAnnotation we  see, that the annotation text appears here.

Calculations 30

If we now also add the Insulation Thickness...

Calculations 26

... we see the calculated PET_LineAnnotation with the -50 extension.

Calculations 27

In the PipeLineSegments class we see the additional property and we also see an new annotation.

Calculations 31

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.

Calculations 32

We define a new calculation for this property.

Calculations 33

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.

Calculations 34

This is how it looks in the configuration dialog.

Calculations 35

Everything seems to be ok.

Calculations 36

We save the drawing and see no error either.

Calculations 38

And now we can test by typing in a Type.

Calculations 39

And then a Thickness.

Calculations 40

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.