Tutorials

Every DN (Nominal Diameter) used in a piping class, an elbow class or a piping component must beforehand be declared in the file nominal-sizes.xml. If this rule is not followed, Rhinopiping won’t be able to start when launching Rhinoceros.

This file’s path is located in RhinoPiping “catalogs” folder. With windows 7, the default full path is: “C:\ProgramData\Navinn\catalogs\nominal-sizes.xml”

This file has two roles:

  • Limit the allowed DN to a predefined list
  • Manage the equivalence between the DN (Nominal Diameter) and the NPS (Nominal Pipe Size – American standard)

The values must absolutely be ascending.
For example to add the NPS 6 3/4 , we must add it between NPS 6 1/2 and NPS 8:

<?xml version="1.0"?>
<nominal-sizes>
<item NPS="1/8" DN="6"></item>
<item NPS="1/4" DN="8"></item>
<item NPS="3/8" DN="10"></item>
<item NPS="1/2" DN="15"></item>
<item NPS="3/4" DN="20"></item>
<item NPS="1" DN="25"></item>
<item NPS="1 1/4" DN="32"></item>
<item NPS="1 1/2" DN="40"></item>
<item NPS="2" DN="50"></item>
<item NPS="2 1/4" DN="63"></item>
<item NPS="2 1/2" DN="65"></item>
<item NPS="2 3/4" DN="75"></item>
<item NPS="3" DN="80"></item>
<item NPS="3 1/2" DN="90"></item>
<item NPS="4" DN="100"></item>
<item NPS="4 1/2" DN="110"></item>
<item NPS="5" DN="125"></item>
<item NPS="5 1/2" DN="140"></item>
<item NPS="6" DN="150"></item>
<item NPS="6 1/2" DN="160"></item>
<item NPS="6 3/4" DN="175"></item>
<item NPS="8" DN="200"></item>
<item NPS="10" DN="250"></item>
<item NPS="12" DN="300"></item>
<item NPS="14" DN="350"></item>
<item NPS="16" DN="400"></item>
<item NPS="18" DN="450"></item>
<item NPS="20" DN="500"></item>
<item NPS="22" DN="550"></item>
<item NPS="24" DN="600"></item>
<item NPS="26" DN="650"></item>
<item NPS="28" DN="700"></item>
<item NPS="30" DN="750"></item>
<item NPS="32" DN="800"></item>
<item NPS="34" DN="850"></item>
<item NPS="36" DN="900"></item>
<item NPS="38" DN="950"></item>
<item NPS="40" DN="1000"></item>
<item NPS="42" DN="1050"></item>
<item NPS="44" DN="1100"></item>
<item NPS="46" DN="1150"></item>
<item NPS="48" DN="1200"></item>
<item NPS="56" DN="1400"></item>
</nominal-sizes>

Every pipe class definition files are declared in the file pipe-classes.xml

This file is located in RhinoPiping’s “catalogs\pipe” folder. With windows 7 the default full path is: “C:\ProgramData\Navinn\catalogs\pipe\pipe-classes.xml”

In the example below, lines 3-4 are defining the existing attributes for the pipe classes. The “name” option is mandatory, the “type” option is not mandatory, and the “default” option is not mandatory but higly recommended, because when missing it may prevent the command AA_Report to run as it should.

The lines 6-7 are the respective paths of the secondary xml files where the pipe classes are defined. These files should be located in the same folder as for pipe-classes.xml.
Using secondary xml files like this is only to help getting a clean structure, it does not correlate with the classes tree in RhinoPiping.

<?xml version="1.0"?>
<pipe-classes>    <attribute name="lineic_mass" type="lineic-mass" default="N/A"></attribute>
<attribute name="CATALOG:Material" default="N/A"></attribute>
<include path="stainless-steel-ANSI-ASME-B36.19M-1985.xml"></include>
<include path="steel-ANSI-ASME-B36.10M-1995.xml"></include>
</pipe-classes>

Now let say we need to add a copper piping class and register it in a new file named “Coper.xml”. We will declare it like this:

<?xml version="1.0"?>
<pipe-classes>    <attribute name="lineic_mass" type="lineic-mass" default="N/A"></attribute>
<attribute name="CATALOG:Material" default="N/A"></attribute>
<include path="stainless-steel-ANSI-ASME-B36.19M-1985.xml"></include>
<include path="steel-ANSI-ASME-B36.10M-1995.xml"></include>
<include path="Copper.xml"></include>
</pipe-classes>

Then we will create a “Copper.xml” file in \Navinn\catalogs\pipe where the class will be registered. We could set every data in this file, but to make it easier, RhinoPiping let you define the values in a csv file, called from this xml.
let see how it works:

<?xml version="1.0"?>
<category name="CopperClass" OD-unit="mm" thickness-unit="mm">
    <pipe-class name="CustomClass/Class1">
        <import-csv path="CustomPipeClass\CopperClass1.csv" separator=";">
            <DN></DN>
            <OD></OD>
            <thickness></thickness>
            <attribute:lineic_mass></attribute:lineic_mass>
            <attribute:CATALOG:Material></attribute:CATALOG:Material>
        </import-csv>
    </pipe-class>
</category>

The line 2 defines the category name for this class, and the units used for OD (outside diameters) and Thickness.
The line 3 defines the class name and its tree position in RhinoPiping. In the example, the tree is set to: CopperClass / CustomClass / Class1.
The line 4 let us define the path for a .csv file where the values will be. With the option separator, it’s also possible to choose the separator for this file. The csv is imported by columns in the same order as the attributes declaration in the xml file.
The lines 5 à 7 are mandatory internal attributes:
DN (nominal diameter) : The theoretical nominal diameter of the pipe. (Can be different with the real diameter). It is possible to use the NPS attribute instead.
OD (Outside Diameter): The pipe’s real outside diameter
thickness : The pipe’s real thickness.

The lines 8-9 are non mandatory custom attributes declared in pipe-classes.xml

This is what the csv file should look like if we want to only have a copper class with DN32 and DN40:

32;35;1.5;1.41 kg/m;Copper
40;42;2;1.61 kg/m;Copper

If we wish to add another copper piping class, we could just create a new csv file and update the xml file like this:

<?xml version="1.0"?>
<category name="CopperClass" OD-unit="mm" thickness-unit="mm">
    <pipe-class name="CustomClass/Class1">
        <import-csv path="CustomPipeClass\CopperClass1.csv" separator=";">
            <DN></DN>
            <OD></OD>
            <thickness></thickness>
            <attribute:lineic_mass></attribute:lineic_mass>
            <attribute:CATALOG:Material></attribute:CATALOG:Material>
        </import-csv>
  </pipe-class>
  <pipe-class name="CustomClass/Class2">
        <import-csv path="CustomPipeClass\CopperClass2.csv" separator=";">
            <DN></DN>
            <OD></OD>
            <thickness></thickness>
            <attribute:lineic_mass></attribute:lineic_mass>
            <attribute:CATALOG:Material></attribute:CATALOG:Material>
        </import-csv>
  </pipe-class>
</category>

Here is an example the the file “CopperClass2.csv”, with thicker pipes and the DN50 available:

32;35;2.5;1.41 kg/m;Copper
40;42;3;1.61 kg/m;Copper
50;53;3;1.8 kg/m;Copper

You can download this tutorial’s example here.

For this tutorial, we assume you followed the previous one: “Creating a pipe class”

As for the pipe class file’s paths, the attributes dedicaced to pipe classes are all declared in the file pipe-classes.xml

This file is located in Rhinopiping’s folder “catalogs\pipe”. With windows 7 the default full path is: “C:\ProgramData\Navinn\catalogs\pipe\pipe-classes.xml”

In the previous example, two attributes were already defined:

  • An attribut lineic-mass is typed to define a lineic mass.
  • An attribut CATALOG:Material. The use of “:” is a way to define an attribute’s tree position. In RhinoPiping we will see an attribute Material under a group CATALOG.
<?xml version="1.0"?>
<pipe-classes>
<attribute name="lineic_mass" type="lineic-mass" default="N/A"></attribute>
<attribute name="CATALOG:Material" default="N/A"></attribute>
<include path="stainless-steel-ANSI-ASME-B36.19M-1985.xml"></include>
<include path="steel-ANSI-ASME-B36.10M-1995.xml"></include>
<include path="Copper.xml"></include>
</pipe-classes>

To add an attribute Provider in the group CATALOG, we must add a line in the file:

<?xml version="1.0"?>
<pipe-classes>
<attribute name="lineic_mass" type="lineic-mass" default="N/A"></attribute>
<attribute name="CATALOG:Material" default="N/A"></attribute>
<attribute name="CATALOG:Provider" default="N/A"></attribute>
<include path="stainless-steel-ANSI-ASME-B36.19M-1985.xml"></include>
<include path="steel-ANSI-ASME-B36.10M-1995.xml"></include>
<include path="Copper.xml"></include>
</pipe-classes>

Now if we restart Rhinoceros, in the attributes tab we will see our attributes as defined:
Tutorial-CreatePipeClass-capture
Nevertheless, our new attribute Provider always has its default value (here “N/A”), since we did not defined its values for the differents pipe classes.
To customize the providers for the two copper pipe classes we created in the previous tutorial, we must update the file “copper.xml” in \Navinn\catalogs\pipe , then add a column in the corresponding csv files:

<?xml version="1.0"?>
<category name="CopperClass" OD-unit="mm" thickness-unit="mm">
    <pipe-class name="CustomClass/Class1">
        <import-csv path="CustomPipeClass\CopperClass1.csv" separator=";">
            <DN></DN>
            <OD></OD>
            <thickness></thickness>
            <attribute:lineic_mass></attribute:lineic_mass>
            <attribute:CATALOG:Material></attribute:CATALOG:Material>
            <attribute:CATALOG:Provider></attribute:CATALOG:Provider>
        </import-csv>
  </pipe-class>
  <pipe-class name="CustomClass/Class2">
        <import-csv path="CustomPipeClass\CopperClass2.csv" separator=";">
            <DN></DN>
            <OD></OD>
            <thickness></thickness>
            <attribute:lineic_mass></attribute:lineic_mass>
            <attribute:CATALOG:Material></attribute:CATALOG:Material>
            <attribute:CATALOG:Provider></attribute:CATALOG:Provider>
        </import-csv>
  </pipe-class>
</category>

Our two classes csv files will have to be modified accordingly:

32;35;1.5;1.41 kg/m;Copper;unimat
40;42;2;1.61 kg/m;Copper;unimat
32;35;2.5;1.41 kg/m;Copper;unimat
40;42;3;1.61 kg/m;Copper;unimat
50;53;3;1.8 kg/m;Copper;altitube

After restarting Rhinoceros, the attribute Provider now displays the appropriate values.
You can download this tutorial example here.

RhinoPiping can use two different kind of elbows:

  • The components owning the stereotype “elbow”. They are created like any other components, so each of them has to be drawn and created manually, for each ND (Nominal Diameter) needed. This can be a bother, but gives us two interesting points:
    • The component-type elbows are compatible with every pipe classes from a software point of view. Once you created them, you can use them with any pipe classe. You will also be able to insert them with the “RP_AddComponent” command, as for any other end of line components.
    • Since this kind of elbow is designed manually, it can have any form-factor and size. We can make it longer just on one side, or take in account the overlap needed if it is screwed on the pipe for example.
  • The elbow classes. Less flexible, they have the huge advantage to be very fast to set up. In this tutorial we will create two different elbow classes for the two pipe classes created in the previous tutorials.

Every elbow classes are defined in only one file named elbow-classes.xml.

This file is located in RhinoPiping’s folder “catalogs\elbow”. With windows 7 the default full path is: “C:\ProgramData\Navinn\catalogs\elbow\elbow-classes.xml”

The elbow classes can be defined in two different ways: from a curvature factor, or from curvature values. An elbow class is only compatible with one pipe class but a pipe class can have several elbow classes.

Example of a curvature factor pipe class:

For each factor needed, we add a line with these properties:

  • “key”: the elbow class name
  • “factor”: The curvature factor (It will be multiplicated by the diameter)
  • “pipe-class”: The associated pipe class name and tree path
<CurvatureFactors>
<item key = "D1" factor = "1" pipe-class="CopperClass/CustomClass/Class1"></item>
<item key = "D1.5" factor = "1.5" pipe-class="CopperClass/CustomClass/Class1"></item>
<item key = "D2" factor = "2" pipe-class="CopperClass/CustomClass/Class1"></item>
<item key = "D3" factor = "3" pipe-class="CopperClass/CustomClass/Class1"></item>
</CurvatureFactors>

Example of a tabulated curvature pipe class:

For each DN (Nominal diameter) used in each class, we define the curvature radius.

<Standard name="PieceOfCake">
       <Class name="3D" pipe-class="CopperClass/CustomClass/Class2">
       <item DN="32" curvature="47.5"></item>
       <item DN="40" curvature="57"></item>
       <item DN="50" curvature="76"></item>
       </Class>
</Standard>
When updated, our elbow-classes.xml file should look like this:
<?xml version="1.0" encoding="utf-8"?>
<angle-elements>
  <CurvatureFactors>
    <item key = "D1" factor = "1" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-5S"></item>
    <item key = "D1" factor = "1" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-10S"></item>
    <item key = "D1" factor = "1" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-40S"></item>
    <item key = "D1" factor = "1" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-80S"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Standard"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Extra-Strong"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Double-Extra-Strong"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-10"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-20"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-30"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-40"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-60"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-80"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-100"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-120"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-140"></item>
    <item key = "D1" factor = "1" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-160"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-5S"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-10S"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-40S"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-80S"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Standard"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Extra-Strong"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Double-Extra-Strong"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-10"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-20"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-30"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-40"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-60"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-80"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-100"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-120"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-140"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-160"></item>
    <item key = "D2" factor = "2" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-5S"></item>
    <item key = "D2" factor = "2" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-10S"></item>
    <item key = "D2" factor = "2" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-40S"></item>
    <item key = "D2" factor = "2" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-80S"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Standard"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Extra-Strong"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Double-Extra-Strong"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-10"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-20"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-30"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-40"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-60"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-80"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-100"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-120"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-140"></item>
    <item key = "D2" factor = "2" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-160"></item>
    <item key = "D3" factor = "3" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-5S"></item>
    <item key = "D3" factor = "3" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-10S"></item>
    <item key = "D3" factor = "3" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-40S"></item>
    <item key = "D3" factor = "3" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-80S"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Standard"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Extra-Strong"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Double-Extra-Strong"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-10"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-20"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-30"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-40"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-60"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-80"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-100"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-120"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-140"></item>
    <item key = "D3" factor = "3" pipe-class="steel-ANSI-ASME-B36.10M-1995/Schedule-160"></item>
    <item key = "D1" factor = "1" pipe-class="CopperClass/CustomClass/Class1"></item>
    <item key = "D1.5" factor = "1.5" pipe-class="CopperClass/CustomClass/Class1"></item>
    <item key = "D2" factor = "2" pipe-class="CopperClass/CustomClass/Class1"></item>
    <item key = "D3" factor = "3" pipe-class="CopperClass/CustomClass/Class1"></item>
  </CurvatureFactors>

  <TabulatedCurvatures>
    <Standard name="VALLOUREC">
      <Class name="3D" pipe-class="stainless-steel-ANSI-ASME-B36.19M-1985/Schedule-10S">
        <item DN="20" curvature="28.5"></item>
        <item DN="25" curvature="38"></item>
        <item DN="32" curvature="47.5"></item>
        <item DN="40" curvature="57"></item>
        <item DN="50" curvature="76"></item>
        <item DN="65" curvature="95"></item>
        <item DN="80" curvature="114.5"></item>
        <item DN="100" curvature="152.5"></item>
        <item DN="125" curvature="190.5"></item>
        <item DN="150" curvature="228.5"></item>
        <item DN="200" curvature="305"></item>
        <item DN="250" curvature="381"></item>
        <item DN="300" curvature="457"></item>
        <item DN="350" curvature="533.5"></item>
        <item DN="400" curvature="609.5"></item>
      </Class>
    </Standard>
    <Standard name="PieceOfCake">
    <Class name="3D" pipe-class="CopperClass/CustomClass/Class2">
        <item DN="32" curvature="47.5"></item>
        <item DN="40" curvature="57"></item>
        <item DN="50" curvature="76"></item>
    </Class>
    </Standard>
  </TabulatedCurvatures>
</angle-elements>

Caution! To create an elbow component, it can be faster to create first an automatic elbow, then explode it in Rhino3D and make it a component.

You can download this tutorial’s example here.

It is possible to change quite easily some Rhino/RhinoPiping objects color to match a specific attribute.
In our example, we with to have an attribute “Status”, with a choice between the value Built and the value Todo.

Creating the attribute:

In default-attribute-spec.xml we must add:

<enum name = "STATUS_ENUM">
        	<literal value = "Built"></literal>
        	<literal value = "ToDo"></literal>
</enum>
<attribute name = "Status" type = "STATUS_ENUM" read-only = "false">
   <description>Status of the pipeline</description>
</attribute>

RhinoScript code:

We will write the script as shown below, then run the command “ChangeColors” every time we want to update the colors.

Option Explicit
'Script written by Matthieu Arnold
'Script copyrighted by NAVINN
'Script version Thursday, November 27, 2014 5:28:33 PM

Rhino.Print "------------------------------------------"
Rhino.AddAlias "ChangeColors", "_-RunScript (ChangeColors)"

Call ChangeColors()
Dim MyAttribute

Sub ChangeColors
    Dim arrObjects, strObject
    arrObjects = Rhino.AllObjects
    If IsArray(arrObjects) Then
        For Each strObject In arrObjects
            Rhino.Print strObject
            'Rhino.SelectObject strObject
            If VarType(strObject) = vbString Then
                MyAttribute = Rhino.GetUserText(strObject, "Status")
                If IsNull(MyAttribute) = False Then
                    Rhino.Print MyAttribute
                    If MyAttribute = "Built" Then
                        Rhino.ObjectColor strObject, RGB(0, 255, 0)
                    Else
                        Rhino.ObjectColor strObject, RGB(255, 0, 0)
                    End If
                End If
            End If
        Next
    End If
End Sub

The template file is formated like a kind of .csv with a .tpl extension. It can be opened with a text editor like notepad.

When you create your template file, you must follow those rules:

  • The separator must be ;
  • If you are using a spreadsheet program like Excel for edition, check it won’t add double quotes.
  • Make sure all the attributes you are refering to have a default value. If they don’t, the command AA_Report will stop when meeting an attribute with no value. (1)
  • A “cell” can contain text, attribute values, or both

Exemple:

Let’s build a typical exemple of template file to generate a Bill of Materials. Create a text file and rename it for exemple “BillOfMaterials.tpl”. The template file will be read from top to bottom when `AA_Report` is running. So you may wish to begin with a simple line of texts for columns titles:

Label_ISO ;DN;Part number;Mass;Lineic mass;Material

The attributes values will be called like that: (exemple with label_ISO)

$(attribute:label_ISO)

We can look for different attributes for each kind of population. This is nearly always necessary, since all piping elements don’t have the same attributes (for exemple only the elbows have a `curvature`attribute). To separate the population, we use the filters. The most common way would be to separate pipes, elbows and others:

$(filter:population:Pipe)$(attribute:label_ISO);;;;;
$(end-filter)
$(filter:population:Elbow)$(attribute:label_ISO);;;;;
$(end-filter)
$(filter:population:ComponentNode:)$(attribute:label_ISO);;;;;
$(end-filter)

As you can see, the line begin with the filter, and there is no separator before the first column definition. (We take the following line to end the filter.) The population:Elbow stands for the automatic elbows (not the components). If you leave nothing beetween two separators, it will leave a blank cell in the Bill Of Material. In the example above, `AA_Report` will create a CSV file with only the labels in the first column. Now we can complete it and add the line for column titles:

Label_ISO ;DN;Mass;Lineic mass;Material
$(filter:population:Pipe)$(attribute:label_ISO);$(attribute:rhinopiping:sorted_DN);$(attribute:CATALOG:Weight);$(attribute:lineic_mass);$(attribute:CATALOG:Material);
$(end-filter)
$(filter:population:Elbow)$(attribute:label_ISO);$(attribute:rhinopiping:sorted_DN);;;$(attribute:CATALOG:Material);
$(end-filter)
$(filter:population:ComponentNode:)$(attribute:label_ISO);$(attribute:rhinopiping:sorted_DN);$(attribute:CATALOG:Weight);;$(attribute:CATALOG:Material);
$(end-filter)

1. Warning: Please remember that despite the attribute Label_ISO being created in the selected items when you run the command RP_Iso3D it is not included in the default attribute spec. Find the file `default-attribute-spec.xml` and add an entry point for the attribute Label_ISO with a default value to guarantee it will always have a value for the Bill of Materials. For exemple:

<attribute name = "label_ISO" default = "none"/>