Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Let’s see how library components are using other components' parameters or sub-objects that are exported to the source code;

Example:

This example consists of 3 different library component which are representing a pedestal, a flagpole and a flag to illustrate how these 3 objects are parametrically connecte.

Base Object : This object has 4 inputs which are the coordinates of reference point, width, length and depth of the base. It creates a 3D volume object from these inputs and exports a reference line which is a diagonal path of flagpole.

Code Block
<O N="ExportExampleObject1" T="Project" Category="Core Objects">
    <!-- created by ParamML Examples on 8/31/2023 -->
    <P N="Starting_Point" V="[1,2,3]" Role="Input" />
    <P N="Wf" V="20" D="Width of the foundation" Role="Input" />
    <P N="Lf" V="20" D="Length of the foundation" Role="Input" />
    <P N="Hf" V="2" D="Height of the foundation" Role="Input" />
    <O T="Volume">
        <P N="Opacity" V="0.5" />
        <O N="bottomN" T="Surface" X="Starting_Point[0]" Y="Starting_Point[1]" Z="Starting_Point[2]">
            <O T="Point" X="0" Y="0" Z="0" />
            <O T="Point" X="Wf" Y="0" Z="0" />
            <O T="Point" X="Wf" Y="Lf" Z="0" />
            <O T="Point" X="0" Y="Lf" Z="0" />
        </O>
        <O N="TopN" T="Surface" X="Starting_Point[0]" Y="Starting_Point[1]" Z="Starting_Point[2]+Hf">
            <O T="Point" X="0" Y="0" />
            <O T="Point" X="Wf" Y="0" />
            <O T="Point" X="Wf" Y="Lf" />
            <O T="Point" X="0" Y="Lf" />
        </O>
    </O>
    <O T="Export">
        <O N="RefLine" T="Volume" X="Starting_Point[0]" Y="Starting_Point[1]" Z="Starting_Point[2]">
            <O N="Point1" T="Point" X="0" Y="0" Z="Hf" />
            <O N="Point2" T="Point" X="Wf" Y="Lf" Z="Hf" />
        </O>
        <P N="FoundCoord" V="toglobal(RefLine)" />
        <P N="midpoint" V="onliner(FoundCoord,0.5)" />
    </O>
</O>
Image Added

To vew this example in library, see https://openbrim.org/platform/?application=inc&author=ParamML_Examples_OpenBrIM+Platform&obj=objidujk37rmwc8so5bketj81ii

Flagpole : This object requires a base object whose type isExportExampleObject1 and other geometric inputs to create a pedestal and a pole for flag. Also there are 2 offset inputs to change the location of the pedestal and pole on the base by using the reference line that is exported from ExportExampleObject1. Finally this object also exports reference line for flag object.

Code Block
<O N="ExportExampleObject2" T="Project" Category="Core Objects">
    <!-- created by ParamML Examples on 8/31/2023 -->
    <P N="BaseObj" V="EEO" T="ExportExampleObject1" Role="Input" />
    <O T="ParamInfo" Min="1" Max="1" Required="1" Pick="1" Param="BaseObj" />
    <O N="GeoInputs" T="Group">
        <P N="width_pedestal" V="5" D="Width of pedestal" Role="Input" Category="GeoInputs" />
        <P N="height_pedestal" V="1" D="Height of pedestal" Role="Input" Category="GeoInputs" />
        <P N="R" V="1" D="Radius of Flagpole" Role="Input" Category="GeoInputs" />
        <P N="thickness" V="0.25" D="Thickness of Flagpole" Role="Input" Category="GeoInputs" />
        <P N="h2" V="10" D="Height of Flagpole" Role="Input" Category="GeoInputs" />
        <P N="xoff" V="0" D="Offset in X direction" Role="Input" Category="GeoInputs" />
        <P N="yoff" V="0" D="Offset in Y direction" Role="Input" Category="GeoInputs" />
    </O>
    <O N="Pedestal" T="Volume">
        <P N="Opacity" V="0.7" />
        <O N="Bottomp" T="Surface" X="BaseObj.midpoint[0]+xoff" Y="BaseObj.midpoint[1]+yoff" Z="BaseObj.midpoint[2]">
            <O T="Point" X="-width_pedestal/2" Y="-width_pedestal/2" Z="0" />
            <O T="Point" X="width_pedestal/2" Y="-width_pedestal/2" Z="0" />
            <O T="Point" X="width_pedestal/2" Y="width_pedestal/2" Z="0" />
            <O T="Point" X="-width_pedestal/2" Y="width_pedestal/2" Z="0" />
        </O>
        <O N="Topp" T="Surface" X="BaseObj.midpoint[0]+xoff" Y="BaseObj.midpoint[1]+yoff" Z="BaseObj.midpoint[2]">
            <O T="Point" X="-width_pedestal/2" Y="-width_pedestal/2" Z="height_pedestal" />
            <O T="Point" X="width_pedestal/2" Y="-width_pedestal/2" Z="height_pedestal" />
            <O T="Point" X="width_pedestal/2" Y="width_pedestal/2" Z="height_pedestal" />
            <O T="Point" X="-width_pedestal/2" Y="width_pedestal/2" Z="height_pedestal" />
        </O>
    </O>
    <O N="FlagPole" T="Group">
        <P N="Opacity" V="0.7" />
        <O N="L" T="Line">
            <O T="Point" X="BaseObj.midpoint[0]+xoff" Y="BaseObj.midpoint[1]+yoff" Z="BaseObj.midpoint[2]+kalinlik" />
            <O T="Point" X="BaseObj.midpoint[0]+xoff" Y="BaseObj.midpoint[1]+yoff" Z="BaseObj.midpoint[2]+h2+kalinlik" />
            <O T="Section">
                <O T="Circle" Radius="R" />
                <O T="Circle" Radius="R-thickness" IsCutout="1" />
            </O>
        </O>
    </O>
    <O T="Export">
        <O N="RefLine2" T="Line">
            <O N="PT1" T="Point" X="BaseObj.midpoint[0]+xoff+R/sqrt(2)" Y="BaseObj.midpoint[1]+yoff+R/sqrt(2)" Z="BaseObj.midpoint[2]+kalinlik" />
            <O N="PT2" T="Point" X="BaseObj.midpoint[0]+xoff+R/sqrt(2)" Y="BaseObj.midpoint[1]+yoff+R/sqrt(2)" Z="BaseObj.midpoint[2]+h2+kalinlik" />
        </O>
        <P N="PoleCoord" V="toglobal(RefLine2)" />
        <P N="midpoint2" V="onliner(PoleCoord,0.5)" />
    </O>
    <O T="Private">
        <O N="EEO" T="ExportExampleObject1">
            <P N="Starting_Point" V="[1,2,3]" />
            <P N="Wf" V="20" D="Width of the foundation" />
            <P N="Lf" V="20" D="Length of the foundation" />
            <P N="Hf" V="2" D="Height of the foundation" />
            <P N="FoundCoord" V="toglobal(RefLine)" />
            <P N="midpoint" V="onliner(FoundCoord,0.5)" />
            <O N="RefLine" T="Volume" X="Starting_Point[0]" Y="Starting_Point[1]" Z="Starting_Point[2]" Exported="1">
                <O N="Point1" T="Point" X="0" Y="0" Z="Hf" />
                <O N="Point2" T="Point" X="Wf" Y="Lf" Z="Hf" />
            </O>
        </O>
    </O>
</O>
Image Added

To view object in the library, see https://openbrim.org/app/?incubator=1&author=ParamML_Examples_OpenBrIM+Platform&obj=objidcgapy250iyjfs6dqjskfm

Flag : This object reuires a flag pole object whose type is ExportExampleObject2 and other geometric inputs to create flag. Also there is flag height input to change the flan location in Z axis by using the reference line that is exported from ExportExampleObject2.

Code Block
<O N="ExportExampleObject3" T="Project" Category="Core Objects">
    <!-- created by ParamML Examples on 8/31/2023 -->
    <P N="be" V="4" D="Flag Width" Role="Input" />
    <P N="bb" V="2" D="Flag Length" Role="Input" />
    <P N="by" V="100" D="Flag Height" Role="Input" />
    <P N="PoleObj" V="EEO2" T="ExportExampleObject2" Role="Input" />
    <O T="ParamInfo" Min="1" Max="1" Required="1" Pick="1" Param="PoleObj" />
    <O N="Flag" T="Surface" X="PoleObj.midpoint2[0]" Y="PoleObj.midpoint2[1]" Z="(PoleObj.midpoint2[2]-PoleObj.h2/2)+(PoleObj.h2-bb)*(by/100)">
        <P N="Opacity" V="0.8" />
        <O T="Point" X="0" Y="0" Z="0" />
        <O T="Point" X="be" Y="be" Z="0" />
        <O T="Point" X="be" Y="be" Z="bb" />
        <O T="Point" X="0" Y="0" Z="bb" />
    </O>
    <O T="Private">
        <O N="EEO2" T="ExportExampleObject2">
            <P N="BaseObj" V="EEO1" T="ExportExampleObject1" />
            <P N="width_pedestal" V="5" D="Width of pedestal" />
            <P N="height_pedestal" V="1" D="Height of pedestal" />
            <P N="R" V="1" D="Radius of Flagpole" />
            <P N="thickness" V="0.25" D="Thickness of Flagpole" />
            <P N="h2" V="10" D="Height of Flagpole" />
            <P N="xoff" V="0" D="Offset in X direction" />
            <P N="yoff" V="0" D="Offset in Y direction" />
            <P N="PoleCoord" V="toglobal(RefLine2)" />
            <P N="midpoint2" V="onliner(PoleCoord,0.5)" />
            <O N="RefLine2" T="Line" Exported="1">
                <O N="PT1" T="Point" X="BaseObj.midpoint[0]+xoff+R/sqrt(2)" Y="BaseObj.midpoint[1]+yoff+R/sqrt(2)" Z="BaseObj.midpoint[2]+kalinlik" />
                <O N="PT2" T="Point" X="BaseObj.midpoint[0]+xoff+R/sqrt(2)" Y="BaseObj.midpoint[1]+yoff+R/sqrt(2)" Z="BaseObj.midpoint[2]+h2+kalinlik" />
            </O>
        </O>
        <O N="EEO1" T="ExportExampleObject1">
            <P N="Starting_Point" V="[1,2,3]" />
            <P N="Wf" V="20" D="Width of the foundation" />
            <P N="Lf" V="20" D="Length of the foundation" />
            <P N="Hf" V="2" D="Height of the foundation" />
            <P N="FoundCoord" V="toglobal(RefLine)" />
            <P N="midpoint" V="onliner(FoundCoord,0.5)" />
            <O N="RefLine" T="Volume" X="Starting_Point[0]" Y="Starting_Point[1]" Z="Starting_Point[2]" Exported="1">
                <O N="Point1" T="Point" X="0" Y="0" Z="Hf" />
                <O N="Point2" T="Point" X="Wf" Y="Lf" Z="Hf" />
            </O>
        </O>
    </O>
</O>

Image Added

To view this object in library, see https://openbrim.org/app/?incubator=1&author=ParamML_Examples_OpenBrIM+Platform&obj=objidbjxpqt5dcrthlqtafahlfb

Beware that PoleCoord parameter in ExportExampleObject2 is not used directly in ExportExampleObject3 however it is still needed to be exported to compute the value of midpoint2 parameter in ExportExampleObject2 that is used in the calculations of ExportExampleObject3.

This example is also a good ilustration of using “Private”, which allows developer to call instances of required objects to the project to simplfy their tasks while simultaneously preventing the creation of those instances within the application.