Icepack Setup from Sherlock Inputs

This example shows how to create an Icepak project starting from Sherlock # files (STEP and CSV) and an AEDB board.

import time
import os
import tempfile
import datetime

from pyaedt import examples, generate_unique_name

input_dir = examples.download_sherlock()
tmpfold = tempfile.gettempdir()


temp_folder = os.path.join(tmpfold, generate_unique_name("Example"))
if not os.path.exists(temp_folder):
    os.makedirs(temp_folder)
print(temp_folder)

Out:

C:\Users\ansys\AppData\Local\Temp\Example_N0TXGU

Input Variables

This example creates all input variables needed to run the 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"

Import PyAEDT and Launch AEDT

This example launches AEDT 2021.2 in graphical mode.

from pyaedt import Icepak
from pyaedt import Desktop

Launch AEDT in Non-Graphical Mode

You can change the Boolean parameter NonGraphical to False to launch AEDT in graphical mode.

Out:

Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
Launching AEDT installation C:\Program Files\AnsysEM\AnsysEM21.2\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info: Ansoft.ElectronicsDesktop.2021.2 Started with process ID 10780.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20220120_154608.log
pyaedt info: pyaedt v0.5.dev1
pyaedt info: Python version 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]

Create an Icepak Project

This command create an Icepak project

ipk = Icepak()

Out:

pyaedt info: Project Project2597 has been created.
pyaedt info: No design is present. Inserting a new design.
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded

Delete the Region to Improve Performance

This example remove the region and disables autosave to speed up the import.

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

Out:

pyaedt info: Deleted 1 Objects

Import a PCB from an AEDB File

This example imports a PCB from an AEDB file.

odb_path = os.path.join(input_dir, aedt_odb_project)
ipk.create_pcb_from_3dlayout(
    component_name, odb_path, aedt_odb_design_name, extenttype="Polygon", outlinepolygon=outline_polygon_name
)

Out:

pyaedt info: Closing the specified SherlockTutorial AEDT Project
pyaedt info: Project Closed Correctly
pyaedt info: PCB component correctly created in Icepak.

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

Create an Offset Ccoordinate System

This command create an offset coordinate system to match odb++ with the Sherlock STEP file.

ipk.modeler.create_coordinate_system([0, 0, stackup_thickness / 2], mode="view", view="XY")

Out:

<pyaedt.modeler.Modeler.CoordinateSystem object at 0x000001D0620CF700>

Import a CAD File

This command imports a CAD file.

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

Out:

pyaedt info: Step file C:\Users\ansys\AppData\Local\Temp\PyAEDTExamples\sherlock\TutorialBoard.stp imported

True

Save the CAD File

This command saves the CAD file and refreshes properties from AEDT file parsing.

ipk.save_project(project_name, refresh_obj_ids_after_save=True)

Out:

pyaedt info: Saving Project2597 Project
pyaedt.generic.LoadAEDTFile._read_aedt_file: 0.156338s
pyaedt info: AEDT Load time 0.32823610305786133

True

Plot the model

ipk.plot(show=False, export_path=os.path.join(temp_folder, "Sherlock_Example.jpg"), plot_air_objects=False)
Sherlock Example

Out:

<pyaedt.modules.AdvancedPostProcessing.ModelPlotter object at 0x000001D064168820>

Remove PCB Objects

This command removes the PCB objects.

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

Out:

pyaedt info: Deleted 1 Objects
pyaedt info: Deleted 1 objects

True

Create a Region

This command creates an air region.

ipk.modeler.create_air_region(*[20, 20, 300, 20, 20, 300])

Out:

<pyaedt.modeler.Object3d.Object3d object at 0x000001D0640E65B0>

Assign Materials

This command assigns materials from Sherlock files.

ipk.assignmaterial_from_sherlock_files(component_list, material_list)

Out:

pyaedt info: Adding new material to the Project Library: alumina
pyaedt info: Material has been added. Edit it to update in Desktop.
pyaedt info: Assign Material alumina to object ['COMP_R1', 'COMP_R2', 'COMP_R3', 'COMP_R4', 'COMP_R5', 'COMP_R6', 'COMP_R7', 'COMP_R8', 'COMP_R9', 'COMP_R10', 'COMP_R11', 'COMP_R12', 'COMP_R13', 'COMP_R14', 'COMP_R15', 'COMP_R16', 'COMP_R17', 'COMP_R18', 'COMP_R1...
pyaedt info: Assign Material aluminum to object ['COMP_C21', 'COMP_C22', 'COMP_C23', 'COMP_C24', 'COMP_C25', 'COMP_C26', 'COMP_C27', 'COMP_C28', 'COMP_C29', 'COMP_C30']
pyaedt info: Adding new material to the Project Library: bariumtitanate
pyaedt info: Material has been added. Edit it to update in Desktop.
pyaedt info: Assign Material bariumtitanate to object ['COMP_C11', 'COMP_C12', 'COMP_C13', 'COMP_C14', 'COMP_C15', 'COMP_C16', 'COMP_C17', 'COMP_C18', 'COMP_C19', 'COMP_C20']
pyaedt info: Assign Material copper to object ['COMP_J1']
pyaedt info: Adding new material to the Project Library: epoxyencapsulant
pyaedt info: Material has been added. Edit it to update in Desktop.
pyaedt info: Assign Material epoxyencapsulant to object ['COMP_Q1', 'COMP_Q2', 'COMP_Q3', 'COMP_Q4', 'COMP_Q5', 'COMP_Q6', 'COMP_Q7', 'COMP_Q8', 'COMP_Q9', 'COMP_Q10', 'COMP_Q11', 'COMP_Q12', 'COMP_Q13', 'COMP_Q14', 'COMP_Q15', 'COMP_Q16', 'COMP_U1', 'COMP_U2', '...
pyaedt info: Adding new material to the Project Library: laminate-bga
pyaedt info: Material has been added. Edit it to update in Desktop.
pyaedt info: Dataset Mass_Density_7BLUS3 doesn't exist.
pyaedt info: Dataset $Mass_Density_7BLUS3 created successfully.
pyaedt info: Dataset Youngs_Modulus_8JXY8D doesn't exist.
pyaedt info: Dataset $Youngs_Modulus_8JXY8D created successfully.
pyaedt info: Assign Material laminate-bga to object ['COMP_U9', 'COMP_U10']
pyaedt info: Assign Material tantalum to object ['COMP_C1', 'COMP_C2', 'COMP_C3', 'COMP_C4', 'COMP_C5', 'COMP_C6', 'COMP_C7', 'COMP_C8', 'COMP_C9', 'COMP_C10']

True

Delete Objects With No Material Assignments

This example deletes objects that have no materials assigned.

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

Out:

pyaedt warning: No objects to delete
No objects to delete
pyaedt info: Saving TutorialBoard Project

True

Assign Power to Component Blocks

This command assigns power to component blocks.

all_objects = ipk.modeler.primitives.object_names

Assign Power Blocks

This command assigns power blocks from the Sherlock file.

total_power = ipk.assign_block_from_sherlock_file(component_list)

Out:

pyaedt info: Block on ['COMP_R1'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R2'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R3'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R4'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R5'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R6'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R7'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R8'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R9'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R10'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R11'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R12'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R13'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R14'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R15'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R16'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R17'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R18'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_R19'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R20'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R21'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R22'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R23'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R24'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R25'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R26'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R27'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R28'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R29'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R30'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R31'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R32'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R33'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R34'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R35'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R36'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R37'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R38'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R39'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R40'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R41'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R42'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R43'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R44'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R45'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R46'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R47'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R48'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R49'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R50'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R51'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R52'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R53'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R54'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R55'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R56'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R57'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R58'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R59'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R60'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R61'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R62'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R63'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R64'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R65'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R66'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R67'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R68'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R69'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R70'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R71'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R72'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R73'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R74'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R75'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R76'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R77'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R78'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R79'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R80'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R81'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R82'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R83'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R84'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R85'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R86'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R87'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R88'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R89'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R90'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R91'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R92'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R93'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R94'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R95'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R96'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R97'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R98'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R99'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R100'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R101'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R102'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R103'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R104'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R105'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R106'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R107'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R108'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R109'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R110'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R111'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R112'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R113'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R114'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R115'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R116'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R117'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R118'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R119'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R120'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R121'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R122'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R123'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R124'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R125'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R126'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R127'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R128'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R129'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R130'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R131'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R132'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R133'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R134'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R135'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R136'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R137'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R138'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R139'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R140'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R141'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R142'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R143'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R144'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R145'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R146'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R147'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R148'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R149'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R150'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R151'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R152'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R153'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R154'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R155'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R156'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R157'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_R158'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_U9'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_U10'] with 1.0W Power, created correctly.
pyaedt info: Block on ['COMP_U11'] with 0.1W Power, created correctly.
pyaedt info: Block on ['COMP_U12'] with 0.1W Power, created correctly.
pyaedt info: Blocks inserted with total power 34.2000000000002W.

Plot the model

We do the same plot after the material assignment

ipk.plot(show=False, export_path=os.path.join(temp_folder, "Sherlock_Example.jpg"), plot_air_objects=False)
Sherlock Example

Out:

<pyaedt.modules.AdvancedPostProcessing.ModelPlotter object at 0x000001D052064F10>

Set Up Boundaries

This example sets 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
setup1.update()
ipk.assign_openings(ipk.modeler.primitives.get_object_faces("Region"))

Out:

pyaedt info: Face List boundary_faces created
pyaedt info: Opening Assigned

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001D0643F3850>

Check for Intersection

This command checks for intersection using validation and fixes it by assigning priorities.

ipk.assign_priority_on_intersections()

Out:

pyaedt info: Saving TutorialBoard Project

True

Save and Close the Project

This example saves and closes the project.

ipk.save_project()


end = time.time() - start
if os.name != "posix":
    ipk.release_desktop()
print("Elapsed time: {}".format(datetime.timedelta(seconds=end)))
print("Project Saved in {} ".format(temp_folder))

Out:

pyaedt info: Saving TutorialBoard Project
Elapsed time: 0:00:55.676304
Project Saved in C:\Users\ansys\AppData\Local\Temp\Example_N0TXGU

Total running time of the script: ( 1 minutes 2.190 seconds)

Gallery generated by Sphinx-Gallery