diff --git a/examples/01-Modeling-Setup/Configurations.py b/examples/01-Modeling-Setup/Configurations.py index 98372d89f..f5be2e9ea 100644 --- a/examples/01-Modeling-Setup/Configurations.py +++ b/examples/01-Modeling-Setup/Configurations.py @@ -23,41 +23,40 @@ # any reason, this face position has changed or the object name in the target # design has changed, the boundary fails to apply. -# ## Perform required imports +# ## Preparation +# Import the required packages +# + import os import tempfile +import time import pyaedt from pyaedt.generic.general_methods import generate_unique_name +# - -# Set constant values +# Define constants AEDT_VERSION = "2024.1" - -# ## Set non-graphical mode - -# You can set ``non_graphical`` either to ``True`` or ``False``. - -non_graphical = False +NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") # ## Download project project_full_name = pyaedt.downloads.download_icepak(destination=temp_dir.name) # ## Open project - -# Open the project, and save it to the temporary folder. +# +# Open the Icepak project from the project folder. ipk = pyaedt.Icepak( project=project_full_name, version=AEDT_VERSION, new_desktop=True, - non_graphical=non_graphical, + non_graphical=NG_MODE, ) ipk.autosave_disable() @@ -99,8 +98,8 @@ file_name=filename, file_path=ipk.working_directory, file_format=".step", - object_list=[], - removed_objects=[], + assignment_to_export=[], + assignment_to_remove=[], ) # ## Export configuration files @@ -108,14 +107,16 @@ # Export the configuration files. You can optionally disable the export and # import sections. Supported formats are json and toml files -conf_file = ipk.configurations.export_config(os.path.join(ipk.working_directory, "config.toml")) +conf_file = ipk.configurations.export_config( + os.path.join(ipk.working_directory, "config.toml") +) ipk.close_project() # ## Create project # # Create an Icepak project and import the step. -new_project = os.path.join(temp_dir.name, generate_unique_name("example") + ".aedt") +new_project = os.path.join(temp_dir.name, "example.aedt") app = pyaedt.Icepak(project=new_project) app.modeler.import_3d_cad(file_path) @@ -131,7 +132,13 @@ # Close the project and release AEDT. app.release_desktop() +time.sleep(3) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. -# ## Clean temporary directory +# ## Cleanup +# +# All project files are saved in the folder ``temp_dir.name``. +# If you've run this example as a Jupyter notebook you +# can retrieve those project files. The following cell removes +# all temporary files, including the project folder. temp_dir.cleanup() diff --git a/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py b/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py index c34e482f7..5921d8c5a 100644 --- a/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py +++ b/examples/01-Modeling-Setup/HFSS_CoordinateSystem.py @@ -2,42 +2,32 @@ # # This example shows how you can use PyAEDT to create and modify coordinate systems in the modeler. # -# ## Perform required imports -# -# Perform required imports +# ## Preparation +# Import the required packages import tempfile - +import time import pyaedt +import os -# Set constant values +# Define constants AEDT_VERSION = "2024.1" - -# ## Set non-graphical mode - -# Set non-graphical mode. -# You can set ``non_graphical`` either to ``True`` or ``False``. - -non_graphical = False +NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") # ## Launch AEDT -d = pyaedt.launch_desktop( - version=AEDT_VERSION, non_graphical=non_graphical, new_desktop=True -) +d = pyaedt.launch_desktop(version=AEDT_VERSION, non_graphical=NG_MODE, new_desktop=True) # ## Insert HFSS design # # Insert an HFSS design with the default name. -project_name = pyaedt.generate_unique_project_name( - rootname=temp_dir.name, project_name="CoordSysDemo" -) +project_name = os.path.join(temp_dir.name, "CoordSysDemo.aedt") hfss = pyaedt.Hfss(project=project_name) # ## Create coordinate system @@ -57,7 +47,8 @@ cs1.props["OriginY"] = 10 cs1.props["OriginZ"] = 10 -# Pointing vectors can be changed +# The orientation of the coordinate system can be modified by +# updating the direction vectors for the coordinate system. ypoint = [0, -1, 0] cs1.props["YAxisXvec"] = ypoint[0] @@ -72,13 +63,17 @@ # ## Change coordinate system mode # -# Use the ``change_cs_mode`` method to change the mode. Options are ``0`` -# for axis/position, ``1`` for Euler angle ZXZ, and ``2`` for Euler angle ZYZ. +# Use the ``change_cs_mode`` method to change the mode. Options are +# +# - ``0`` for axis/position +# - ``1`` for Euler angle ZXZ +# - ``2`` for Euler angle ZYZ. +# # Here ``1`` sets Euler angle ZXZ as the mode. cs1.change_cs_mode(1) -# In the new mode, these properties can be edited +# The following lines use the ZXZ Euler angle definition to rotate the coordinate system. cs1.props["Phi"] = "10deg" cs1.props["Theta"] = "22deg" @@ -90,28 +85,33 @@ cs1.delete() -# ## Create coordinate system by defining axes +# ## Define a new coordinate system # -# Create a coordinate system by defining the axes. During creation, you can -# specify all coordinate system properties. +# Create a coordinate system by defining the axes. You can +# specify all coordinate system properties as shown here. cs2 = hfss.modeler.create_coordinate_system( - name="CS2", origin=[1, 2, 3.5], mode="axis", x_pointing=[1, 0, 1], y_pointing=[0, -1, 0] + name="CS2", + origin=[1, 2, 3.5], + mode="axis", + x_pointing=[1, 0, 1], + y_pointing=[0, -1, 0], ) -# ## Create coordinate system by defining Euler angles -# -# Create a coordinate system by defining Euler angles. +# A new coordinate system can also be created based on the Euler angle convention. cs3 = hfss.modeler.create_coordinate_system( name="CS3", origin=[2, 2, 2], mode="zyz", phi=10, theta=20, psi=30 ) -# ## Create coordinate system by defining view +# Create a coordinate system that is defined by standard views in the modeler. The options are +# +# - ``"iso"`` +# - ``"XY"`` +# - ``"XZ"`` +# - ``"XY"``. # -# Create a coordinate system by defining the view. Options are ``"iso"``, -# ``"XY"``, ``"XZ"``, and ``"XY"``. Here ``"iso"`` is specified. -# The axes are set automatically. +# Here ``"iso"`` is specified. The axes are set automatically. cs4 = hfss.modeler.create_coordinate_system( name="CS4", origin=[1, 0, 0], reference_cs="CS3", mode="view", view="iso" @@ -123,10 +123,10 @@ # specify the axis and angle rotation, this data is automatically translated # to Euler angles. -cs5 = hfss.modeler.create_coordinate_system(name="CS5", mode="axisrotation", u=[1, 0, 0], theta=123) +cs5 = hfss.modeler.create_coordinate_system( + name="CS5", mode="axisrotation", u=[1, 0, 0], theta=123 +) -# ## Create face coordinate system -# # Face coordinate systems are bound to an object face. # First create a box and then define the face coordinate system on one of its # faces. To create the reference face for the face coordinate system, you must @@ -138,8 +138,6 @@ face=face, origin=face.edges[0], axis_position=face.edges[1], name="FCS1" ) -# ## Create face coordinate system centered on face -# # Create a face coordinate system centered on the face with the X axis pointing # to the edge vertex. @@ -147,8 +145,6 @@ face=face, origin=face, axis_position=face.edges[0].vertices[0], name="FCS2" ) -# ## Swap X and Y axes of face coordinate system -# # Swap the X axis and Y axis of the face coordinate system. The X axis is the # pointing ``axis_position`` by default. You can optionally select the Y axis. @@ -156,11 +152,13 @@ face=face, origin=face, axis_position=face.edges[0], axis="Y" ) -# Axis can also be changed after coordinate system creation +# The face coordinate system can also be rotated by changing the +# reference axis. + fcs3.props["WhichAxis"] = "X" -# ## Apply a rotation around Z axis +# ### Rotate the coordinate system # # Apply a rotation around the Z axis. The Z axis of a face coordinate system # is always orthogonal to the face. A rotation can be applied at definition. @@ -170,11 +168,11 @@ face=face, origin=face, axis_position=face.edges[1], rotation=10.3 ) -# ### Rotation can also be changed after coordinate system creation +# Rotation can also be changed after coordinate system creation fcs4.props["ZRotationAngle"] = "3deg" -# ## Apply offset to X and Y axes of face coordinate system +# ### Offset the coordinate system # # Apply an offset to the X axis and Y axis of a face coordinate system. # The offset is in respect to the face coordinate system itself. @@ -183,15 +181,15 @@ face=face, origin=face, axis_position=face.edges[2], offset=[0.5, 0.3] ) -# ### The offset can also be changed after the coordinate system is created. +# The offset can be changed after the coordinate system has been created. fcs5.props["XOffset"] = "0.2mm" fcs5.props["YOffset"] = "0.1mm" -# ## Create coordinate system relative to face coordinate system +# ### Dependent coordinate systems # -# Create a coordinate system relative to a face coordinate system. Coordinate -# systems and face coordinate systems interact with each other. +# The use of dependent coordinate systems can simplify model creation. The following +# cell demonstrates how to create a coordinate system whose reference is the face coordinate system. face = box.faces[1] fcs6 = hfss.modeler.create_face_coordinate_system( @@ -201,45 +199,59 @@ name="CS_FCS", origin=[0, 0, 0], reference_cs=fcs6.name, mode="view", view="iso" ) -# ## Create object coordinate system +# ### Object coordinate systems # -# Create object coordinate system with origin on face +# A coordinate system can also be defined relative to elements +# belonging to an object. For example, the coordinate system can be +# connected to an object face. obj_cs = hfss.modeler.create_object_coordinate_system( - obj=box, origin=box.faces[0], x_axis=box.edges[0], y_axis=[0, 0, 0], name="box_obj_cs" + assignment=box, + origin=box.faces[0], + x_axis=box.edges[0], + y_axis=[0, 0, 0], + name="box_obj_cs", ) obj_cs.rename("new_obj_cs") -# ## Create object coordinate system -# -# Create object coordinate system with origin on edge +# Create an object coordinate system whose origin is linked to the edge of an object. obj_cs_1 = hfss.modeler.create_object_coordinate_system( - obj=box.name, origin=box.edges[0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs_1" + assignment=box.name, + origin=box.edges[0], + x_axis=[1, 0, 0], + y_axis=[0, 1, 0], + name="obj_cs_1", ) obj_cs_1.set_as_working_cs() -# ## Create object coordinate system -# -# Create object coordinate system with origin specified on point +# Create object coordinate system with origin specified on a point within an object. obj_cs_2 = hfss.modeler.create_object_coordinate_system( - obj=box.name, origin=[0, 0.8, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], name="obj_cs_2" + assignment=box.name, + origin=[0, 0.8, 0], + x_axis=[1, 0, 0], + y_axis=[0, 1, 0], + name="obj_cs_2", ) new_obj_cs_2 = hfss.modeler.duplicate_coordinate_system_to_global(obj_cs_2) obj_cs_2.delete() -# ## Create object coordinate system -# -# Create object coordinate system with origin on vertex +# Create object coordinate system with origin on vertex. obj_cs_3 = hfss.modeler.create_object_coordinate_system( - obj=box.name, origin=box.vertices[1], x_axis=box.faces[2], y_axis=box.faces[4], name="obj_cs_3" + obj=box.name, + origin=box.vertices[1], + x_axis=box.faces[2], + y_axis=box.faces[4], + name="obj_cs_3", ) obj_cs_3.props["MoveToEnd"] = False obj_cs_3.update() -# ## Get all coordinate systems +# ### Get all coordinate systems +# +# All coordinate systems can easily be retrieved and subsequently manipulated. css = hfss.modeler.coordinate_systems names = [i.name for i in css] @@ -268,7 +280,11 @@ # Close the project and release AEDT. d.release_desktop() +time.sleep(3) -# ## Clean temporary directory +# ## Cleanup +# +# All project files are saved in the folder ``temp_dir.name``. If you've run this example as a Jupyter notebook you +# can retrieve those project files. The following cell removes all temporary files, including the project folder. temp_dir.cleanup() diff --git a/examples/01-Modeling-Setup/Optimetrics.py b/examples/01-Modeling-Setup/Optimetrics.py index af8618bb7..ce49be53d 100644 --- a/examples/01-Modeling-Setup/Optimetrics.py +++ b/examples/01-Modeling-Setup/Optimetrics.py @@ -4,45 +4,41 @@ # setups. -# ## Perform required imports -# -# Perform required imports. +# ## Preparation +# Import the required packages import os import tempfile +import time + import pyaedt -# Set constant values +# Define constants AEDT_VERSION = "2024.1" - -# ## Set non-graphical mode -# -# Set non-graphical mode. -# You can set ``non_graphical`` either to ``True`` or ``False``. - -non_graphical = False +NG_MODE = False # Open Electronics UI when the application is launched. # ## Create temporary directory -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") # ## Initialize HFSS and create variables # # Initialize the ``Hfss`` object and create two needed design variables, # ``w1`` and ``w2``. -project_name = pyaedt.generate_unique_project_name( - rootname=temp_dir.name, project_name="optimetrics" -) +# + +project_name = os.path.join(temp_dir.name, "optimetrics.aedt") + hfss = pyaedt.Hfss( project=project_name, version=AEDT_VERSION, new_desktop=True, - non_graphical=non_graphical, + non_graphical=NG_MODE, ) hfss["w1"] = "1mm" hfss["w2"] = "100mm" +# - # ## Create waveguide with sheets on it # @@ -146,8 +142,17 @@ # ## Release AEDT +hfss.save_project() hfss.release_desktop() +time.sleep( + 3 +) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. -# ## Clean temporary directory +# ## Cleanup +# +# All project files are saved in the folder ``temp_dir.name``. +# If you've run this example as a Jupyter notebook you +# can retrieve those project files. The following cell removes +# all temporary files, including the project folder. temp_dir.cleanup() diff --git a/examples/01-Modeling-Setup/Polyline_Primitives.py b/examples/01-Modeling-Setup/Polyline_Primitives.py index ae3571730..e547469cb 100644 --- a/examples/01-Modeling-Setup/Polyline_Primitives.py +++ b/examples/01-Modeling-Setup/Polyline_Primitives.py @@ -3,41 +3,37 @@ # This example shows how you can use PyAEDT to create and manipulate polylines. -# ## Perform required imports -# -# Perform required imports. +# ## Preparation +# Import the required packages import os import tempfile +import time + import pyaedt -# Set constant values +# Define constants AEDT_VERSION = "2024.1" +NG_MODE = False # Open Electronics UI when the application is launched. -# ## Set non-graphical mode -# Set non-graphical mode. -# You can set ``non_graphical`` either to ``True`` or ``False``. - -non_graphical = False - # ## Create temporary directory -temp_dir = tempfile.TemporaryDirectory(suffix="_ansys") +temp_dir = tempfile.TemporaryDirectory(suffix=".ansys") # ## Create Maxwell 3D object # # Create a `Maxwell3d` object and set the unit type to ``"mm"``. -project_name = pyaedt.generate_unique_project_name(rootname=temp_dir.name, project_name="polyline") +project_name = os.path.join(temp_dir.name, "polyline.aedt") maxwell = pyaedt.Maxwell3d( project=project_name, solution_type="Transient", design="test_polyline_3D", version=AEDT_VERSION, new_desktop=True, - non_graphical=non_graphical, + non_graphical=NG_MODE, ) maxwell.modeler.model_units = "mm" modeler = maxwell.modeler @@ -73,8 +69,7 @@ # segments. The supported segment types are ``Line``, ``Arc`` (3 points), # ``AngularArc`` (center-point + angle), and ``Spline``. -line1 = modeler.create_polyline(position_list=test_points[0:2], name="PL01_line") - +line1 = modeler.create_polyline(points=test_points[0:2], name="PL01_line") print("Created Polyline with name: {}".format(modeler.objects[line1.id].name)) print("Segment types : {}".format([s.type for s in line1.segment_types])) print("primitive id = {}".format(line1.id)) @@ -84,19 +79,24 @@ # Create an arc primitive. The parameter ``position_list`` must contain at # least three position values. The first three position values are used. -line2 = modeler.create_polyline(position_list=test_points[0:3], segment_type="Arc", name="PL02_arc") - -print("Created object with id {} and name {}.".format(line2.id, modeler.objects[line2.id].name)) +line2 = modeler.create_polyline( + points=test_points[0:3], segment_type="Arc", name="PL02_arc" +) +print( + "Created object with id {} and name {}.".format( + line2.id, modeler.objects[line2.id].name + ) +) # ## Create spline primitive # # Create a spline primitive. Defining the segment using a ``PolylineSegment`` # object allows you to provide additional input parameters for the spine, such -# as the number of points (in this case 4). The parameter ``position_list`` +# as the number of points (in this case 4). The parameter ``points`` # must contain at least four position values. line3 = modeler.create_polyline( - position_list=test_points, + points=test_points, segment_type=modeler.polyline_segment("Spline", num_points=4), name="PL03_spline_4pt", ) @@ -109,14 +109,16 @@ # plane of the active coordinate system. The starting point and the center point # must therefore have one coordinate value (X, Y, or Z) with the same value. # -# Here ``start-point`` and ``center-point`` have a common Z coordinate, ``"0mm"``. -# The curve is therefore rotated in the XY plane with Z = ``"0mm"``. +# Here ``start-point`` and ``center-point`` have a common Z position, ``"0mm"``. +# The curve therefore lies in the XY plane at $ z = 0 $. start_point = [100, 100, 0] center_point = [0, 0, 0] line4 = modeler.create_polyline( - position_list=[start_point], - segment_type=modeler.polyline_segment("AngularArc", arc_center=center_point, arc_angle="30deg"), + points=[start_point], + segment_type=modeler.polyline_segment( + "AngularArc", arc_center=center_point, arc_angle="30deg" + ), name="PL04_center_point_arc", ) @@ -128,14 +130,14 @@ start_point = [100, 0, 0] center_point = [0, 0, 0] line4_xy = modeler.create_polyline( - position_list=[start_point], + points=[start_point], segment_type=modeler.polyline_segment( "AngularArc", arc_center=center_point, arc_angle="30deg", arc_plane="XY" ), name="PL04_center_point_arc_rot_XY", ) line4_zx = modeler.create_polyline( - position_list=[start_point], + points=[start_point], segment_type=modeler.polyline_segment( "AngularArc", arc_center=center_point, arc_angle="30deg", arc_plane="ZX" ), @@ -144,36 +146,36 @@ # ## Compound polylines # -# You can use a list of points in a single command to create a multi-segment +# You can pass a list of points to the ``create_polyline()`` method to create a multi-segment # polyline. # -# By default, if no specification of the type of segments is given, all points -# are connected by line segments. +# If the type of segment is not specified, all points +# are connected by straight line segments. -line6 = modeler.create_polyline(position_list=test_points, name="PL06_segmented_compound_line") +line6 = modeler.create_polyline(points=test_points, name="PL06_segmented_compound_line") -# You can specify the segment type with the parameter ``segment_type``. -# In this case, you must specify that the four input points in ``position_list`` -# are to be connected as a line segment followed by a 3-point arc segment. +# You can specify the segment type as an optional named argument to +# define the segment type used to connect the points. line5 = modeler.create_polyline( - position_list=test_points, segment_type=["Line", "Arc"], name="PL05_compound_line_arc" + points=test_points, segment_type=["Line", "Arc"], name="PL05_compound_line_arc" ) -# The parameter ``close_surface`` ensures that the polyline starting point and -# ending point are the same. If necessary, you can add an additional line -# segment to achieve this. +# Setting the named argument ``close_surface=True`` ensures +# that the polyline starting point and +# ending point are the same. You can also explicitly close the +# polyline by setting the last point equal +# to the first point in the list of points. line7 = modeler.create_polyline( - position_list=test_points, close_surface=True, name="PL07_segmented_compound_line_closed" + points=test_points, close_surface=True, name="PL07_segmented_compound_line_closed" ) -# The parameter ``cover_surface=True`` also performs the modeler command -# ``cover_surface``. Note that specifying ``cover_surface=True`` automatically -# results in the polyline being closed. +# Setting the named argument ``cover_surface=True`` also +# covers the polyline and creates a sheet object. line_cover = modeler.create_polyline( - position_list=test_points, cover_surface=True, name="SPL01_segmented_compound_line" + points=test_points, cover_surface=True, name="SPL01_segmented_compound_line" ) # ## Compound lines @@ -189,13 +191,13 @@ # inserted after the first segment of the original polyline. line8_segment = modeler.create_polyline( - position_list=test_points, close_surface=True, name="PL08_segmented_compound_insert_segment" + points=test_points, + close_surface=True, + name="PL08_segmented_compound_insert_segment", ) - points_line8_segment = line8_segment.points[1] insert_point = ["-100mm", "20mm", "0mm"] - -line8_segment.insert_segment(position_list=[insert_point, points_line8_segment]) +line8_segment.insert_segment(points=[insert_point, points_line8_segment]) # ### Insert compound line with insert curve # @@ -204,8 +206,9 @@ # By numerical comparison of the starting point, it is determined automatically # that the segment is inserted after the first segment of the original polyline. +# + line8_segment_arc = modeler.create_polyline( - position_list=test_points, close_surface=False, name="PL08_segmented_compound_insert_arc" + points=test_points, close_surface=False, name="PL08_segmented_compound_insert_arc" ) start_point = line8_segment_arc.vertex_positions[1] @@ -213,8 +216,9 @@ insert_point2 = [40, 40, 0] line8_segment_arc.insert_segment( - position_list=[start_point, insert_point1, insert_point2], segment="Arc" + points=[start_point, insert_point1, insert_point2], segment="Arc" ) +# - # ## Insert compound line at end of a center-point arc # @@ -223,32 +227,32 @@ # # Step 1: Draw a center-point arc. +# + start_point = [2200.0, 0.0, 1200.0] arc_center_1 = [1400, 0, 800] arc_angle_1 = "43.47deg" line_arc = modeler.create_polyline( name="First_Arc", - position_list=[start_point], + points=[start_point], segment_type=modeler.polyline_segment( type="AngularArc", arc_angle=arc_angle_1, arc_center=arc_center_1 ), ) +# - # Step 2: Insert a line segment at the end of the arc with a specified end point. start_of_line_segment = line_arc.end_point end_of_line_segment = [3600, 200, 30] - -line_arc.insert_segment(position_list=[start_of_line_segment, end_of_line_segment]) +line_arc.insert_segment(points=[start_of_line_segment, end_of_line_segment]) # Step 3: Append a center-point arc segment to the line object. arc_angle_2 = "39.716deg" arc_center_2 = [3400, 200, 3800] - line_arc.insert_segment( - position_list=[end_of_line_segment], + points=[end_of_line_segment], segment=modeler.polyline_segment( type="AngularArc", arc_center=arc_center_2, arc_angle=arc_angle_2 ), @@ -258,11 +262,15 @@ # a single step. modeler.create_polyline( - position_list=[start_point, end_of_line_segment], + points=[start_point, end_of_line_segment], segment_type=[ - modeler.polyline_segment(type="AngularArc", arc_angle="43.47deg", arc_center=arc_center_1), + modeler.polyline_segment( + type="AngularArc", arc_angle="43.47deg", arc_center=arc_center_1 + ), modeler.polyline_segment(type="Line"), - modeler.polyline_segment(type="AngularArc", arc_angle=arc_angle_2, arc_center=arc_center_2), + modeler.polyline_segment( + type="AngularArc", arc_angle=arc_angle_2, arc_center=arc_center_2 + ), ], name="Compound_Polyline_One_Command", ) @@ -274,7 +282,7 @@ # the position list. line_three_points = modeler.create_polyline( - position_list=[ + points=[ [34.1004, 14.1248, 0], [27.646, 16.7984, 0], [24.9725, 10.3439, 0], @@ -284,7 +292,7 @@ cover_surface=True, close_surface=True, name="line_covered", - matname="vacuum", + material="vacuum", ) # Here is an example of a complex polyline where the number of points is @@ -307,14 +315,13 @@ line_segments = ["Line", "Arc", "Line", "Arc", "Line"] line_complex1 = modeler.create_polyline( - line_points, segment_type=line_segments, name="Polyline_example" + points=line_points, segment_type=line_segments, name="Polyline_example" ) # Here is an example that provides more points than the segment list requires. # This is valid usage. The remaining points are ignored. line_segments = ["Line", "Arc", "Line", "Arc"] - line_complex2 = modeler.create_polyline( line_points, segment_type=line_segments, name="Polyline_example2" ) @@ -323,16 +330,17 @@ # # Save the project. -project_dir = temp_dir.name -project_name = "Polylines" -project_file = os.path.join(project_dir, project_name + ".aedt") - -maxwell.save_project(project_file) - -# ## Release AEDT - +maxwell.save_project() maxwell.release_desktop() +time.sleep( + 3 +) # Allow Electronics Desktop to shut down before cleaning the temporary project folder. -# ## Clean temporary directory +# ## Cleanup +# +# All project files are saved in the folder ``temp_dir.name``. +# If you've run this example as a Jupyter notebook you +# can retrieve those project files. The following cell removes +# all temporary files, including the project folder. temp_dir.cleanup()