I’ve got a script I’m wondering if someone can take a look at to figure out why it might be acting odd. I know it’s a pain trying to figure out someone else’s code but I’ve been banging my head against the wall on this for quite a while.
I’m working on a tool for “rationalizing” freeform curves for pipe bending. Vaguely like “Convert” except that I feed it a library of curve specs from an Excel file since with pipe bending you want to use as few different bends as possible. I have the basic fitting working and am now dealing with persistence and tweaking the result. Anyway, that’s the background.
So the Rhino file has a magenta freeform ‘source’ curve and a set of curves that were the result of a run of the rationalization script. If you run the file “LoadSavedTubes_001.py”, it sets up the event handling so that I can edit the source curve and have the output readjusted to fit. It doesn’t totally regenerate it since that can take hours to evaluate all the possibilities, it just moves the arcs to follow the new curve as best it can.
If you try to run it and get an error about Office something, just comment out that import it’s not needed.
The specific issue I need help with is, after running the load script I can move the source curve around and the output follows, great…the weird thing is you will notice if you nudge it around the
output will wiggle and move. Of course the event handling should be smarter to know if the curve was simply moved and not ‘regenerate’ from scratch, but nonetheless it shouldn’t do that. I suppose it’s possible the problem is the result of quantum-scale rounding differences adding
up to sending the curve sections shooting off into space, but it doesn’t really look like it. It seems to act wonkiest when the curve is moved around the origin and seems to ‘settle down’ in one state as it’s moved further away, which might imply I’m doing something dumb not accounting
for coordinates being positive vs negative, but the math is all vectors and transforms(which frankly I’m not so great at.) It appears to give the same (correct or not) result if I drag the curve to a location vs nudging, so that would maybe argue against the problem being that it’s
using data from the previous state of the curve. If there’s anything anyone can see to help me zero in on the issue that would be great.
LoadSavedTubes_001.py (212 Bytes)
FittedCurves_0002.py (32.8 KB)
curve fitting test.3dm (218.7 KB)