-
-
August 8, 2017 at 1:19 pm
banghuazhao
SubscriberWhen we use ANSYS ACT in DesignModeler, we can use API to create primitives. Those primitives become the bodies. Is there a way to change the bodies' name before or when we add those bodies to feature.
For example, I want to create a square pack microstructure. Is there a way to change and the name of fiber and matrix? The codes are following:
ExtAPI.Log.WriteMessage("Generating Square Pack Microstucture 2D...")
# Unit Length of the SG
L = 1.0e3
# Collect the volume fraction of the fiber
volume_fraction = feature.Properties["Volume Fraction of Fiber"].Value
# Calculate the radius of the fiber
radius = L * ( volume_fraction / math.pi ) ** (1./2.)
# Empty SG (array) to collect the entities generated
SG = []
# Some useful builder
primitive = ExtAPI.DataModel.GeometryBuilder.Primitives
operation = ExtAPI.DataModel.GeometryBuilder.Operations
# Created matrix
sheet_square = primitive.Sheet.CreatePolygon([L/2., L/2., 0., -L/2., L/2., 0., -L/2., -L/2., 0., L/2., -L/2., 0.]).Generate()
wire = primitive.Wire.CreateArc(radius, [0., 0., 0.], [1., 0., 0.], [0., 0., 1.]).Generate()
sheet_circle = operation.Tools.WireToSheetBody(wire)
matrix = operation.CreateSubtractOperation([sheet_circle]).ApplyTo([sheet_square])[0]
# Create fiber
wire = primitive.Wire.CreateArc(radius, [0., 0., 0.], [1., 0., 0.], [0., 0., 1.]).Generate()
fiber = operation.Tools.WireToSheetBody(wire)
# Create Part
part = operation.Tools.CreatePart([fiber, matrix])
part.Name = 'Square Pack Microstucture 2D'
SG.Add(part)
# Add resultant entities to feature
feature.Bodies = SG
# Assign material type to the entities. Different options are Add, Cut, Freeze
feature.MaterialType = MaterialTypeEnum.Freeze
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- How to work with STL file?
- Using Symmetry in DesignModeler and Expanding the Results
- Rotate tool in ANSYS Design Modeler
- drawing a geometry by importing a table of points
- section plane
- material properties
- ANSYS FLUENT – Operation would result in non manifold bodies
- Geometry scaling
- Parameters not imported into Workbench 18.2 from Solidworks/Inventor
- Convert Surface body to solid
-
2726
-
2156
-
1359
-
1150
-
462
© 2023 Copyright ANSYS, Inc. All rights reserved.