Skip to content

Commit

Permalink
fix center line to support Arc Height (#3323)
Browse files Browse the repository at this point in the history
* fix center line to support Arc Height

* fix obounding_box method in 3D Layout

---------

Co-authored-by: maxcapodi78 <Shark78>
  • Loading branch information
maxcapodi78 authored Jul 26, 2023
1 parent 4267f4e commit d3ed2be
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 18 deletions.
1 change: 1 addition & 0 deletions _unittest/test_40_3dlayout_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def test_02a_get_geometries(self):
assert poly.top_edge_x == 2
assert poly.top_edge_y == 3
assert poly.placement_layer == "1_Top"
assert poly.obounding_box
poly.placement_layer = "16_Bottom"
assert poly.placement_layer == "16_Bottom"
poly.placement_layer = "1_Top"
Expand Down
18 changes: 13 additions & 5 deletions pyaedt/modeler/modelerpcb.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,24 @@ def primitives(self):
warn(mess, DeprecationWarning)
return self._primitives

@property
def obounding_box(self):
"""Bounding box.
@pyaedt_function_handler
def obounding_box(self, object_name):
"""Bounding box of a specified object.
Returns
-------
list
List of [LLx, LLy, URx, URy] coordinates.
References
----------
>>> oEditor.GetModelBoundingBox
>>> oEditor.GetBBox
"""
return self.oeditor.GetModelBoundingBox()
bb = self.oeditor.GetBBox(object_name)
pll = bb.BBoxLL()
pur = bb.BBoxUR()
return [pll.GetX(), pll.GetY(), pur.GetX(), pur.GetY()]

@pyaedt_function_handler()
def _arg_with_dim(self, value, units=None):
Expand Down
31 changes: 28 additions & 3 deletions pyaedt/modeler/pcb/object3dlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,22 @@ def __init__(self, primitives, name, prim_type="poly", is_void=False):
self.is_void = is_void
self._name = name

@property
def obounding_box(self):
"""Bounding box of a specified object.
Returns
-------
list
List of [LLx, LLy, URx, URy] coordinates.
References
----------
>>> oEditor.GetBBox
"""
return self._primitives.obounding_box(self.name)

@property
def name(self):
"""Name of Primitive."""
Expand Down Expand Up @@ -1458,14 +1474,18 @@ def length(self):

@property
def center_line(self):
"""Get the center line points.
"""Get the center line points and arc height.
Returns
-------
dict
Points.
"""
props = [i for i in list(self._oeditor.GetProperties("BaseElementTab", self.name)) if i.startswith("Pt")]
props = [
i
for i in list(self._oeditor.GetProperties("BaseElementTab", self.name))
if i.startswith("Pt") or i.startswith("ArcHeight")
]
self._center_line = {}
for i in props:
self._center_line[i] = [
Expand All @@ -1477,7 +1497,12 @@ def center_line(self):
def center_line(self, points):
u = self._primitives.model_units
for point_name, value in points.items():
vpoint = ["NAME:{}".format(point_name), "X:=", _dim_arg(value[0], u), "Y:=", _dim_arg(value[1], u)]
if len(value) == 2:
vpoint = ["NAME:{}".format(point_name), "X:=", _dim_arg(value[0], u), "Y:=", _dim_arg(value[1], u)]
elif isinstance(value, list):
vpoint = ["NAME:{}".format(point_name), "Value:=", _dim_arg(value[0], u)]
else:
vpoint = ["NAME:{}".format(point_name), "Value:=", _dim_arg(value, u)]
self.change_property(vpoint)
self._center_line = {}

Expand Down
10 changes: 0 additions & 10 deletions pyaedt/modeler/schematic.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,6 @@ def oeditor(self):
>>> oEditor = oDesign.SetActiveEditor("SchematicEditor")"""
return self._app.oeditor

@property
def obounding_box(self):
"""Bounding box.
References
----------
>>> oEditor.GetModelBoundingBox()"""
return self.oeditor.GetModelBoundingBox()

@pyaedt_function_handler()
def zoom_to_fit(self):
"""Zoom To Fit.
Expand Down

0 comments on commit d3ed2be

Please sign in to comment.