Hi all,
In another topic that I wrote (Difference between results (Python and Dictionaries)), I asked about some issues in a python node for a script that I’m developing.
My goal is to get the green curves from the geometry below (elevation):
Also the inputs are described in the image.
So, the algorithm I came with is as follows:
Jus for clarification: I managed to create a unitary coordinate r because the points in space have 3 coordinates (X,Y,Z), so now, no matter the direction the element was created, I now which curve is before the other.
-
I projected the StartPoint and EndPoint of the curves 1,2,3 and 4 into the plane where curve 0 is. So I split curve 0 by points. I get the segments of the curves 1-4 at the bottom.
Also, I translate the curves using Vector.Zaxis().Reverse() and the z value from the input list, for every curve 1-4. Now I have curves 1-4 projected where curve 0 is. -
With every element in the same position, I start the loop for every projected line. The first iteration is checking the curve 1 projected with every segment and if it is the same curve, store the remainig segments in an “AUX” list and exclude the repeated one. <<<<< Here I have curves to create Curves A and B in the future (translate and join the first two).
-
Next iteration, the program has to know that curve 1 already exists, so when I exclude curve 2 and 3, curve 1 was already gone. So, in the 2° iteration I get only the curve C as my result and this is the end of the story.
I’m struggling with the algorith for a couple of days now and I think I need a second opinion. I’m sure there is a better solution (simplier I hope). The condition for this to work is that (I think), my algorithm also works for the case below:
Hope I explained enough the issue. Any suggestion will be well received.
Thanks in advance for your time!