Coordinates of resolution points of a Bezier Curve

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 )

Hahahaha XD
I’ll try. I just need to think about how to calculate the total length of the curve. Or something like that. :slight_smile:

Here it is :). But I will not leave so. Would Needing a confirmation “Yes or No”.
And I don’t know how to do this.


you could invoke a props dialog, search for addons that use


    def invoke(self, context, event):
        wm = context.window_manager
        return wm.invoke_props_dialog(self, width=250)

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

Attachments

post script final.blend (1 MB)

OK. I decided to put a Warning props_dialog. And it works perfectly :).


But I always want to do more and more (noob’s thing).

And the question now is: How to show a progress in a Panel?


(I think it’s time for a new Tread)

Attachments

arranjar_em_curva_v4.zip (2.05 KB)

More and more is fine; no new thread, please!

The one slight change I might suggest is that,
for a warning message in English,
Arranje Objetos ==> Arrange Objects :smiley:

Hahaha XD okay

New question. Why the Cancel Operator does not work? I spent a lot of time trying to figure out.


Attachments

post script final.blend (922 KB)

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.

@CoDEmanX, I got a hack, it worked :). I will show

EDIT:

Attachments

arranjar_em_curva_v6.zip (2.47 KB)

1 Like

Great addon. Thanks!

You’re welcome @mifth :smiley:

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()

To understand better the code here is an image.

Thank you a lot! Your formula almost work ok!
The only problem:
if z_axis = b_point_dir?
if z_axis = -b_point_dir?

How you would solve it?

The solution should then relate to the dot product.
Tests with this script and checks if the “dot” is negative or positive.


z_axis = Vector((0,0,1))
b_point_dir = #vector of the curve direction

dot = z_axis.dot(b_point_dir)

pvz = dot*b_point_dir
b_point_up = (z_axis-pzv).normalized()

Hello.

Your formula works almost ok. But it still makes artifacts on some angles.

Here is Your approach to test:

Here is my approach with cross vecs:

Cross vecs make less artifacts yet.

Also, I found another interesting thing. The same dirction can have different upVecs. Here is the example:

Anyway it sems i fixed the issue. Anyway thank you a lot!

Hum interesting. Good to know it was fixed. :slight_smile: