Skip to content

Commit 06ebac8

Browse files
maxcapodi78PipKatMaxJPReypre-commit-ci[bot]
authored
Improved documentation (#3716)
* Improved documentation * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Maxime Rey <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Maxime Rey <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * Update pyaedt/modeler/cad/Primitives3D.py Co-authored-by: Kathy Pippert <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added docstring --------- Co-authored-by: maxcapodi78 <Shark78> Co-authored-by: Kathy Pippert <[email protected]> Co-authored-by: Maxime Rey <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent a3b3d96 commit 06ebac8

File tree

2 files changed

+181
-7
lines changed

2 files changed

+181
-7
lines changed

_unittest/test_01_downloads.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def test_13_download_specific_folder(self):
8888
def test_14_download_icepak_3d_component(self):
8989
assert self.examples.download_icepak_3d_component()
9090

91+
@pytest.mark.skipif(is_linux, reason="Failing download files")
9192
def test_15_download_fss_file(self):
9293
example_folder = self.examples.download_FSS_3dcomponent()
9394
assert os.path.exists(example_folder)

pyaedt/modeler/cad/Primitives3D.py

Lines changed: 180 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,23 @@ def create_box(self, position, dimensions_list, name=None, matname=None):
8282
8383
Examples
8484
--------
85+
This example shows how to create a box in HFSS.
86+
The required parameters are ``position`` that provides the origin of the
87+
box and ``dimensions_list`` that provide the box sizes.
88+
The optional parameter ``matname`` allows you to set the material name of the box.
89+
The optional parameter ``name`` allows you to assign a name to the box.
90+
91+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, and
92+
Mechanical.
8593
8694
>>> from pyaedt import hfss
8795
>>> hfss = Hfss()
8896
>>> origin = [0,0,0]
8997
>>> dimensions = [10,5,20]
90-
>>> #Material and name are not mandatory fields
91-
>>> box_object = hfss.modeler.primivites.create_box(origin, dimensions, name="mybox", matname="copper")
98+
>>> box_object = hfss.modeler.primivites.create_box(position=origin,
99+
... dimensions_list=dimensions,
100+
... name="mybox",
101+
... matname="copper")
92102
93103
"""
94104
if len(position) != 3:
@@ -145,9 +155,21 @@ def create_cylinder(self, cs_axis, position, radius, height, numSides=0, name=No
145155
146156
Examples
147157
--------
158+
This example shows how to create a cylinder in HFSS.
159+
The required parameters are ``cs_axis``, ``position``, ``radius``, and ``height``. The
160+
``cs_axis`` parameter provides the direction axis of the cylinder. The ``position``
161+
parameter provides the origin of the cylinder. The other two parameters provide
162+
the radius and height of the cylinder.
163+
164+
The optional parameter ``matname`` allows you to set the material name of the cylinder.
165+
The optional parameter ``name`` allows to assign a name to the cylinder.
166+
167+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, and
168+
Mechanical.
169+
148170
>>> from pyaedt import Hfss
149171
>>> aedtapp = Hfss()
150-
>>> cylinder_object = aedtapp.modeler..create_cylinder(cs_axis='Z', position=[0,0,0],
172+
>>> cylinder_object = aedtapp.modeler.create_cylinder(cs_axis='Z', position=[0,0,0],
151173
... radius=2, height=3, name="mycyl",
152174
... matname="vacuum")
153175
@@ -220,6 +242,14 @@ def create_polyhedron(
220242
221243
Examples
222244
--------
245+
The following examples shows how to create a regular polyhedron in HFSS.
246+
The required parameters are cs_axis that provides the direction axis of the polyhedron,
247+
center_position that provides the center of the polyhedron, start_position of the polyhedron,
248+
height of the polyhedron and num_sides to determine the number of sides.
249+
The parameter matname is optional and allows to set the material name of the polyhedron.
250+
The parameter name is optional and allows to give a name to the polyhedron.
251+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, Mechanical.
252+
223253
>>> from pyaedt import Hfss
224254
>>> aedtapp = Hfss()
225255
>>> ret_obj = aedtapp.modeler.create_polyhedron(cs_axis='X', center_position=[0, 0, 0],
@@ -257,7 +287,7 @@ def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name
257287
cs_axis : str
258288
Axis of rotation of the starting point around the center point.
259289
The default is ``None``, in which case the Z axis is used.
260-
center_position : list, optional
290+
position : list, optional
261291
List of ``[x, y, z]`` coordinates for the center position
262292
of the bottom of the cone.
263293
bottom_radius : float
@@ -285,6 +315,20 @@ def create_cone(self, cs_axis, position, bottom_radius, top_radius, height, name
285315
286316
Examples
287317
--------
318+
This example shows how to create a cone in HFSS.
319+
The required parameters are ``cs_axis``, ``position``, ``bottom_radius``, and
320+
``top_radius``. The ``cs_axis`` parameter provides the direction axis of
321+
the cone. The ``position`` parameter provides the starting point of the
322+
cone. The ``bottom_radius`` and ``top_radius`` parameters provide the
323+
radius and `eight of the cone.
324+
325+
The optional parameter ``matname`` allows you to set the material name of the cone.
326+
The optional parameter ``name`` allows you to assign a name to the cone.
327+
328+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, and
329+
Mechanical.
330+
331+
288332
>>> from pyaedt import Hfss
289333
>>> aedtapp = Hfss()
290334
>>> cone_object = aedtapp.modeler.create_cone(cs_axis='Z', position=[0, 0, 0],
@@ -349,6 +393,16 @@ def create_sphere(self, position, radius, name=None, matname=None):
349393
350394
Examples
351395
--------
396+
This example shows how to create a sphere in HFSS.
397+
The required parameters are ``position``, which provides the center of the sphere, and
398+
``radius``, which is the radius of the sphere. The optional parameter ``matname``
399+
allows you to set the material name of the sphere. The optional parameter
400+
``name`` allows to assign a name to the sphere.
401+
402+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, and
403+
Mechanical.
404+
405+
352406
>>> from pyaedt import Hfss
353407
>>> aedtapp = Hfss()
354408
>>> ret_object = aedtapp.modeler.create_sphere(position=[0,0,0], radius=2,
@@ -409,11 +463,17 @@ def create_torus(self, center, major_radius, minor_radius, axis=None, name=None,
409463
Examples
410464
--------
411465
Create a torus named ``"mytorus"`` about the Z axis with a major
412-
radius of 1, minor radius of 0.5, and a material of ``"copper"``.
466+
radius of 1 , minor radius of 0.5, and a material of ``"copper"``.
467+
The optional parameter ``matname`` allows you to set the material name of the sphere.
468+
The optional parameter ``name`` allows you to give a name to the sphere.
469+
470+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, and
471+
Mechanical.
472+
413473
>>> from pyaedt import Hfss
414474
>>> hfss = Hfss()
415475
>>> origin = [0, 0, 0]
416-
>>> torus = hfss.modeler.create_torus(origin, major_radius=1,
476+
>>> torus = hfss.modeler.create_torus(center=origin, major_radius=1,
417477
... minor_radius=0.5, axis="Z",
418478
... name="mytorus", material_name="copper")
419479
@@ -686,6 +746,29 @@ def create_circle(
686746
687747
>>> oEditor.CreateCircle
688748
749+
Examples
750+
--------
751+
The following example shows how to create a circle in HFSS.
752+
The required parameters are ``cs_plane``, ``position``, ``radius``,
753+
and ``num_sides``. The ``cs_plane`` parameter provides the plane
754+
that the circle is designed on. The ``position`` parameter provides
755+
the origin of the circle. The ``radius`` and ``num_sides`` parameters
756+
provide the radius and number of discrete sides of the circle,
757+
758+
The optional parameter ``matname`` allows you to set the material name
759+
of the circle. The optional parameter ``name`` allows you to assign a name
760+
to the circle.
761+
762+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D,
763+
and Mechanical.
764+
765+
>>> from pyaedt import Hfss
766+
>>> aedtapp = Hfss()
767+
>>> circle_object = aedtapp.modeler.create_circle(cs_plane='Z', position=[0,0,0],
768+
... radius=2, num_sides=8, name="mycyl",
769+
... matname="vacuum")
770+
771+
689772
"""
690773
non_model_flag = ""
691774
if non_model:
@@ -741,6 +824,31 @@ def create_ellipse(self, cs_plane, position, major_radius, ratio, is_covered=Tru
741824
742825
>>> oEditor.CreateEllipse
743826
827+
Examples
828+
--------
829+
The following example shows how to create an ellipse in HFSS.
830+
The required parameters are ``cs_plane``, ``position``, ``major_radius``,
831+
``ratio``, and ``is_covered``. The ``cs_plane`` parameter provides
832+
the plane that the ellipse is designed on. The ``position`` parameter
833+
provides the origin of the ellipse. The ``major_radius`` parameter provides
834+
the radius of the ellipse. The ``ratio`` parameter is a ratio between the
835+
major radius and minor radius of the ellipse. The ``is_covered`` parameter
836+
is a flag indicating if the ellipse is covered.
837+
838+
The optional parameter ``matname`` allows you to set the material name
839+
of the ellipse. The optional parameter ``name`` allows you to assign a name
840+
to the ellipse.
841+
842+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D,
843+
and Mechanical.
844+
845+
>>> from pyaedt import Hfss
846+
>>> aedtapp = Hfss()
847+
>>> ellipse = aedtapp.modeler.create_ellipse(cs_plane='Z', position=[0,0,0],
848+
... major_radius=2, ratio=2, is_covered=True, name="myell",
849+
... matname="vacuum")
850+
851+
744852
"""
745853
szAxis = GeometryOperators.cs_plane_to_axis_str(cs_plane)
746854
XStart, YStart, ZStart = self._pos_with_arg(position)
@@ -833,6 +941,35 @@ def create_equationbased_curve(
833941
834942
>>> oEditor.CreateEquationCurve
835943
944+
945+
Examples
946+
--------
947+
The following example shows how to create an equation- based curve in HFSS.
948+
The required parameters are ``cs_plane``, ``position``, ``major_radius``,
949+
``ratio``, and ``is_covered``. The ``cs_plane`` parameter provides
950+
the plane that the ellipse is designed on. The ``position`` parameter
951+
provides the origin of the ellipse. The ``major_radius`` parameter provides
952+
the radius of the ellipse. The ``ratio`` parameter is a ratio between the
953+
major radius and minor radius of the ellipse. The ``is_covered`` parameter
954+
is a flag indicating if the ellipse is covered.
955+
956+
The optional parameter ``matname`` allows you to set the material name
957+
of the ellipse. The optional parameter ``name`` allows you to assign a name
958+
to the ellipse.
959+
960+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D,
961+
and Mechanical.
962+
963+
>>> from pyaedt import Hfss
964+
>>> aedtapp = Hfss()
965+
>>> eq_xsection = self.aedtapp.modeler.create_equationbased_curve(x_t="_t",
966+
... y_t="_t*2",
967+
... num_points=200,
968+
... z_t=0,
969+
... t_start=0.2,
970+
... t_end=1.2,
971+
... xsection_type="Circle")
972+
836973
"""
837974
x_section = self._crosssection_arguments(
838975
type=xsection_type,
@@ -913,6 +1050,33 @@ def create_helix(
9131050
9141051
>>> oEditor.CreateHelix
9151052
1053+
Examples
1054+
--------
1055+
The following example shows how to create a polyline and then create an helix from the polyline.
1056+
This method applies to all 3D applications: HFSS, Q3D, Icepak, Maxwell 3D, and
1057+
Mechanical.
1058+
1059+
>>> from pyaedt import Hfss
1060+
>>> aedtapp = Hfss()
1061+
>>> udp1 = [0, 0, 0]
1062+
>>> udp2 = [5, 0, 0]
1063+
>>> udp3 = [10, 5, 0]
1064+
>>> udp4 = [15, 3, 0]
1065+
>>> polyline = aedtapp.modeler.create_polyline(
1066+
... [udp1, udp2, udp3, udp4], cover_surface=False, name="helix_polyline"
1067+
... )
1068+
1069+
>>> helix_right_turn = aedtapp.modeler.create_helix(
1070+
... polyline_name=polyline.name,
1071+
... position=[0, 0, 0],
1072+
... x_start_dir=0,
1073+
... y_start_dir=1.0,
1074+
... z_start_dir=1.0,
1075+
... num_thread=1,
1076+
... right_hand=True,
1077+
... radius_increment=0.0,
1078+
... thread=1.0,
1079+
... )
9161080
"""
9171081
if not polyline_name or polyline_name == "":
9181082
raise ValueError("The name of the polyline cannot be an empty string.")
@@ -958,7 +1122,7 @@ def convert_segments_to_line(self, object_name):
9581122
9591123
Parameters
9601124
----------
961-
object_name : int, str, or Object3d
1125+
object_name : int, str, or :class:`pyaedt.modeler.cad.object3d.Object3d`
9621126
Specified for the object.
9631127
9641128
Returns
@@ -971,6 +1135,15 @@ def convert_segments_to_line(self, object_name):
9711135
9721136
>>> oEditor.ChangeProperty
9731137
1138+
Examples
1139+
--------
1140+
1141+
>>> from pyaedt import Hfss
1142+
>>> aedtapp = Hfss()
1143+
>>> edge_object = aedtapp.modeler.create_object_from_edge("my_edge")
1144+
>>> aedtapp.modeler.generate_object_history(edge_object)
1145+
>>> aedtapp.modeler.convert_segments_to_line(edge_object.name)
1146+
9741147
"""
9751148
this_object = self._resolve_object(object_name)
9761149
edges = this_object.edges

0 commit comments

Comments
 (0)