-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Feature Request
As a developer using COMPAS core geometry workflows, I want OCCBrep.from_extrusion
to accept COMPAS core curves (e.g., Polyline
, Line
, or Curve
) so that I can integrate OCC BREP modeling into existing COMPAS-based geometry pipelines without manually converting curves into OCC-specific types.
Details
Is your feature request related to a problem? Please describe.
Yes. The OCCBrep.from_extrusion
function currently requires an OCCBrepEdge
as input, which in turn expects a curve in the OCC-specific format (e.g., from OCCCurve
). However, OCCCurve
does not directly accept core COMPAS curves like Polyline
, and passing a list of COMPAS Point
objects results in an argument mismatch in the BRepBuilderAPI_MakeEdge
constructor.
example:
from compas.geometry import Vector
from compas_occ.brep import OCCBrep, OCCBrepEdge
from compas_occ.geometry import OCCCurve
curve = OCCCurve(floor_edge.points) # floor_edge.points is a list of compas.geometry.Point
brep_edge = OCCBrepEdge.from_curve(curve) # ❌ This fails with argument type error
brep_extrusion = OCCBrep.from_extrusion(brep_edge, Vector(0, 0, floor_to_floor_height))
Error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\Users\wangy\.local\share\mamba\envs\cea_compas\lib\site-packages\compas_occ\brep\brepedge.py", line 548, in from_curve
builder = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(curve.occ_curve)
File "c:\Users\wangy\.local\share\mamba\envs\cea_compas\lib\site-packages\OCC\Core\BRepBuilderAPI.py", line 2094, in __init__
_BRepBuilderAPI.BRepBuilderAPI_MakeEdge_swiginit(self, _BRepBuilderAPI.new_BRepBuilderAPI_MakeEdge(*args))
TypeError: Wrong number or type of arguments for overloaded function 'new_BRepBuilderAPI_MakeEdge'.
Describe the solution you'd like
Allow OCCBrep.from_extrusion
to accept COMPAS core curves (e.g., Polyline, Line, Curve, etc.) directly and internally handle their conversion to valid OCC curves for BREP construction.
Alternatively, provide a convenience function or automatic casting within OCCBrepEdge.from_curve
or OCCCurve
to handle COMPAS core geometries robustly.
Describe alternatives you've considered
- Manually converting COMPAS core geometry into OCC-compatible geometry (e.g., writing custom functions to create OCCCurve manually) is cumbersome and error-prone.
- Wrapping extrusion logic with intermediate OCC objects, but this breaks abstraction and compatibility between core COMPAS and compas_occ.