Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offset_2d on a closed wire fails with Side.RIGHT or Side.LEFT #739

Open
WayneSherman opened this issue Oct 16, 2024 · 0 comments
Open

offset_2d on a closed wire fails with Side.RIGHT or Side.LEFT #739

WayneSherman opened this issue Oct 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@WayneSherman
Copy link

WayneSherman commented Oct 16, 2024

Tested with build123d version 0.7.1 and 0.6.0

Offsetting an open polyline works as expected:

# Offsetting an open polyline works as expected
poly_line = Polyline((0,0),(10,0),(10,8),(0,8))             # ok
offset_line = poly_line.offset_2d(0.25,side=Side.BOTH)
offset_line = poly_line.offset_2d(0.25,side=Side.LEFT)
offset_line = poly_line.offset_2d(0.25,side=Side.RIGHT)

Offsetting a closed polyline raise an exception with Side.LEFT or Side.RIGHT

poly_line = Polyline((0,0),(10,0),(10,8),(0,8),(0,0))       # a closed wire fails with LEFT and RIGHT
#poly_line = Polyline((0,0),(10,0),(10,8),(0,8),close=True) # a closed wire fails with LEFT and RIGHT
offset_line = poly_line.offset_2d(0.25,side=Side.BOTH)      # works
offset_line = poly_line.offset_2d(0.25,side=Side.LEFT)      # fails
offset_line = poly_line.offset_2d(0.25,side=Side.RIGHT)     # fails

Error message:

Traceback (most recent call last):
  File "/home/test/build123d_dev/CAD_drawing_work/offset_closed_wire_bug.py", line 6, in <module>
    offset_line = poly_line.offset_2d(0.25,Kind.INTERSECTION,Side.LEFT)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/test/build123d_dev/lib/python3.12/site-packages/build123d/topology.py", line 877, in offset_2d
    centers = [w.position_at(0.5) for w in wires]
               ^^^^^^^^^^^^^^^^^^
  File "/home/test/build123d_dev/lib/python3.12/site-packages/build123d/topology.py", line 680, in position_at
    curve = self._geom_adaptor()
            ^^^^^^^^^^^^^^^^^^^^
  File "/home/test/build123d_dev/lib/python3.12/site-packages/build123d/topology.py", line 7799, in _geom_adaptor
    return BRepAdaptor_CompCurve(self.wrapped)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. OCP.BRepAdaptor.BRepAdaptor_CompCurve()
    2. OCP.BRepAdaptor.BRepAdaptor_CompCurve(W: OCP.TopoDS.TopoDS_Wire, KnotByCurvilinearAbcissa: bool = False)
    3. OCP.BRepAdaptor.BRepAdaptor_CompCurve(W: OCP.TopoDS.TopoDS_Wire, KnotByCurvilinearAbcissa: bool, First: float, Last: float, Tol: float)

Invoked with: None
@gumyr gumyr added the bug Something isn't working label Oct 22, 2024
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants