sherlock.layer.add_modeling_region(my_project, modeling_regions)
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\aklara\AppData\Local\Programs\Python\Python310\lib\site-packages\ansys\sherlock\core\layer.py", line 1093, in add_modeling_region
rectangular_shape.centerX = shape.centerX
AttributeError: 'RectangularShape' object has no attribute 'centerX'. Did you mean: 'center_x'?
Using layer_types.py, the PolygonalShape, SlotShape, or CircularShape are defined using center_x and center_y but you can see that in layer.py line 1093 you can see it expects centerX and centerY so you get an error defining these shapes.
π Steps to reproduce
Try using add_modeling_region to add any PolygonalShape, SlotShape, or CircularShape modeling regions. Here is the code used to reproduce the issue:
U9_x = 0.0 # X-Coordinate in mm.
U9_y = 19.05 # Y-Coordinate in mm.
U9_package_length = 27.0 #Package Length in mm.
U9_package_width = 27.0 #Package Width in mm.
tolerance = 2.0 # Dimension Tolerance in mm.
For slot and circular shapes, the code was using nodeCount instead of node_count.
Modified Layer.add_modeling_region() to use node_count, center_x, and center_y.
π Before submitting the issue
π Description of the bug
Using layer_types.py, the PolygonalShape, SlotShape, or CircularShape are defined using center_x and center_y but you can see that in layer.py line 1093 you can see it expects centerX and centerY so you get an error defining these shapes.
π Steps to reproduce
Try using add_modeling_region to add any PolygonalShape, SlotShape, or CircularShape modeling regions. Here is the code used to reproduce the issue:
sherlock = launch_sherlock()
my_project = "PySherlock_Tutorial_Add_Potting" my_cca = "Main Board"
try: sherlock.project.delete_project(my_project) except: print("The specified project does not exist. Proceed normally.")
sherlock.project.import_odb_archive( "C:\WB_INSTALL\v251\sherlock\tutorial\ODB++ Tutorial.tgz", True, True, True, True, project=my_project, cca_name=my_cca )
Dimensions in mm.
U9_x = 0.0 # X-Coordinate in mm. U9_y = 19.05 # Y-Coordinate in mm. U9_package_length = 27.0 #Package Length in mm. U9_package_width = 27.0 #Package Width in mm. tolerance = 2.0 # Dimension Tolerance in mm.
x_min = U9_x - (U9_package_width/2) - tolerance x_max = U9_x + (U9_package_width/2) + tolerance y_min = U9_y - (U9_package_length/2) - tolerance y_max = U9_y + (U9_package_length/2) + tolerance
polygonal_shape = PolygonalShape(points=[(0, 0),(0, 6.35),(9.77, 0)], rotation=87.8) rectangular_shape = RectangularShape(length=U9_package_length, width=U9_package_width, center_x=U9_x, center_y=U9_y, rotation=0.0) slot_shape = SlotShape(length=5.0, width=5.0,node_count=6,center_x=U9_x, center_y=U9_y, rotation=0.0) circular_shape = CircularShape(diameter=5.0,node_count=4,center_x=0.0,center_y=0.0, rotation=30.0) # #
Add Modeling Region
#
modeling_regions = [ { "cca_name": my_cca, "region_id": "Region001", "region_units": "mm", "model_mode": "Enabled", "shape": rectangular_shape, "pcb_model_props": { "export_model_type": "Sherlock", "elem_order": "First_Order", "max_mesh_size": 0.5, "max_mesh_size_units": "mm", "quads_preferred": True }, "trace_model_props": { "trace_model_type": "Enabled", "elem_order": "Second_Order", "trace_mesh_size": 0.3, "trace_mesh_size_units": "mm" } } ]
sherlock.layer.add_modeling_region(my_project, modeling_regions)
π» Which operating system are you using?
Windows
π Which ANSYS version are you using?
INFO: Version 2025 R1 (25.1b20241002), build 20241002.1
π Which Python version are you using?
3.10
π¦ Installed packages