Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Krande committed Nov 22, 2024
1 parent dea8fa4 commit 62979b5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
21 changes: 9 additions & 12 deletions src/ada/api/curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
from ada.core.curve_utils import (
build_polycurve,
calc_2darc_start_end_from_lines_radius,
calc_arc_radius_center_from_3points,
segments3d_from_points3d,
segments_to_indexed_lists,
transform_2d_arc_segment_to_3d,
)
from ada.core.vector_transforms import local_2_global_points
from ada.core.vector_transforms import local_2_global_points, global_2_local_nodes
from ada.core.vector_utils import is_clockwise
from ada.geom.placement import Direction
from ada.geom.points import Point
from ada.geom.surfaces import ArbitraryProfileDef, ProfileType

if TYPE_CHECKING:
from OCC.Core.TopoDS import TopoDS_Edge
from OCC.Core.TopoDS import TopoDS_Edge, TopoDS_Wire

from ada import Beam
from ada.geom.curves import ArcLine, Edge, IndexedPolyCurve
Expand All @@ -44,11 +45,7 @@ def __init__(

if self._point_on is not None:
from ada.core.constants import O, X, Y, Z
from ada.core.curve_utils import calc_arc_radius_center_from_3points
from ada.core.vector_utils import (
global_2_local_nodes,
local_2_global_points,
)


p1, p2 = self.p1, self.p2

Expand Down Expand Up @@ -224,14 +221,14 @@ def normal(self) -> Direction:
return self.orientation.zdir

@property
def xdir(self):
def xdir(self) -> Direction:
return self.orientation.xdir

@property
def ydir(self):
def ydir(self) -> Direction:
return self.orientation.ydir

def edges(self):
def occ_edges(self) -> list[TopoDS_Edge]:
from ada.occ.utils import segments_to_edges

return segments_to_edges(self.segments3d)
Expand All @@ -257,10 +254,10 @@ def curve_geom(self, use_3d_segments=False) -> IndexedPolyCurve | Edge | ArcLine

return IndexedPolyCurve(segments)

def wire(self):
def occ_wire(self) -> TopoDS_Wire:
from ada.occ.utils import make_wire

return make_wire(self.edges())
return make_wire(self.occ_edges())

@property
def seg_index(self):
Expand Down
2 changes: 1 addition & 1 deletion src/ada/api/plates/base_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def bbox(self) -> BoundingBox:
return self._bbox

def line_occ(self):
return self._poly.wire()
return self._poly.occ_wire()

def shell_occ(self):
from ada.occ.geom import geom_to_occ_geom
Expand Down
5 changes: 4 additions & 1 deletion src/ada/occ/tessellating.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,17 @@ def iter_ifc_store(self, ifc_store: IfcStore) -> Iterable[MeshStore]:
settings = ifcopenshell.geom.settings()
settings.set(settings.USE_PYTHON_OPENCASCADE, False)

cpus = 2
cpus = 1
iterator = ifcopenshell.geom.iterator(settings, ifc_store.f, cpus)

iterator.initialize()
while True:
shape = iterator.get()
if shape:
if hasattr(shape, "geometry"):
product = ifc_store.f.by_id(shape.id)
if product.is_a("IfcOpeningElement"):
continue
geom = shape.geometry
mat_id = self._extract_ifc_product_color(ifc_store, ifc_store.f.by_id(shape.id))
yield MeshStore(
Expand Down
2 changes: 1 addition & 1 deletion tests/core/api/curves/test_curve_poly.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ def test_sweep_curve():
sweep_curve = [(1, 1, 0), (5, 5.0, 0.0, 1), (10, 1, 0)]
curve = CurveOpen2d.from_3d_points(sweep_curve)
my_renderer = x3dom_renderer.X3DomRenderer()
my_renderer.DisplayShape(curve.wire(), export_edges=True)
my_renderer.DisplayShape(curve.occ_wire(), export_edges=True)
# my_renderer.render()

0 comments on commit 62979b5

Please sign in to comment.