Icepak: setup from Sherlock inputs#

This example shows how you can create an Icepak project from Sherlock files (STEP and CSV) and an AEDB board.

Perform required imports#

Perform required imports and set paths.

import time
import os
import pyaedt
import datetime

# Set paths
project_folder = pyaedt.generate_unique_folder_name()
input_dir = pyaedt.downloads.download_sherlock()

Set non-graphical mode#

Set non-graphical mode. "PYAEDT_NON_GRAPHICAL" is needed to generate documentation only. You can set non_graphical value either to True or False.

non_graphical = os.getenv("PYAEDT_NON_GRAPHICAL", "False").lower() in ("true", "1", "t")

Define variables#

Define input variables. The following code creates all input variables that are needed to run this example.

material_name = "MaterialExport.csv"
component_properties = "TutorialBoardPartsList.csv"
component_step = "TutorialBoard.stp"
aedt_odb_project = "SherlockTutorial.aedt"
aedt_odb_design_name = "PCB"
stackup_thickness = 2.11836
outline_polygon_name = "poly_14188"

Launch AEDT#

Launch AEDT 2022 R2 in graphical mode.

Create Icepak project#

Create an Icepak project.

ipk = pyaedt.Icepak(project_name)

Delete region to speed up import#

Delete the region and disable autosave to speed up the import.

d.disable_autosave()
ipk.modeler.delete("Region")
component_name = "from_ODB"

Import PCB from AEDB file#

Import a PCB from an AEDB file.

odb_path = os.path.join(input_dir, aedt_odb_project)
ipk.create_pcb_from_3dlayout(component_name=component_name, project_name=odb_path, design_name=aedt_odb_design_name,
                             extenttype="Polygon", outlinepolygon=outline_polygon_name)
C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\icepak.py:2209: DeprecationWarning: ``extenttype`` was deprecated in 0.6.43. Use ``extent_type`` instead.
  warnings.warn(
C:\actions-runner\_work\PyAEDT\PyAEDT\pyaedt\icepak.py:2216: DeprecationWarning: ``outlinepolygon`` was deprecated in 0.6.43. Use ``outline_polygon`` instead.
  warnings.warn(

<pyaedt.modules.Boundary.NativeComponentObject object at 0x0000028B821C7E20>

Create offset coordinate system#

Create an offset coordinate system to match ODB++ with the Sherlock STEP file.

ipk.modeler.create_coordinate_system(origin=[0, 0, stackup_thickness / 2], mode="view", view="XY")
<pyaedt.modeler.cad.Modeler.CoordinateSystem object at 0x0000028B824736A0>

Import CAD file#

Import a CAD file.

ipk.modeler.import_3d_cad(file_path, refresh_all_ids=False)
True

Save CAD file#

Save the CAD file and refresh the properties from the parsing of the AEDT file.

ipk.save_project(refresh_obj_ids_after_save=True)
True

Plot model#

Plot the model.

ipk.plot(show=False, export_path=os.path.join(project_folder, "Sherlock_Example.jpg"), plot_air_objects=False)
Sherlock Example
<pyaedt.generic.plot.ModelPlotter object at 0x0000028B82473EE0>

Delete PCB objects#

Delete the PCB objects.

ipk.modeler.delete_objects_containing("pcb", False)
True

Create region#

Create an air region.

ipk.modeler.create_air_region(*[20, 20, 300, 20, 20, 300])
<pyaedt.modeler.cad.object3d.Object3d object at 0x0000028B829EF340>

Assign materials#

Assign materials from Sherlock file.

ipk.assignmaterial_from_sherlock_files(component_list, material_list)
True

Delete objects with no material assignments#

Delete objects with no materials assignments.

no_material_objs = ipk.modeler.get_objects_by_material("")
ipk.modeler.delete(no_material_objs)
ipk.save_project()
True

Assign power to component blocks#

Assign power to component blocks.

all_objects = ipk.modeler.object_names

Assign power blocks#

Assign power blocks from the Sherlock file.

total_power = ipk.assign_block_from_sherlock_file(csv_name=component_list)

Plot model#

Plot the model again now that materials are assigned.

ipk.plot(show=False, export_path=os.path.join(project_folder, "Sherlock_Example.jpg"), plot_air_objects=False)
Sherlock Example
<pyaedt.generic.plot.ModelPlotter object at 0x0000028B829EF610>

Set up boundaries#

Set up boundaries.

ipk.mesh.automatic_mesh_pcb(4)

setup1 = ipk.create_setup()
setup1.props["Solution Initialization - Y Velocity"] = "1m_per_sec"
setup1.props["Radiation Model"] = "Discrete Ordinates Model"
setup1.props["Include Gravity"] = True
setup1.props["Secondary Gradient"] = True
ipk.assign_openings(ipk.modeler.get_object_faces("Region"))
<pyaedt.modules.Boundary.BoundaryObject object at 0x0000028B831E9D90>

Check for intersections#

Check for intersections using validation and fix them by assigning priorities.

ipk.assign_priority_on_intersections()
True

Save project and release AEDT#

Save the project and release AEDT.

ipk.save_project()

end = time.time() - start
print("Elapsed time: {}".format(datetime.timedelta(seconds=end)))
print("Project Saved in {} ".format(ipk.project_file))
ipk.release_desktop()
Elapsed time: 0:00:49.144560
Project Saved in D:/Temp/pyaedt_prj_FJ3/TutorialBoard.aedt

True

Total running time of the script: ( 0 minutes 56.008 seconds)

Gallery generated by Sphinx-Gallery