Jump to content
Developer Wiki and Function Reference Links ×

Narrowing Down/Grouping and Sorting Objects Based on Multiple Criteria


Recommended Posts

Hello, Forums!


I got some incredible help on here last week, and the direction I was given has allowed me to fix up a number of the networks I was stuck on building! I’m now running up against something I haven’t specifically done before, and I’m stuck again. I don't need a complete network built, but if someone could point me to the nodes/general logic on how this would be built, it would be awesome!


In earlier parts of a larger network, the following geometry was made (I did the coloring after the fact to explain better - It’s usually just all black lines). In each green circle, there is a point where line objects go out from, and they run an intersection with other lines in the drawing. This intersection provides the locus points you see scattered about. I am then using those locus points to draw the lines I want to work with.




I am getting extra lines (black in the above image - I only want the red lines) that make perfect sense based on how it works… The issue is that I have no idea how to remove them successfully.


Here is the workflow in my mind:

1. Determine the Start Point of Each Line (Start Points are found inside the green circles).

2. Somehow group the lines so it understands the lines starting at that point are “grouped” or to be compared further.

3. Take that group of lines and compare line rotations and further group the lines based on line rotations.

4. Only keep the shortest line segment in each direction from each start point.

I'll attach a 2022 copy of the base geometry shown if its helpful, but again, I really just want some direction on how the above would work in marionette and then I kinda want to figure it out myself 🙂 


Edited by ASag
Link to comment



for this problem i would recommend solving it with a few lines of Python code inside of a Marionette node.

Another thing i would consider is to try to solve this right when the intersection points are created.


However if i had to solve this in Marionette i would do it like this (but i hope someone else has a simpler approch and i am just blind to it):


  1. If needed rewrite your data so that you can sort it.
    • For example i got the start points of all the lines and rounded each x and y component, to account for imperfections that sometimes occure. Than i put the cooridnates back together in a tuple. Now you can create a list of indices or numbers, where same points get the same number, by removing the duplicates and then getting the index that each point has in this list where you removed the duplicates. I think this last step might not be necessary for sorting, but it also helps us later on so we dont have to check for equality of points.
    • Also i converted the angle vectors of the lines into angles and also rounded them (to the 6th digit).
    • As data i used the handle of the lines, length, angle and the start point
  2. Write your data as a list of nested tuples. Cou can create tuples by using the "Point 2D" node. As an Example this is one item from this list written in python syntax:
    • (number of start point, (angle, (length, handle)))
    • (0,  (-135.0, (69.59001315942132, E3DB3460)))
  3. When you sort your data list now it will be sorted all the way down through all the nested tuples like this:
    • The lines will be sorted by the number of its start point
      • The lines with the same start point will be sorted by their angle
        • The lines with the same angle will be sorted by their length
          • Each line has its handle, so you can identify the line object later on
  4. Now you can get your data back with the "Flatten List" node and two "Every Other" node, where one is set to even and the other is set to odd. (There might be a better way to do that)
  5. The next step is to pick the right items of the lists with the handles. Here is my logic behind it:
    • We know that the very first item of the list has to be a correct line
    • We know that we want every item of the list right when the number of the start points changes
    • We know that we want every item of the list right when the angle of the line changes
  6. This can be done by comparing the values of the lists (numbers of start point and angle) to a rotated version of itselfe.
    • Rotate list by -1
    • Pop front of the list and the rotated list
    • Check for equality of the remaining lists
    • Append the result to a list with one "False" item in it ("Any" node with [False] written into it via the OIP)
    • (The first "False" value is because we know that the very first item of the list is a correct item)
  7. Use the "and" node on the two lists you just created under point 6.
  8. Filter the list with the handles in it you created with point 4.
  9. Take the False items of the "Filter" node.


And here is a .vwx (v22) file with this solution (you dont have to use it, if you realy want to solve this by yourself).

BaseGeometryExample v2022.vwx




  • Like 1
Link to comment

@Letti R - You are the MVP! You are the one who replied to my other topic last week! Thank you so much again for this reply. I'm going to dig into it more today to understand what you did here. It is incredible that you are able to make the solution this fast! I was stuck on this for 20+ hours...

As a Marionette newbie, I am proud that I almost got the same thought process through step 3, but then I had no idea how to use it. Attached is an example network I had built yesterday that was somewhat close to your first few steps. I built this same thing using Zip, Unzip, etc. nodes too trying to sort out how to do it. haha



Once again, thank you so much!

Link to comment



thank you for your kind words @ASag .



[...] to make the solution this fast!

It took me arround 3h to get to that solution. I would not consider that being fast. Also i had to try different things that did not work, i think i had to start over 3 times.


I just realized that the steps to the solution you pointed out in your first post were pretty much spot on.





  • Like 2
Link to comment
  • 4 months later...

great stuff, i have a "similar" problem with sorting lists.


I need to duplicate all 3D-shapes/subtraction etc. with a database record in a specific DB on a seperate layer. (This is working.)


Now i need to remove the db record for all parts having the same database entry in field name "Name".


I want to make a "on button metal parts viewport with datastamps" in a specific layout layer and deleting all existing objects on this layer

if i can data stamp the objects automatically (with the marionette) and there are duplicates (objects with the same db record entry "name"), it wont working so i think its necessary to remove the db record/connection for the "same datbaserecorded parts".


but with the given nodes i dont get a solution as a marionette newb ^^.


idea 1:  find the objects where the "name" is the same and remove the record entry of all "except the 1. foudn ", or search the spreadsheet ->but wtf how?


idea 2: sort the list filtered object by the name of its parts and then remove the db-connection of all objects, with the same name as the object "before" in the list. But how to do this, i can sort the list of the databasefield entrys for its names but they dont reference then to find the ocjects in the criteria-list?



Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...