|
1 |
| -""" |
2 |
| -General: configuration files |
3 |
| ----------------------------- |
4 |
| -This example shows how you can use PyAEDT to export configuration files and re-use |
5 |
| -them to import in a new project. A configuration file is supported by these applications: |
6 |
| -
|
7 |
| -* HFSS |
8 |
| -* 2D Extractor and Q3D Extractor |
9 |
| -* Maxwell |
10 |
| -* Icepak (in AEDT) |
11 |
| -* Mechanical (in AEDT) |
12 |
| -
|
13 |
| -The following sections are covered: |
14 |
| -
|
15 |
| -* Variables |
16 |
| -* Mesh operations (except Icepak) |
17 |
| -* Setup and optimetrics |
18 |
| -* Material properties |
19 |
| -* Object properties |
20 |
| -* Boundaries and excitations |
21 |
| -
|
22 |
| -When a boundary is attached to a face, the tool tries to match it with a |
23 |
| -``FaceByPosition`` on the same object name on the target design. If, for |
24 |
| -any reason, this face position has changed or the object name in the target |
25 |
| -design has changed, the boundary fails to apply. |
26 |
| -""" |
| 1 | +# # General: configuration files |
| 2 | +# |
| 3 | +# This example shows how you can use PyAEDT to export configuration files and re-use |
| 4 | +# them to import in a new project. A configuration file is supported by these applications: |
| 5 | +# |
| 6 | +# * HFSS |
| 7 | +# * 2D Extractor and Q3D Extractor |
| 8 | +# * Maxwell |
| 9 | +# * Icepak (in AEDT) |
| 10 | +# * Mechanical (in AEDT) |
| 11 | +# |
| 12 | +# The following sections are covered: |
| 13 | +# |
| 14 | +# * Variables |
| 15 | +# * Mesh operations (except Icepak) |
| 16 | +# * Setup and optimetrics |
| 17 | +# * Material properties |
| 18 | +# * Object properties |
| 19 | +# * Boundaries and excitations |
| 20 | +# |
| 21 | +# When a boundary is attached to a face, the tool tries to match it with a |
| 22 | +# ``FaceByPosition`` on the same object name on the target design. If, for |
| 23 | +# any reason, this face position has changed or the object name in the target |
| 24 | +# design has changed, the boundary fails to apply. |
27 | 25 |
|
28 |
| -############################################################################### |
29 | 26 | # Perform required imports
|
30 | 27 | # ~~~~~~~~~~~~~~~~~~~~~~~~
|
31 | 28 | # Perform required imports from PyAEDT.
|
32 | 29 |
|
33 | 30 | import os
|
34 | 31 | import pyaedt
|
35 | 32 |
|
36 |
| -############################################################################### |
37 | 33 | # Set non-graphical mode
|
38 | 34 | # ~~~~~~~~~~~~~~~~~~~~~~
|
39 | 35 | # Set non-graphical mode.
|
40 | 36 | # You can set ``non_graphical`` either to ``True`` or ``False``.
|
41 | 37 |
|
42 | 38 | non_graphical = False
|
43 | 39 |
|
44 |
| -############################################################################### |
45 | 40 | # Open project
|
46 | 41 | # ~~~~~~~~~~~~
|
47 | 42 | # Download the project, open it, and save it to the temporary folder.
|
|
52 | 47 | new_desktop_session=True, non_graphical=non_graphical)
|
53 | 48 | ipk.autosave_disable()
|
54 | 49 |
|
55 |
| -############################################################################### |
56 |
| -# Create source blocks |
57 |
| -# ~~~~~~~~~~~~~~~~~~~~ |
| 50 | +# ## Create source blocks |
| 51 | +# |
58 | 52 | # Create a source block on the CPU and memories.
|
59 | 53 |
|
60 | 54 | ipk.create_source_block(object_name="CPU", input_power="25W")
|
61 | 55 | ipk.create_source_block(object_name=["MEMORY1", "MEMORY1_1"], input_power="5W")
|
62 | 56 |
|
63 |
| -############################################################################### |
64 |
| -# Assign boundaries |
65 |
| -# ~~~~~~~~~~~~~~~~~ |
| 57 | +# ## Assign boundaries |
| 58 | +# |
66 | 59 | # Assign the opening and grille.
|
67 | 60 |
|
68 | 61 | region = ipk.modeler["Region"]
|
69 | 62 | ipk.assign_openings(air_faces=region.bottom_face_x.id)
|
70 | 63 | ipk.assign_grille(air_faces=region.top_face_x.id, free_area_ratio=0.8)
|
71 | 64 |
|
72 |
| -############################################################################### |
73 |
| -# Create setup |
74 |
| -# ~~~~~~~~~~~~ |
| 65 | +# ## Create setup |
| 66 | +# |
75 | 67 | # Create the setup. Properties can be set up from the ``setup`` object
|
76 | 68 | # with getters and setters. They don't have to perfectly match the property
|
77 | 69 | # syntax.
|
|
83 | 75 | setup1["Solver Type Temperature"] = "flex"
|
84 | 76 | ipk.save_project(r"C:\temp\Graphic_card.aedt")
|
85 | 77 |
|
86 |
| -############################################################################### |
87 |
| -# Export project to step file |
88 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 78 | +# ## Export project to step file |
| 79 | +# |
89 | 80 | # Export the current project to the step file.
|
90 | 81 |
|
91 | 82 | filename = ipk.design_name
|
|
94 | 85 | removed_objects=[])
|
95 | 86 |
|
96 | 87 | ###############################################################################
|
97 |
| -# Export configuration files |
98 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 88 | +# ## Export configuration files |
| 89 | +# |
99 | 90 | # Export the configuration files. You can optionally disable the export and
|
100 | 91 | # import sections.
|
101 | 92 |
|
102 | 93 | conf_file = ipk.configurations.export_config()
|
103 | 94 | ipk.close_project()
|
104 | 95 |
|
105 |
| -############################################################################### |
106 |
| -# Create project |
107 |
| -# ~~~~~~~~~~~~~~ |
| 96 | +# ## Create project |
| 97 | +# |
108 | 98 | # Create an Icepak project and import the step.
|
109 | 99 |
|
110 | 100 | app = pyaedt.Icepak(projectname="new_proj_Ipk")
|
111 | 101 | app.modeler.import_3d_cad(file_path)
|
112 | 102 |
|
113 |
| -############################################################################### |
114 |
| -# Import and apply configuration file |
115 |
| -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 103 | +# ## Import and apply configuration file |
| 104 | +# |
116 | 105 | # Import and apply the configuration file. You can apply all or part of the
|
117 | 106 | # JSON file that you import using options in the ``configurations`` object.
|
118 | 107 |
|
119 | 108 | out = app.configurations.import_config(conf_file)
|
120 | 109 | app.configurations.results.global_import_success
|
121 | 110 |
|
122 |
| -############################################################################### |
123 |
| -# Close project |
124 |
| -# ~~~~~~~~~~~~~ |
| 111 | +# ## Close project |
| 112 | +# |
125 | 113 | # Close the project.
|
126 | 114 |
|
127 | 115 | app.release_desktop()
|
0 commit comments