it might be an idea to have a preliminary calculation of
total curve length / distance
This could then (instead of doing the code in for spline in (curve.splines): )
self.report("are you loco?", type_of_report)
if the that value exceeds a sane limit, maybe 1000, or some user defined maximum count of objects ( bpy.props.IntProperty(name"max_count", min=1, max=1000 )
I didn’t found a Addon with a Warning props dialog (O.K or CANCEL, YES or NO).
It seems that it only exists in C ++ (when you close Blender without saving)
However I learned many things and fix any problems that could present in my addon. For example:
Works for curves with splines in open and closed loops;
Works correctly on transformations in curve (translate, rotate, scale)
Prevents copies over 3000 objects (would take about 5 seconds, but avoids many copies);
Inform amount of duplicates;
Here a blender file to test these features.
Thank you for everything
It’s not supported, if you want to dismiss such a dialog, you’ll have to move the mouse away. Consider renaming the OK button to “Continue”. You may also display the expected amount of objects in the panel itself. Keep in mind though, that the calculation for such a display label can cause some overhead.
Your addon is incredible @mifth. I looked at the screens and read the description of the problem but not yet understood what is the “UpVec”. The cross product of the global axis x over y would not result in the z axis?
The issue is pretty complex for me. i tried many things. fit to curve is not so simple.
i also tried the fit method from your script and i could not get right result too.
could you test the tool to get it deeper?
The script is extensive, and I am not a professional developer.
But I can help with math.
One way to obtain the orthogonal vector closest to the axis z is:
z_axis = Vector((0,0,1))
b_point_dir = #vector of the curve direction
pzv = z_axis.project(b_point_dir)
b_point_up = (z_axis-pzv).normalized()