Geometry Definition in the XML Extension Definition File

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>.

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.


Release 18.2 - © ANSYS, Inc. All rights reserved.