Perforated surface script error

Dear all,

I have followed a tutorial (https://www.youtube.com/watch?v=Ih70TE85o48) to create a script for a perforated surface but I got an error which I have not been able to solve.
The error is: “solution execption: index was out of range. Must be non-negative and less than the size of the collection”.

I would really appreciate it if someone could help me.

Kind regads,
Helena

perforated metal.gh (11.7 KB)

Your Srf is not internalized.

P.S. Using a PlaneSrf instead, I found a missing wire from SubSet ‘L’ output to Srf CP ‘P’ input.

perforated

The Scale NU after that doesn’t make much sense?

Dear Mr. Oster,

I have internalized the surface.
However I still get the same error…
Do you understand the reason for the index being out of range?

Kind regards

I don’t see the error so maybe it’s your surface? If you post the updated model, I’ll have another look.

By the way, it will be easier to see what your model is doing if you disable previews on some components.

This is my model and the script!
Thank you very much!

building.3dm (2.5 MB) perforated metal.gh (37.7 KB)

You have a list of eleven surfaces. Nothing but nulls are coming out of Split Tree, and you are flattening its output which surely can’t be correct.

P.S. You have two different Srf params that apparently refer to many of the same surfaces, but not all? Wny two?

You should use your splitting masks like this. IMO, not sure you follow the right tutorial, anyway the rest is up to you.


perforated metal_re.gh (53.2 KB)
And you should be careful about the datatree further downstream…

perforated metal_reV2.gh (32.9 KB)

PS: IMO, your surfaces don’t have a uniform square patch of UV grids, so following your reference tutorial will be difficult to get the results you want.

It seems better to create the UV curves of your surfaces on the XYplane, and apply circle packing algo or some sort… and map them back to the original surface.

The left-most Srf param should probably be grafted and PShift (Shift Paths) is needed after SDivide to preserve the same data tree path structure. You can’t arbitrarily flatten inputs and outputs without understanding data trees.

Even so, three of eleven paths (surfaces) have zero length after Jitter, which probably causes the “Index out of range” error in SubSet.

Actually, the empty paths happen earlier in the code… after Clean Tree. Replacing your Split Tree with the one from @HS_Kim and moving the PShift I added after Clean Tree seems to fix the “Index out of range” error.

Srf CP then hangs miserably, probably due to the un-grafted and mismatched Srf param? Using the original param that I grafted allows the model to complete without error or hanging.

The circle radius was insanely small, I had to increase it from 0.25 to ~64 (256%) just to see them!

It looks like there is a duplicate or overlapping surface in the first Srf param so I tried the second one instead (Srf2). I disabled Scale NU and other parts after that because they don’t make sense.

perforated metal_2021Jan16a.gh (34.0 KB)

This was way beyond your understanding of data trees.

Math error. 256 times larger radius (64 / 0.25). Isn’t that 25,600% larger? Why were they so small?