Professional Documents
Culture Documents
DesignModeler
ANSYS, Ansys Workbench, AUTODYN, CFX, FLUENT and any and all ANSYS, Inc. brand, product, service and feature
names, logos and slogans are registered trademarks or trademarks of ANSYS, Inc. or its subsidiaries located in the
United States or other countries. ICEM CFD is a trademark used by ANSYS, Inc. under license. CFX is a trademark
of Sony Corporation in Japan. All other brand, product, service and feature names or trademarks are the property
of their respective owners. FLEXlm and FLEXnet are trademarks of Flexera Software LLC.
Disclaimer Notice
THIS ANSYS SOFTWARE PRODUCT AND PROGRAM DOCUMENTATION INCLUDE TRADE SECRETS AND ARE
CONFIDENTIAL AND PROPRIETARY PRODUCTS OF ANSYS, INC., ITS SUBSIDIARIES, OR LICENSORS. The software
products and documentation are furnished by ANSYS, Inc., its subsidiaries, or affiliates under a software license
agreement that contains provisions concerning non-disclosure, copying, length and nature of use, compliance
with exporting laws, warranties, disclaimers, limitations of liability, and remedies, and other provisions. The software
products and documentation may be used, disclosed, transferred, or copied only in accordance with the terms
and conditions of that software license agreement.
ANSYS, Inc. and ANSYS Europe, Ltd. are UL registered ISO 9001: 2015 companies.
For U.S. Government users, except as specifically granted by the ANSYS, Inc. software license agreement, the use,
duplication, or disclosure by the United States Government is subject to restrictions stated in the ANSYS, Inc.
software license agreement and FAR 12.212 (for non-DOD licenses).
Third-Party Software
See the legal information in the product help files for the complete Legal Notice for ANSYS proprietary software
and third-party software. If you are unable to access the Legal Notice, contact ANSYS, Inc.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. iii
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
iv of ANSYS, Inc. and its subsidiaries and affiliates.
Introduction
This guide assumes that you are familiar with the general ACT usage information in the ACT Developer's
Guide. The Debug Mode (p. 1) topic supplies ACT usage information specific to DesignModeler:
Debug Mode
• DesignModeler APIs (p. 3): Describes the ACT APIs that provide for customizing the interface
and functionality of DesignModeler.
• DesignModeler Feature Creation (p. 11): Provides examples of customization capabilities available
for DesignModeler functionality and operations, such as creating specialized geometries with
custom properties and applying various operations to geometries.
• DesignModeler Wizards (p. 21): Describes DesignModeler product wizards, using a supplied
extension as an example.
Note:
For information on all ACT API changes and known issues and limitations that may affect
your existing ACT extensions, see Migration Notes and Known Issues and Limitations in
the Ansys ACT Developer's Guide.
Debug Mode
DesignModeler displays the ACT Development toolbar whenever debug mode is enabled. If
DesignModeler is already started when Debug Mode is enabled, you must exit DesignModeler and
then restart it. For more information, see Debug Mode in the Ansys ACT Developer's Guide.
• Clicking the first button switches between opening and closing the ACT Console
• Clicking the third button switches between opening and closing the Extensions Log File.
• Clicking the fifth button opens the help panel for the ACT Start Page.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 1
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
2 of ANSYS, Inc. and its subsidiaries and affiliates.
DesignModeler APIs
ACT provides APIs for customizing the interface and functionality of DesignModeler. Once customizations
are in place, you can use DesignModeler APIs to create and manipulate geometries. You first use APIs
to define and generate primitives and bodies. You then use APIs to apply various operations, tools, or
automated processes to the resulting geometries.
The code for creating primitive bodies or applying operations must be integrated into the callback
<ongenerate>. The following examples address working with a selected graphic, creating different
types of primitives, and applying different operations:
Using the Selection Manager in DesignModeler
Creating Primitives
Applying Operations
For comprehensive information on all ACT APIs and their properties, refer to the Ansys ACT API Reference
Guide.
This command returns the object ISelectionInfo, which describes the selected entities.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 3
DesignModeler APIs
To retrieve entities:
selection.Entities
Creating Primitives
The DesignModeler API Primitives provides you with the ability to create different types of primitive
bodies: sheet bodies, wire bodies, and solid bodies. For each primitive body type, multiple shape options
are available.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
4 of ANSYS, Inc. and its subsidiaries and affiliates.
Creating Primitives
The script function ongenerate() can be used to create a primitive body. The API provides a variety
of queries that allow you to specify properties such as body type, dimensions, shape, point coordinates,
and material.
feature.Bodies = sheetBodies
feature.MaterialType = MaterialTypeEnum.Freeze
return True
In this example:
• The variables width and height are used to define the width and the height of the cylinder.
• The primitive variable uses the global variable ExtAPI, which serves as the ACT entry point into
DesignModeler, to access the data model and define the geometry builder.
• The method CreateCylinder () is used to generate the new body, specifying that it is defined
by the following arguments:
– Coordinates of the center point of the upper face, which defines the direction of the cylinder
For example, the integer value << 3 >> is refused, while the value of << 3. >> is accepted.
• With the object cylinder_generated, you use the method Generate () to generate the
cylinder.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 5
DesignModeler APIs
wireBodies = []
primitive = ExtAPI.DataModel.GeometryBuilder.Primitives
polyline = primitive.Wire.CreatePolyline(points_list)
polyline_generated = polyline.Generate()
wireBodies.Add(polyline_generated)
feature.Bodies = wireBodies
feature.MaterialType = MaterialTypeEnum.Add
return True
In this example:
• The method points_list () is defined for later use in the creation of the polyline body. For
arguments, it expects as a list of coordinate points, which are defined by three float values per
point.
• The primitive variable uses the global variable ExtAPI, which serves asthe ACT entry pointinto
DesignModeler, to access the data model and define the geometry builder.
• The method CreatePolyline () is applied to the object Wire to generate the new body. As
arguments, this method expects the coordinate points defined by the method points_list.
• With the object polyline_generated, you use the method Generate () to generate the
polyline.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
6 of ANSYS, Inc. and its subsidiaries and affiliates.
Creating Primitives
• The new body is added to the list feature.bodies as described in Creating a Sheet Body (p. 5).
primitive = ExtAPI.DataModel.GeometryBuilder.Primitives
box1 = primitive.Solid.CreateBox(point1, point2)
box1_generated = box1.Generate()
solidBodies.Add(box1_generated)
feature.Bodies = solidBodies
feature.MaterialType = MaterialTypeEnum.Freeze
return True
In this example:
• The methods point1 () and point2 () are defined for later use in the creation of the solid
body. For arguments, they each expect a list of coordinate points, which are defined by three float
values per point.
• The primitive variable uses the global variable ExtAPI, which serves as the ACT entry point into
DesignModeler, to access the data model and define the geometry builder.
• The method CreateBox () is applied to the object Solid to generate the new body. For
arguments, this method expects the coordinate points defined by the methods point1 and
point2.
• With the object box1_generated, you use the method Generate () to generate the box.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 7
DesignModeler APIs
• The new body is added to the list feature.bodies as described in Creating a Sheet Body (p. 5).
Applying Operations
The DesignModeler API Operations enables you to perform different operations on a geometric
body. Available operations can be divided into two different categories: Primary and Boolean Operations
and Tools Operations.
The script function ongenerate() can be used to perform various types of operations on a geometry
feature. The API provides primary and Boolean operations that allow you to specify properties such as
body type, dimensions, shape, point coordinates, and material. It also offers a number of tools for
manipulating your geometry, including actions such as copying or deleting a body or transform
operations for creating a body based on another body or topological components.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
8 of ANSYS, Inc. and its subsidiaries and affiliates.
Applying Operations
In the following example, the function ongenerate() is used to create a polygon sheet body and
perform the operation Extrude.
def Ongenerate(feature,function):
length = 0.3
bodies = []
builder = ExtAPI.DataModel.GeometryBuilder
polygon=builder.Primitives.Sheet.CreatePolygon([0.,0.,3*length,0.,0.,2.*length,length,0.,2.*length])
polygon_generated = polygon.Generate()
extrude = builder.Operations.CreateExtrudeOperation([0.,1.,0.],length/2.)
bodies.Add(extrude.ApplyTo(polygon_generated)[0])
feature.Bodies = bodies
feature.MaterialType = MaterialTypeEnum.Add
return True
In this example:
• The first part of the function creates a polygon sheet body using a process similar to the one used
to create a cylinder in Creating a Sheet Body (p. 5).
Note:
While the variable Length is used for both the sheet body and the extrusion definition
in this example, you could have used a different variable for each.
• The method ApplyTo specifies the geometry to which to apply the operation Extrude. The
method ApplyTo() returns a list of bodies to which to apply the operation.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 9
DesignModeler APIs
In the following example, the function ongenerate() creates a polygon sheet body and applies
the Transform Edges to Wire tool.
def Ongenerate(feature,function):
length = 0.3
bodies = []
builder = ExtAPI.DataModel.GeometryBuilder
polygon = builder.Primitives.Sheet.CreatePolygon([0.,0.,2.*length,0.,0.,1.*length,length,0.,0.7])
polygon_generated = polygon.Generate()
body = builder.Operations.Tools.EdgesToWireBody(polygon_generated.Edges);
bodies.Add(body)
feature.Bodies = bodies
feature.MaterialType = MaterialTypeEnum.Add
return True
In this example:
• The first part of the function creates a polygon sheet body using a process similar to the one used
to create a cylinder in Creating a Sheet Body (p. 5).
Note:
While the variable Length is used for both the sheet body and the extrusion definition
in this example, you could have used a different variable for each.
• The new wire body is added to the list feature.bodies as described in Applying the Extrude
Operation (p. 8).
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
10 of ANSYS, Inc. and its subsidiaries and affiliates.
DesignModeler Feature Creation
In addition to supporting the common feature creation capabilities described in the Ansys ACT Developer's
Guide, DesignModeler supports the use of ACT for the creation of specialized geometries with custom
properties and the application of various operations to the geometries:
ACT-Based Property Parametrization in DesignModeler
ACT-Based Geometry Creation
Note:
The package ACT Templates for DesignModeler provides extensions that show additional
ways that you can use ACT to customize DesignModeler. For more information, see ACT
Templates for DesignModeler. For download information, see Extension and Template
Examples.
As with any other input parameter, to add an input to DesignModeler you must add the parameter
isparameter to the XML file and set it to true. However, you are not able to add output parameters.
The attribute readonly is not available for DesignModeler.
For example, in an ACT feature that generates a cylinder, you can add length as a parameter. The
following excerpt from the XML file defines the parameter Length.
<geometry name="MyFeatureWithParameters" caption="MyFeatureWithParameters"
icon="Construction" version="1">
<callbacks>
<ongenerate>generateMyFeature</ongenerate>
</callbacks>
<property name="Length" caption="Length" control="float" isparameter="true"></property>
</geometry>
In DesignModeler, the check box next to the property Length allows you to parameterize it as an input
parameter.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 11
DesignModeler Feature Creation
You could add a static structural analysis based on the previous Geometry template by adding an
output parameter in the Static Structural analysis. This results in the following Project Schematic:
The input parameter defined in DesignModeler is managed in exactly the same way as other any other
input parameter. In the Outline pane for the Parameter Set bar, the geometry input parameter is
placed under the Geometry system.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
12 of ANSYS, Inc. and its subsidiaries and affiliates.
ACT-Based Geometry Creation
Note:
The process of defining parameters under a load in a third-party solver for DesignModeler
is identical to the process for defining input parameters in Mechanical. For more information,
see ACT-Based Property Parametrization in Mechanical in the ACT Customization Guide for
Mechanical.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 13
DesignModeler Feature Creation
</simdata>
</extension>
The element <script> defines the path to the IronPython script main.py. The element
<interface> has the attribute context set to DesignModeler. The element toolbar defines
the custom toolbar for creating a geometry. The callback function createMyFeature creates the
geometry and adds it to DesignModeler.
The element <simdata> defines the geometry. The attributes in the child element <geometry>
provide the name, caption, icon, and version that apply to the geometry.
The child element <callbacks> has two callbacks: <ongenerate> and <onaftergenerate>.
• The callback <ongenerate> specifies 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 succeeds and false if it fails.
• The callback <onaftergenerate> specifies 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 callback definition, you define the properties to apply to the definition of the geometry. In this
example, the properties Face and Length are applied. The Details View pane of DesignModeler
displays these properties so that the necessary values to complete the geometry definition can be
supplied. The next section describes how geometry properties are 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.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
14 of ANSYS, Inc. and its subsidiaries and affiliates.
ACT-Based Geometry Creation
The two geometry properties, Face and Length, use different control types.
• For the property Face, the attribute control is set to scoping. The attribute
selection_filter is set to face. This specifies that the value for this property is one or
more faces. The faces defined in the script main.py and used to generate the geometry.
• For the property Length, the attribute control is set to float. It does not require the
definition of one specific callback. The attribute unit is set to length, which introduces a
physical quantity dependency. The attribute default specifies 1.2[m] as the default value.
This default value is exposed in the Details View pane each time a new load is created.
def createMyFeature(feature):
ExtAPI.CreateFeature("MyFeature")
def norm(v):
return math.sqrt(scalarProduct(v,v))
def generateMyFeature(feature,function):
length = feature.Properties["Length"].Value
length = units.ConvertUnit(length, ExtAPI.DataModel.CurrentUnitFromQuantityName("Length"), "m")
faces = feature.Properties["Face"].Value.Entities
bodies = []
builder = ExtAPI.DataModel.GeometryBuilder
disc_generator = builder.Operations.Tools.WireToSheetBody(arc_generated)
normal[0] *= -1
normal[1] *= -1
normal[2] *= -1
extrude = builder.Operations.CreateExtrudeOperation(normal,length)
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 15
DesignModeler Feature Creation
cylinder_generator = extrude.ApplyTo(disc_generator)[0]
bodies.Add(cylinder_generator)
feature.Bodies = bodies
feature.MaterialType = MaterialTypeEnum.Add
return True
def afterGenerateMyFeature(feature):
edges = []
minimum_volume = System.Double.MaxValue
for body in feature.Bodies:
body_volume = 0
if str(body.BodyType) == "GeoBodySolid":
body_volume = body.Volume
if body_volume <= minimum_volume:
minimum_volume = body_volume
ExtAPI.SelectionManager.NewSelection(edges)
named_selection = ExtAPI.DataModel.FeatureManager.CreateNamedSelection()
ExtAPI.SelectionManager.ClearSelection()
• The mathematical functions vectorProduct and scalarProduct are used later in the
function generateMyFeature.
The first several functions configure information that is used later in the creation of the geometry.
• The property length, which is used later to create the primitive. The conversion of the length
unit ensures that you are working with the expected metric unit.
• The list bodies, where the geometric features to create are added.
• The builder, which serves as the ACT gateway in DesignModeler. All features and operations
are accessed from here.
• The variable faces, which is used as the argument to create the circle. Under faces:
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
16 of ANSYS, Inc. and its subsidiaries and affiliates.
ACT-Based Geometry Creation
• Calculate the xdir, which is the principle direction of the arc wire that is defined later and that
is required to draw the arc.
• The objects vectorProduct and scalarProduct, which specify the location of the geometry’s
primitives and operations.
– With the object arc_generator, the extension uses the primitive generator
builder.Primitives.Wire.CreateArc. The method CreateArc() uses arguments
from faces to draw the circle. This generator can be used one or more times to build the
primitive body.
– With the object arc_generated, the extension uses the method Generate() to
generate the primitive body.
– With the object disc_generator, the extension uses the operations generator
builder.Operations.Tools.WireToSheetBody to define a disc based on the
circle.
– With the object extrude, the extension uses the operations generator
builder.Operations.CreateExtrudeOperation to specify that the resulting
extrusion is equal to the value of the property Length.
– With the object cylinder_generator, the extension uses the method ApplyTo to
define the geometry to which the extrude operation is applied. This method returns a list
of bodies to which the operation is applied.
• Bodies added to the list feature.Bodies are added to DesignModeler after the generation.
All other bodies used in the generation process are lost.
The list feature.Bodies can contain both bodies and parts. You can create a part with the
command builder.Operations.Tools.CreatePart(list_of_bodies).
• The list material.Type allows you to enter different properties such as Freeze, Cut, and
Add. The following figure illustrates the resulting geometry given selection of the different
properties. You can see the effect of different material type properties on the geometry.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 17
DesignModeler Feature Creation
• The callback <onaftergenerate> allows you to access and work with the part or bodies
created previously by the callback <ongenerate>.
For example, you can use it rename a part or body, suppress it, create a named selection,
create a new selection via the Selection Manager, or access one or more of the geometric
features of a body as its area.
• Unlike the callback <ongenerate>, which expects a return value of True or False, the
callback <onaftergenerate> does not expect a return value.
• The callback <onaftergenerate> allows you to define properties for the feature to be
created.
• The list edges, where you add all edges of the bodies to create for the feature.
• The property Minimum Volume, which in this example is the volume of the body with the
smallest volume of all the bodies created for the feature. The attribute control is set to
float. The attribute unit is set to Volume. Because this property has the special attribute
readonlyaftergenerate set to true, the value becomes non-editable after generation
of the feature.
• The variable edge, which is used to find the edges of all the bodies created for the feature.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
18 of ANSYS, Inc. and its subsidiaries and affiliates.
ACT-Based Geometry Creation
The following figures shows the feature, named selection, and properties in DesignModeler.
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 19
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
20 of ANSYS, Inc. and its subsidiaries and affiliates.
DesignModeler Wizards
You can use ACT to create target product wizards for DesignModeler. The supplied extension
WizardDemos contains a project wizard, multiple target product wizards, and a mixed wizard. This
section describes the target product wizard for DesignModeler. Named CreateBridge, this two-step
wizard is for building a bridge.
Note:
• Target product wizards for DesignModeler are not supported on Linux platforms.
• You use the Extension Manager to install and load extensions and the Wizards launcher
to start a target product wizard.
• The extension WizardDemos contains two wizards named CreateBridge. The first one
is for DesignModeler, and the second one is for SpaceClaim. This topic describes the
DesignModeler wizard. For a description of the SpaceClaim wizard, see SpaceClaim Wizard
for Building a Bridge in the ACT Customization Guide for SpaceClaim.
Tip:
<interface context="Project|Mechanical|SpaceClaim">
<images>images</images>
</interface>
<interface context="DesignModeler">
<images>images</images>
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 21
DesignModeler Wizards
</interface>
<simdata context="DesignModeler">
<geometry name="Deck" caption="Deck" icon="deck" version="1">
<callbacks>
<ongenerate>GenerateDeck</ongenerate>
</callbacks>
<property name="Length" caption="Length" control="float" unit="Length" default="300 [m]" />
<property name="Width" caption="Width" control="float" unit="Length" default="20 [m]" />
<property name="Beams" caption="Beams" control="integer" default="31" />
</geometry>
</simdata>
<simdata context="DesignModeler">
<geometry name="Support" caption="Support" icon="support" version="1">
<callbacks>
<ongenerate>GenerateSupport</ongenerate>
</callbacks>
<property name="Length" caption="Length" control="float" unit="Length" default="300 [m]" />
<property name="Height" caption="Height" control="float" unit="Length" default="100 [m]" />
<property name="Width" caption="Width" control="float" unit="Length" default="20 [m]" />
<property name="Number" caption="Number" control="integer" default="3" />
</geometry>
</simdata>
...
<callbacks>
<onupdate>UpdateDeck</onupdate>
</callbacks>
</step>
<callbacks>
<onupdate>UpdateSupports</onupdate>
</callbacks>
</step>
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
22 of ANSYS, Inc. and its subsidiaries and affiliates.
DesignModeler Wizard Function Definition
</wizard>
...
</extension>
The element <interface> defines two user interfaces for the extension WizardDemos. The
second element <interface> is used by the DesignModeler wizard CreateBridge. This element
<interface> has a child element <toolbar> that defines two toolbar buttons for exposure in
DesignModeler. When the buttons are clicked, the callback <onclick> executes the functions
CreateDeck and CreateSupport, creating a deck geometry with supports.
Simdata Definition
The element <simdata> provides data. This extension has two such elements to provide data for
creating the geometries Deck and Support. The second element <simdata> is used by this
wizard as it has the attribute context set to DesignModeler.
Wizard Definition
The element <wizard> named CreateBridge in the XML code excerpt has the attribute context
set to DesignModeler to indicate that this is the product in which the wizard executes.
Step Definition
The element <step> defines a step in the wizard. This wizard has two steps: Deck and Supports.
• For the step Deck, the callback <onupdate> executes the function UpdateDeck, creating
the deck using the geometry Deck.
• For the step Supports, the callback <onupdate> executes the function UpdateSupports,
creating the bridge supports using the geometry Support.
def CreateDeck(ag):
ExtAPI.CreateFeature("Deck")
def CreateSupport(ag):
ExtAPI.CreateFeature("Support")
def GenerateDeck(feature,fct):
length = feature.Properties["Length"].Value
length = units.ConvertUnit(length, ExtAPI.DataModel.CurrentUnitFromQuantityName("Length"), "m")
width = feature.Properties["Width"].Value
width = units.ConvertUnit(width, ExtAPI.DataModel.CurrentUnitFromQuantityName("Length"), "m")
num = feature.Properties["Beams"].Value
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
of ANSYS, Inc. and its subsidiaries and affiliates. 23
DesignModeler Wizards
builder = ExtAPI.DataModel.GeometryBuilder
bodies = []
boxGen = builder.Primitives.Solid.CreateBox([0.,-width/2.,-0.3],[length,width/2.,0.])
bodies.Add(boxGen.Generate())
w = (length-0.1*num)/(num-1.)+0.1
for i in range(num-1):
beamGen = builder.Primitives.Solid.CreateBox([i*w,-width/2.,-0.6],[i*w+0.1,width/2.,-0.3])
bodies.Add(beamGen.Generate())
beamGen = builder.Primitives.Solid.CreateBox([length-0.1,-width/2.,-0.6],[length,width/2.,-0.3])
bodies.Add(beamGen.Generate())
beamGen = builder.Primitives.Solid.CreateBox([0.,-width/2.,-1.],[length,-width/2.+0.2,-0.6])
bodies.Add(beamGen.Generate())
beamGen = builder.Primitives.Solid.CreateBox([0.,width/2.-0.2,-1.],[length,width/2.,-0.6])
bodies.Add(beamGen.Generate())
feature.Bodies = bodies
feature.MaterialType = MaterialTypeEnum.Add
return True
def GenerateSupport(feature,fct):
length = feature.Properties["Length"].Value
length = units.ConvertUnit(length, ExtAPI.DataModel.CurrentUnitFromQuantityName("Length"), "m")
height = feature.Properties["Height"].Value
height = units.ConvertUnit(height, ExtAPI.DataModel.CurrentUnitFromQuantityName("Length"), "m")
width = feature.Properties["Width"].Value
width = units.ConvertUnit(width, ExtAPI.DataModel.CurrentUnitFromQuantityName("Length"), "m")
num = feature.Properties["Number"].Value
builder = ExtAPI.DataModel.GeometryBuilder
bodies = []
w = (length-2.*num)/(num+1.)+2.
for i in range(num):
beamGen = builder.Primitives.Solid.CreateBox([(i+1)*w,-width/2.,-1.-height],
[(i+1)*w+2.,width/2.,-1.])
bodies.Add(beamGen.Generate())
beamGen = builder.Primitives.Solid.CreateBox([0.,-width/2.,-5.],[2.,width/2.,-1.])
bodies.Add(beamGen.Generate())
beamGen = builder.Primitives.Solid.CreateBox([length-2.,-width/2.,-5.],[length,width/2.,-1.])
bodies.Add(beamGen.Generate())
feature.Bodies = bodies
feature.MaterialType = MaterialTypeEnum.Freeze
return True
def UpdateDeck(step):
deck = ExtAPI.CreateFeature("Deck")
deck.Properties["Length"].Value = step.Properties["Deck/Length"].Value
deck.Properties["Width"].Value = step.Properties["Deck/Width"].Value
deck.Properties["Beams"].Value = step.Properties["Deck/Beams"].Value
ExtAPI.DataModel.FeatureManager.Generate()
def UpdateSupports(step):
supports = ExtAPI.CreateFeature("Support")
supports.Properties["Length"].Value = step.PreviousStep.Properties["Deck/Length"].Value
supports.Properties["Width"].Value = step.PreviousStep.Properties["Deck/Width"].Value+6
supports.Properties["Height"].Value = step.Properties["Supports/Height"].Value
supports.Properties["Number"].Value = step.Properties["Supports/Number"].Value
ExtAPI.DataModel.FeatureManager.Generate()
Release 2023 R1 - © ANSYS, Inc. All rights reserved. - Contains proprietary and confidential information
24 of ANSYS, Inc. and its subsidiaries and affiliates.