Skip to content

Commit

Permalink
Merge branch 'main' into fix/issue_3908
Browse files Browse the repository at this point in the history
  • Loading branch information
Devin-Crawford authored Jan 3, 2024
2 parents 55b6144 + 879f889 commit 653ec62
Show file tree
Hide file tree
Showing 20 changed files with 244 additions and 152 deletions.
34 changes: 32 additions & 2 deletions _unittest/test_02_2D_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ def test_03_objects(self):
assert self.aedtapp.modeler._omaterial_manager

def test_04_create_rectangle(self):
test_color = (220, 90, 0)
rect1 = self.aedtapp.modeler.create_rectangle([0, -2, -2], [3, 8])
rect2 = self.aedtapp.modeler.create_rectangle(
position=[10, -2, -2], dimension_list=[3, 10], name="MyRectangle", matname="Copper"
position=[10, -2, -2],
dimension_list=[3, 10],
name="MyRectangle",
material_name="Copper",
color=test_color,
)
assert rect1.solve_inside
assert rect1.model
assert rect1.material_name == "vacuum"
assert rect2.color == test_color
assert isclose(rect1.faces[0].area, 3.0 * 8.0)

list_of_pos = [ver.position for ver in rect1.vertices]
Expand Down Expand Up @@ -73,8 +79,15 @@ def test_05_create_rectangle_rz(self):

def test_06_create_circle(self):
circle1 = self.aedtapp.modeler.create_circle([0, -2, 0], 3)

# TODO: deprecate "matname" as named argument, replace it with the Object3D property "material_name"
circle2 = self.aedtapp.modeler.create_circle(
position=[0, -2, -2], radius=3, num_sides=6, name="MyCircle", matname="Copper"
position=[0, -2, -2],
radius=3,
num_sides=6,
name="MyCircle",
matname="Copper",
display_wireframe=True,
)
assert circle1.solve_inside
assert circle1.model
Expand All @@ -85,6 +98,22 @@ def test_06_create_circle(self):
assert circle2.model
assert circle2.material_name == "copper"
assert isclose(circle1.faces[0].area, math.pi * 3.0 * 3.0)
circle3 = self.aedtapp.modeler.create_circle(
position=[0, 4, -2],
radius=2,
num_sides=8,
name="Circle3",
material_name="Copper",
)
assert circle3.material_name == "copper"
circle4 = self.aedtapp.modeler.create_circle(
position=[0, -4, -2],
radius=2.2,
num_sides=6,
name="NonModelCirc",
model=False,
)
assert not circle4.model

def test_06a_calculate_radius_2D(self):
circle1 = self.aedtapp.modeler.create_circle([0, -2, 0], 3)
Expand Down Expand Up @@ -132,6 +161,7 @@ def test_08_create_regular_polygon(self):

@pytest.mark.skipif(is_linux or sys.version_info < (3, 8), reason="Not running in ironpython")
def test_09_plot(self):
self.aedtapp.solution_type = "MagnetostaticZ"
self.aedtapp.modeler.create_regular_polygon([0, 0, 0], [0, 0, 2])
self.aedtapp.modeler.create_regular_polygon(
position=[0, 0, 0], start_point=[0, 0, 2], num_sides=3, name="MyPolygon", matname="Copper"
Expand Down
32 changes: 25 additions & 7 deletions _unittest/test_02_3D_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,24 @@ def test_04_convert_to_selection(self):

def test_05_split(self):
self.aedtapp.insert_design("split_test")
box1 = self.aedtapp.modeler.create_box([-10, -10, -10], [20, 20, 20], "box_to_split")
box2 = self.aedtapp.modeler.create_box([-10, -10, -10], [20, 20, 20], "box_to_split2")
box1 = self.aedtapp.modeler.create_box([-10, -10, -10], [20, 20, 20], "box_to_split", color=(255, 0, 0))
assert box1.color == (255, 0, 0)
box2 = self.aedtapp.modeler.create_box([-10, -10, -10], [20, 20, 20], "box_to_split2", transparency=1)
assert box2.transparency == 1
split = self.aedtapp.modeler.split(box1.name, 2)
assert isinstance(split, list)
assert isinstance(split[0], str)
split2 = box2.split(1)
assert isinstance(split2, list)
assert box2.name in split2[0]
box3 = self.aedtapp.modeler.create_box([10, 10, 10], [20, 20, 20], "box_to_split3")
rect1 = self.aedtapp.modeler.create_rectangle(self.aedtapp.PLANE.XY, [10, 8, 20], [20, 30], name="rect1")
box3 = self.aedtapp.modeler.create_box([10, 10, 10], [20, 20, 20], "box_to_split3", display_wireframe=True)
assert box3.display_wireframe
rect1 = self.aedtapp.modeler.create_rectangle(
self.aedtapp.PLANE.XY, [10, 8, 20], [20, 30], name="rect1", transparency=0.5, display_wireframe=True
)
assert rect1.transparency == 0.5
assert rect1.display_wireframe
assert rect1.name == "rect1"
split = self.aedtapp.modeler.split(objects=box3, sides="Both", tool=rect1.id)
assert isinstance(split, list)
assert isinstance(split[0], str)
Expand Down Expand Up @@ -209,8 +217,10 @@ def test_17_unite(self):
assert self.aedtapp.modeler.unite([o1, o2], purge=True) == o1.name

def test_18_chamfer(self):
# TODO
assert True
o1 = self.aedtapp.modeler["box_to_split"]
assert abs(o1.volume - 4000.0) < tol
assert o1.top_edge_x.chamfer(1)
assert abs(o1.volume - 3990.0) < tol # Volume decreased

def test_19_clone(self):
self.restore_model()
Expand Down Expand Up @@ -1069,13 +1079,21 @@ def test_62_copy_solid_bodies_udm_3dcomponent(self, add_app):
obj_udm = self.aedtapp.modeler.create_udm(
udmfullname="Maxwell3D/OnDieSpiralInductor.py", udm_params_list=my_udmPairs, udm_library="syslib"
)

assert len(obj_udm.parts) == 5
names = [p.name for p in obj_udm.parts.values()]
assert "Inductor" in names
assert "Substrate" in names
compfile = self.aedtapp.components3d["Bowtie_DM"]
obj_3dcomp = self.aedtapp.modeler.insert_3d_component(compfile)
assert len(obj_3dcomp.parts) == 4
dest = add_app(design_name="IcepakDesign1", just_open=True)
dest.copy_solid_bodies_from(self.aedtapp, [obj_udm.name, obj_3dcomp.name])
assert len(dest.modeler.object_list) == 9
assert "Arm" in dest.modeler.object_names
dest.delete_design("IcepakDesign1")
dest = add_app(design_name="IcepakDesign2", just_open=True)
dest.copy_solid_bodies_from(self.aedtapp)
dest2 = add_app(design_name="uUSB")
dest2.copy_solid_bodies_from(self.aedtapp, [obj_udm.name, obj_3dcomp.name])
assert len(dest2.modeler.objects) == 9
assert "port1" in dest2.modeler.object_names
2 changes: 1 addition & 1 deletion doc/source/User_guide/variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ access the ``variable_manager`` object for a more comprehensive set of functions
>>> hfss["$PrjVar3"] = "34 * $PrjVar1/$PrjVar2"
>>> hfss["$PrjVar3"]
2.13628300444106
>>> hfss["$PrjVar3"].value
>>> hfss.evaluate_expression(hfss["$PrjVar3"])
2.13628300444106
hfss.variable_manager["$PrjVar3"].expression
'34 * $PrjVar1/$PrjVar2'
Expand Down
2 changes: 1 addition & 1 deletion examples/00-EDB/08_CPWG.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Peform required imports. Importing the ``Hfss3dlayout`` object initializes it
# Perform required imports. Importing the ``Hfss3dlayout`` object initializes it
# on version 2023 R2.

import pyaedt
Expand Down
2 changes: 1 addition & 1 deletion examples/00-EDB/09_Configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Peform required imports. Importing the ``Hfss3dlayout`` object initializes it
# Perform required imports. Importing the ``Hfss3dlayout`` object initializes it
# on version 2023 R2.

import os
Expand Down
2 changes: 1 addition & 1 deletion examples/00-EDB/14_edb_create_parametrized_design.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
EDB: paramterized design
EDB: parameterized design
------------------------
This example shows how to
1, Create an HFSS simulation project using SimulationConfiguration class.
Expand Down
2 changes: 1 addition & 1 deletion examples/02-HFSS/Create_3d_Component_and_use_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
# Advanced Modeler functions
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
# Thanks to Python capabilities a lot of additional functionalities have been added to the Modeler of PyAEDT.
# in this example there is a property to retrive automatically top and bottom faces of an objects.
# in this example there is a property to retrieve automatically top and bottom faces of an objects.


side_face = [i for i in via_outer.faces if i.id not in [via_outer.top_face_z.id, via_outer.bottom_face_z.id]]
Expand Down
10 changes: 5 additions & 5 deletions examples/04-Icepak/Icepak_CSV_Import.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports including the opertaing system, regular expression, csv, Ansys PyAEDT
# Perform required imports including the operating system, regular expression, csv, Ansys PyAEDT
# and its boundary objects.

import os
Expand Down Expand Up @@ -75,7 +75,7 @@
###############################################################################
# Defining a function for network block types
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This function will be called in the next step if the blcok type is network.
# This function will be called in the next step if the block type is network.
# It will read the board side as well as thetaj values and assign them to the block.

def create_2R_network_BC(object3d, power, rjb, rjc, board_side):
Expand Down Expand Up @@ -148,9 +148,9 @@ def create_2R_network_BC(object3d, power, rjb, rjc, board_side):

for i in range(len(rows)):

origin = [float(rows[i][2]), float(rows[i][3]), float(rows[i][4])] # blcok starting point
dimensions = [float(rows[i][5]), float(rows[i][6]), float(rows[i][7])] # blcok lengths in 3 dimentions
block_name = rows[i][1] # blcok name
origin = [float(rows[i][2]), float(rows[i][3]), float(rows[i][4])] # block starting point
dimensions = [float(rows[i][5]), float(rows[i][6]), float(rows[i][7])] # block lengths in 3 dimensions
block_name = rows[i][1] # block name
block_name = re.sub("\W", "_", block_name)

# Define material name
Expand Down
2 changes: 1 addition & 1 deletion examples/04-Icepak/Icepak_ECAD_Import.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
###############################################################################
# Perform required imports
# ~~~~~~~~~~~~~~~~~~~~~~~~
# Perform required imports including the opertaing system, Ansys PyAEDT packages.
# Perform required imports including the operating system, Ansys PyAEDT packages.


# Generic Python packages
Expand Down
2 changes: 1 addition & 1 deletion examples/05-Q3D/Q3D_from_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
export_path=os.path.join(q3d.working_directory, "Q3D.jpg"), plot_air_objects=False)

###############################################################################
# Assing Source and Sink
# Assign Source and Sink
# ~~~~~~~~~~~~~~~~~~~~~~
# Use previously calculated position to identify faces and
# assign sources and sinks on nets.
Expand Down
6 changes: 3 additions & 3 deletions examples/06-Multiphysics/MRI.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
hfss.modeler.insert_3d_component(os.path.join(project_path, "coil.a3dcomp"))

###############################################################################
# Expression Chache
# Expression Cache
# ~~~~~~~~~~~~~~~~~
# On the expression cache tab, define additional convergence criteria for self impedance of the four coil
# ports
Expand Down Expand Up @@ -179,7 +179,7 @@
# Create Setup
# ~~~~~~~~~~~~
# Create a new setup and edit properties.
# Simuation will be for 60 seconds.
# Simulation will be for 60 seconds.

setup = mech.create_setup()
# setup.add_mesh_link("backgroundSAR")
Expand Down Expand Up @@ -258,7 +258,7 @@
# Create Setup
# ~~~~~~~~~~~~
# Create a new setup and edit properties.
# Simuation will be for 60 seconds.
# Simulation will be for 60 seconds.

setup = ipk.create_setup()

Expand Down
2 changes: 1 addition & 1 deletion examples/07-EMIT/ComputeInterferenceType.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def install(package):
# ~~~~~~~~~~~~~~~~~~~~~~~~~
# Iterate over all the transmitters and receivers and compute the power
# at the input to each receiver due to each of the transmitters. Computes
# which, if any, type of interference occured.
# which, if any, type of interference occurred.

power_matrix=[]
all_colors=[]
Expand Down
6 changes: 3 additions & 3 deletions examples/07-EMIT/interference_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def interference_results(self):
if self.emitapp.save_project() == False:
msg = QtWidgets.QMessageBox()
msg.setWindowTitle("Writing Error")
msg.setText("An error occured while writing to the file. Is it readonly? Disk full? See AEDT log for more information.")
msg.setText("An error occurred while writing to the file. Is it readonly? Disk full? See AEDT log for more information.")
x = msg.exec()
return

Expand All @@ -483,7 +483,7 @@ def interference_results(self):
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Iterate over all the transmitters and receivers and compute the power
# at the input to each receiver due to each of the transmitters. Compute
# which, if any, type of interference occured.
# which, if any, type of interference occurred.
domain = self.emitapp.results.interaction_domain()
self.all_colors, self.power_matrix = self.rev.interference_type_classification(domain, use_filter = True, filter_list = filter)

Expand Down Expand Up @@ -516,7 +516,7 @@ def protection_results(self):
if self.emitapp.save_project() == False:
msg = QtWidgets.QMessageBox()
msg.setWindowTitle("Writing Error")
msg.setText("An error occured while writing to the file. Is it readonly? Disk full? See AEDT log for more information.")
msg.setText("An error occurred while writing to the file. Is it readonly? Disk full? See AEDT log for more information.")
x = msg.exec()
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@
confpath = os.path.join(data_folder, source_build_conf_file)
static_rom_builder.Build(confpath.replace('\\', '/'))

# Test if ROM was created sucessfully
# Test if ROM was created successfully
static_rom_path = os.path.join(data_folder, 'StaticRom.rom')
if os.path.exists(static_rom_path):
tb.logger.info("Built intermediate rom file sucessfully at: %s", static_rom_path)
tb.logger.info("Built intermediate rom file successfully at: %s", static_rom_path)
else:
tb.logger.error("Intermediate rom file not found at: %s", static_rom_path)

Expand Down
4 changes: 2 additions & 2 deletions pyaedt/dlls/PDFReport/ICSharpCode.SharpZipLib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8890,7 +8890,7 @@
<summary>
Delegate invoked during <see cref="M:ICSharpCode.SharpZipLib.Zip.ZipFile.TestArchive(System.Boolean,ICSharpCode.SharpZipLib.Zip.TestStrategy,ICSharpCode.SharpZipLib.Zip.ZipTestResultHandler)">testing</see> if supplied indicating current progress and status.
</summary>
<remarks>If the message is non-null an error has occured. If the message is null
<remarks>If the message is non-null an error has occurred. If the message is null
the operation as found in <see cref="T:ICSharpCode.SharpZipLib.Zip.TestStatus">status</see> has started.</remarks>
</member>
<member name="T:ICSharpCode.SharpZipLib.Zip.FileUpdateMode">
Expand Down Expand Up @@ -10739,7 +10739,7 @@
if entry passed is null.
</exception>
<exception cref="T:System.IO.IOException">
if an I/O error occured.
if an I/O error occurred.
</exception>
<exception cref="T:System.InvalidOperationException">
if stream was finished
Expand Down
16 changes: 8 additions & 8 deletions pyaedt/generic/general_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def check_and_download_file(local_path, remote_path, overwrite=True):
Local path to save the file to.
remote_path : str
Path to the remote file.
overwrite : bool
overwrite : bool, optional
Whether to overwrite the file if it already exits locally.
The default is ``True``.
Expand Down Expand Up @@ -333,7 +333,7 @@ def check_and_download_folder(local_path, remote_path, overwrite=True):
Local path to save the folder to.
remote_path : str
Path to the remote folder.
overwrite : bool
overwrite : bool, optional
Whether to overwrite the folder if it already exits locally.
The default is ``True``.
Expand Down Expand Up @@ -497,7 +497,7 @@ def env_value(input_version):
Examples
--------
>>> env_value("2021.2")
"ANSYSEM_ROOT211"
"ANSYSEM_ROOT212"
"""
return "ANSYSEM_ROOT{0}{1}".format(
get_version_and_release(input_version)[0], get_version_and_release(input_version)[1]
Expand Down Expand Up @@ -548,7 +548,7 @@ def env_value_student(input_version):
Examples
--------
>>> env_value_student("2021.2")
"ANSYSEMSV_ROOT211"
"ANSYSEMSV_ROOT212"
"""
return "ANSYSEMSV_ROOT{0}{1}".format(
get_version_and_release(input_version)[0], get_version_and_release(input_version)[1]
Expand Down Expand Up @@ -580,11 +580,11 @@ def generate_unique_name(rootname, suffix="", n=6):
Parameters
----------
rootname :
rootname : string
Root name to add random characters to.
suffix : string
suffix : string, optional
Suffix to add. The default is ``''``.
n : int
n : int, optional
Number of random characters to add to the name. The default value is ``6``.
Returns
Expand Down Expand Up @@ -669,7 +669,7 @@ def _retry_ntimes(n, function, *args, **kwargs):
Parameters
----------
n :
n : int
function :
Expand Down
Loading

0 comments on commit 653ec62

Please sign in to comment.