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.

# sphinx_gallery_thumbnail_path = 'Resources/sherlock.png'

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_28H6OB

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.1 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.1\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info:: Ansoft.ElectronicsDesktop.2021.1 Started with process ID 10020.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20211026_143638.log
pyaedt info: pyaedt v0.4.0
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 Project6077 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 0x000001CD1C452D90>

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 0x000001CD1C452C40>

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 Project6077 Project
pyaedt.generic.LoadAEDTFile._read_aedt_file: 0.15623599999999999s
pyaedt info: AEDT Load time 0.328108549118042

True

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 0x000001CD1D59F040>

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_R19,COMP_R20,COMP_R21,COMP_R22,COMP_R23,COMP_R24,COMP_R25,...
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,COMP_U3,COMP_U4,COMP_U5,COMP_U6,COMP_U7,COMP_U8,COMP_U11...
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_H67EQW doesn't exist.
pyaedt info: Dataset $Mass_Density_H67EQW created successfully.
pyaedt info: Dataset Youngs_Modulus_3LT6YO doesn't exist.
pyaedt info: Dataset $Youngs_Modulus_3LT6YO 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.

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 0x000001CD1CBC36D0>

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.close_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:34.524904
Project Saved in C:\Users\ansys\AppData\Local\Temp\Example_28H6OB

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

Gallery generated by Sphinx-Gallery