I have not actually forgotten this thread. In fact, I’ve been working on and off on it for the last few days. It’s not all that hard if you limit the input cases to polylines with 90° corners, but if you wish to generalize to polycurves and non 90° corners it gets trickier. So in the end, the code got more complicated… Quite complicated in fact, it’s a bit “hacky”, and I used a lot of RhinoCommon in it as well, so it’s not an easy example to follow, sorry. Finding the inside corners is the relatively easy part.
I started off trying to do some geometrical calculations for the corners and finally gave up because it’s too hard to predict when the curves coming into the corner are curved and not straight, or if segments are very short relative to the corner “notch”. Finally I just decided to create a subtractor shape and copy/orient it around to the inside corners then curve boolean difference each from the main curve. I also decided to orient the notches along the corner bisector - which makes it easier to figure out. For 90° corners, that means they will be at 45° to the corner.
There will be failure cases with unusual shapes, I built in some adaptive code to try to take care of a few, but others will always fail. The script marks (usually) where it can’t put in a corner. anyway, it’s a WIP, but I’ll toss it out here just in case (use at your own risk ). Only works with closed planar curves in planes parallel to the Top CPlane (they do not have to lie on the plane though).
CornerNotcher.py (9.2 KB)