The XML extension definition file GeometryFeature.xml follows.
<extension version="1" name="GeometryFeature">
<script src="main.py" />
<interface context="DesignModeler">
<images>images</images>
<toolbar name="ACTtoolbar" caption="ACTtoolbar">
<entry name="MyFeature" icon="construction">
<callbacks>
<onclick>createMyFeature</onclick>
</callbacks>
</entry>
</toolbar>
</interface>
<simdata context="DesignModeler">
<geometry name="MyFeature" caption="MyFeature" icon="construction" version="1">
<callbacks>
<ongenerate>generateMyFeature</ongenerate>
<onaftergenerate>afterGenerateMyFeature</onaftergenerate>
</callbacks>
<property name="Face" caption="Face" control="scoping">
<attibutes selection_filter="face"/>
</property>
<property name="Length" caption="Length" control="float" unit="Length" default="1.2 [m]"></property>
<property name="Minimum Volume" caption="Minimum Volume" control="float" unit="Volume" >
<attributes readonlyaftergenerate="true" />
</property>
</geometry>
</simdata>
</extension>As in previous examples, this file first defines the extension using the
attributes version and name. The path
to the IronPython script main.py is specified by the
<script> block. The ACT toolbar is defined in the
<interface> block, which has a context of
DesignModeler. The callback function createMyFeature is used
to create and add the geometry to the DesignModeler environment.
The definition of the geometry is encapsulated in the
<simdata> block. The attributes in the child
<geometry> block provide the name, caption, icon,
and version that apply to the geometry. The geometry
<callbacks> block includes two callbacks,
<ongenerate> and
<onaftergenerate>.
The callback <ongenerate> specifies the name
of the function to invoke when the geometry is generated by the product. The
product provides the geometry type (type
IDesignModelerGeoFeature) as the callback
argument.
This callback must return a Boolean value to indicate whether the
generation has been successful. It returns true if
the generation has succeeded and false if it has
failed.
The callback <onaftergenerate> specifies the
name of the function to invoke after the geometry is generated by the
product. The product provides the geometry type (type
IDesignModelerGeoFeature) as the callback
argument.
To specify additional details about the geometry, you can include additional
callbacks, such as <canadd>,
<onadd>, <oninit>, and
<onmigragte>, in the
<callbacks> block.
In the callback definition, you can define the properties to apply to the actual
definition of the geometry. In this example, Face and
Length properties are applied. These properties display
in the Details View pane of DesignModeler, where the user
provides the necessary values to complete the geometry definition. A subsequent
section reviews the IronPython script to show how geometry properties can be
retrieved and modified.
The following figure shows that each defined property appears in the Details View pane with the corresponding names and types of interface control.
The two geometry properties, Face and
Length, use different control types.
The property Face uses a
scoping control type with the attribute
selection_filter set to
face. This specifies that the value for this
property is one or more faces. The faces are defined in the file
main.py and then used to generate the
geometry.
The property Length uses a
float control type and does not require the
definition of one specific callback. Instead, the XML file introduces a
physical quantity dependency with the attribute
unit, which specifies that this property is
consistent with a length. The attribute default
specifies a default value of 1.2[m]. This default
value is exposed in the Details View pane each time
a new load is created.