Automatic pipe generation using Anemone loops

Hi there!

I’m working on a project involving generating blood vessels in a given region that’s already populated with some geometry to represent structures in the body. However, I’m running into issues with the data output of the Anemone loop. I was looking for advice as to the algorithm

Here’s what I’ve come up with so far:

First a bounding box is added around the combined meshes, and points are generated on each of the 6 faces. after that, using a randomizer, 2 points are selected to be the start and ending point of the pipe.

I then set up a series of parameters that I want each pipe to adhere to:
#1: they cannot intersect with the other meshes, as mentioned earlier
#2: 68% of the volume of this bounding box must be occupied by a solid (this will be taken care of by Galapagos).
#3: They cannot intersect each other, but still need to be decently erratic in their path. (These particular tubules are called ‘convoluted tubules’ and with good reason)

So, I used the loop solver to go pair by pair and generate a path from points generated between them.

However, I’ve run into a multitude of problems with this, data cleaning not the least of them. I’m looking for a method to generate more than one tubule at a time with this method, and sorting each result to the appropriate list is proving difficult.

I figured I should post something here about it to see if anyone had any advice I’ve attached my current grasshopper code, any help anyone can offer would be greatly appreciated:

Kidney tubule generation_upload_2.gh (5.5 MB)

Thanks in advance!

this might need to be internalized? I see a lot of meshes there

Yes, that’s correct. My mistake! I forgot to click the button before uploading, I’ll make the edits to the original post. Fair warning, the meshes are extremely large, so you will have to zoom out quite a ways to see them. Thanks again!