jimy-byerley / pymadcad

Simple yet powerful CAD (Computer Aided Design) library, written with Python.
https://madcad.netlify.app/
GNU Lesser General Public License v3.0
205 stars 15 forks source link

`chamfer` and `bevel` not accepted on wire extremities #56

Closed jimy-byerley closed 1 year ago

jimy-byerley commented 1 year ago

Currently, a bevel() works on any double-sided points of a Web and a Wire. However Wire's extremities might be considered double-sided points as well when Wire.closed = True and bevel() currently does not consider that.

from madcad import *

corner = 0   # index 0 in the wire is not accepted, nor -1,  any other place is fine

outline = regon(Axis(O,Z), 1, 5)
bevel(outline, [corner], ('width', 0.3))

show([ outline ])
Traceback (most recent call last):
  File "/tmp/test.py", line 4, in <module>
    bevel(outline, [0], ('width', 0.3))
  File "/usr/lib/python3.8/functools.py", line 875, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/home/jimy/.local/lib/python3.8/site-packages/madcad/cut.py", line 939, in wire_bevel
    cuts = set(wire_multicut(wire, points, cutter))
  File "/home/jimy/.local/lib/python3.8/site-packages/madcad/cut.py", line 890, in wire_multicut
    raise MeshError('a chamfer cannot have only one side')
madcad.mesh.container.MeshError: a chamfer cannot have only one side

with corner = 1 we get the expected behavior image