Skip to content

Commit 3e7cc16

Browse files
Minor updates
1 parent ed50573 commit 3e7cc16

File tree

2 files changed

+37
-35
lines changed

2 files changed

+37
-35
lines changed

examples/01-Modeling-Setup/Configurations.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
# ## Preparation
2727
# Import the required packages
2828

29+
# +
2930
import os
3031
import tempfile
3132
import time
3233

3334
import pyaedt
3435
from pyaedt.generic.general_methods import generate_unique_name
36+
# -
3537

3638
# Define constants
3739

@@ -40,14 +42,14 @@
4042

4143
# ## Create temporary directory
4244

43-
temp_dir = tempfile.TemporaryDirectory(suffix="_ansys")
45+
temp_dir = tempfile.TemporaryDirectory(suffix=".ansys")
4446

4547
# ## Download project
4648

4749
project_full_name = pyaedt.downloads.download_icepak(destination=temp_dir.name)
4850

4951
# ## Open project
50-
52+
#
5153
# Open the Icepak project from the project folder.
5254

5355
ipk = pyaedt.Icepak(
@@ -96,8 +98,8 @@
9698
file_name=filename,
9799
file_path=ipk.working_directory,
98100
file_format=".step",
99-
object_list=[],
100-
removed_objects=[],
101+
assignment_to_export=[],
102+
assignment_to_remove=[],
101103
)
102104

103105
# ## Export configuration files
@@ -130,9 +132,7 @@
130132
# Close the project and release AEDT.
131133

132134
app.release_desktop()
133-
time.sleep(
134-
3
135-
) # Allow Electronics Desktop to shut down before cleaning the temporary project folder.
135+
time.sleep(3) # Allow Electronics Desktop to shut down before cleaning the temporary project folder.
136136

137137
# ## Cleanup
138138
#

examples/01-Modeling-Setup/HFSS_CoordinateSystem.py

+30-28
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import tempfile
99
import time
10-
1110
import pyaedt
11+
import os
1212

1313
# Define constants
1414

@@ -47,7 +47,8 @@
4747
cs1.props["OriginY"] = 10
4848
cs1.props["OriginZ"] = 10
4949

50-
# Pointing vectors can be changed
50+
# The orientation of the coordinate system can be modified by
51+
# updating the direction vectors for the coordinate system.
5152

5253
ypoint = [0, -1, 0]
5354
cs1.props["YAxisXvec"] = ypoint[0]
@@ -62,13 +63,16 @@
6263

6364
# ## Change coordinate system mode
6465
#
65-
# Use the ``change_cs_mode`` method to change the mode. Options are ``0``
66-
# for axis/position, ``1`` for Euler angle ZXZ, and ``2`` for Euler angle ZYZ.
66+
# Use the ``change_cs_mode`` method to change the mode. Options are
67+
# - ``0`` for axis/position
68+
# - ``1`` for Euler angle ZXZ
69+
# - ``2`` for Euler angle ZYZ.
70+
#
6771
# Here ``1`` sets Euler angle ZXZ as the mode.
6872

6973
cs1.change_cs_mode(1)
7074

71-
# In the new mode, these properties can be edited
75+
# The following lines use the ZXZ Euler angle definition to rotate the coordinate system.
7276

7377
cs1.props["Phi"] = "10deg"
7478
cs1.props["Theta"] = "22deg"
@@ -80,10 +84,10 @@
8084

8185
cs1.delete()
8286

83-
# ## Create coordinate system by defining axes
87+
# ## Define a new coordinate system
8488
#
85-
# Create a coordinate system by defining the axes. During creation, you can
86-
# specify all coordinate system properties.
89+
# Create a coordinate system by defining the axes. You can
90+
# specify all coordinate system properties as shown here.
8791

8892
cs2 = hfss.modeler.create_coordinate_system(
8993
name="CS2",
@@ -93,19 +97,19 @@
9397
y_pointing=[0, -1, 0],
9498
)
9599

96-
# ## Create coordinate system by defining Euler angles
97-
#
98-
# Create a coordinate system by defining Euler angles.
100+
# A new coordinate system can also be created based on the Euler angle convention.
99101

100102
cs3 = hfss.modeler.create_coordinate_system(
101103
name="CS3", origin=[2, 2, 2], mode="zyz", phi=10, theta=20, psi=30
102104
)
103105

104-
# ## Create coordinate system by defining view
106+
# Create a coordinate system that is defined by standard views in the modeler. The options are
107+
# - ``"iso"``
108+
# - ``"XY"``
109+
# - ``"XZ"``
110+
# - ``"XY"``.
105111
#
106-
# Create a coordinate system by defining the view. Options are ``"iso"``,
107-
# ``"XY"``, ``"XZ"``, and ``"XY"``. Here ``"iso"`` is specified.
108-
# The axes are set automatically.
112+
# Here ``"iso"`` is specified. The axes are set automatically.
109113

110114
cs4 = hfss.modeler.create_coordinate_system(
111115
name="CS4", origin=[1, 0, 0], reference_cs="CS3", mode="view", view="iso"
@@ -121,8 +125,6 @@
121125
name="CS5", mode="axisrotation", u=[1, 0, 0], theta=123
122126
)
123127

124-
# ## Create face coordinate system
125-
#
126128
# Face coordinate systems are bound to an object face.
127129
# First create a box and then define the face coordinate system on one of its
128130
# faces. To create the reference face for the face coordinate system, you must
@@ -134,17 +136,13 @@
134136
face=face, origin=face.edges[0], axis_position=face.edges[1], name="FCS1"
135137
)
136138

137-
# ## Create face coordinate system centered on face
138-
#
139139
# Create a face coordinate system centered on the face with the X axis pointing
140140
# to the edge vertex.
141141

142142
fcs2 = hfss.modeler.create_face_coordinate_system(
143143
face=face, origin=face, axis_position=face.edges[0].vertices[0], name="FCS2"
144144
)
145145

146-
# ## Swap X and Y axes of face coordinate system
147-
#
148146
# Swap the X axis and Y axis of the face coordinate system. The X axis is the
149147
# pointing ``axis_position`` by default. You can optionally select the Y axis.
150148

@@ -158,7 +156,7 @@
158156
fcs3.props["WhichAxis"] = "X"
159157

160158

161-
# ## Apply a rotation around the Z axis
159+
# ### Rotate the coordinate system
162160
#
163161
# Apply a rotation around the Z axis. The Z axis of a face coordinate system
164162
# is always orthogonal to the face. A rotation can be applied at definition.
@@ -172,6 +170,8 @@
172170

173171
fcs4.props["ZRotationAngle"] = "3deg"
174172

173+
# ### Offset the coordinate system
174+
#
175175
# Apply an offset to the X axis and Y axis of a face coordinate system.
176176
# The offset is in respect to the face coordinate system itself.
177177

@@ -184,7 +184,7 @@
184184
fcs5.props["XOffset"] = "0.2mm"
185185
fcs5.props["YOffset"] = "0.1mm"
186186

187-
# ## Create another coordinate system relative to face coordinate system
187+
# ### Dependent coordinate systems
188188
#
189189
# The use of dependent coordinate systems can simplify model creation. The following
190190
# cell demonstrates how to create a coordinate system whose reference is the face coordinate system.
@@ -197,14 +197,14 @@
197197
name="CS_FCS", origin=[0, 0, 0], reference_cs=fcs6.name, mode="view", view="iso"
198198
)
199199

200-
# ## Create object coordinate systems
200+
# ### Object coordinate systems
201201
#
202202
# A coordinate system can also be defined relative to elements
203203
# belonging to an object. For example, the coordinate system can be
204204
# connected to an object face.
205205

206206
obj_cs = hfss.modeler.create_object_coordinate_system(
207-
obj=box,
207+
assignment=box,
208208
origin=box.faces[0],
209209
x_axis=box.edges[0],
210210
y_axis=[0, 0, 0],
@@ -215,7 +215,7 @@
215215
# Create an object coordinate system whose origin is linked to the edge of an object.
216216

217217
obj_cs_1 = hfss.modeler.create_object_coordinate_system(
218-
obj=box.name,
218+
assignment=box.name,
219219
origin=box.edges[0],
220220
x_axis=[1, 0, 0],
221221
y_axis=[0, 1, 0],
@@ -226,7 +226,7 @@
226226
# Create object coordinate system with origin specified on a point within an object.
227227

228228
obj_cs_2 = hfss.modeler.create_object_coordinate_system(
229-
obj=box.name,
229+
assignment=box.name,
230230
origin=[0, 0.8, 0],
231231
x_axis=[1, 0, 0],
232232
y_axis=[0, 1, 0],
@@ -247,7 +247,9 @@
247247
obj_cs_3.props["MoveToEnd"] = False
248248
obj_cs_3.update()
249249

250-
# ## Get all coordinate systems
250+
# ### Get all coordinate systems
251+
#
252+
# All coordinate systems can easily be retrieved and subsequently manipulated.
251253

252254
css = hfss.modeler.coordinate_systems
253255
names = [i.name for i in css]

0 commit comments

Comments
 (0)