How cut Split Geometry with multiples Curves

Hello again, thank you all very much for your help.

As I progress, more questions arise in the code and I return to the nodes, although once I clean it I will try to pass everything to code.

My problem is the following. I have a surface that I want to divide into small segments, for this I am leaning on the grids, however when I use split geometry, it does not give me the result, so it will most likely be resolved in code, that is why I ask of your help to know how you would have to implement it to achieve this goal.

This is the current result

How I want to cut the surface for Example

Here share the Dynamo Script if anybody can help me I really appreciate so much your help.
G-Structural-Grid-Forum-08.dyn (41.6 KB)

Hi @Luiscko !
I add a script of mine at the end of yours
It works but it needs to be improved because if there is too much splitting lines it takes long time to run and it is memory consuming, given it is based on combination nodes…



surface_split.dyn (85.3 KB)

1 Like

Yes understand this is the reason that I am asking about using code, because with the nodes for that simple splitting we need a lot of memory, thank @Francois_Labonne

This should do the trick to split a surface with lines recursively quickly, for your use case at least. :wink:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Convert an instance/list to a list
def tolist(obj1):
	if hasattr(obj1,"__iter__"): return obj1
	else: return [obj1]# Convert an instance/list to a list

# Split surface  recusively
def Splitter(Surface,cutters):
	output= []
	for i in cutters:
		srf = Geometry.Split(Surface , i)
		#picking the second surface to split
		if len(srf)>1:
			output.append(srf[0]) 
			Surface = srf[1]
			if i == cutters [-1]:
				output.append(srf[1])
	return output

splits = []
geom = []

geom.append(tolist(IN[0]))

# Loop cutters over geometry, cutting the remainder each time, and adding the new cut to the results until all cutters are used
for p in IN[1]:
	g = geom[-1]
	s = Splitter(g[0],tolist(p))
	splits.append(s[1])
	geom.append(s)
	
splits.append(geom[-1][0])

OUT = splits
1 Like

Why go recursive? Extruding the curves to create surfaces will allow you to then join the many surfaces into one polysurface. There are some good examples of doing this at scale in the AU session I gave with Alexandra Nelson of Perkins Eastman - specifically the 2nd and 3rd examples (finding the optimal location for the Quidditch World Cup stadium and the layout of the Care of Magical Creatures OWL). Note that these are not necessarily optimized, but I found them faster than a recursive split. Split is a complex operation, and doing it N *N times is [complex operation squared], vs [one simple operation n times + one simple operation n times + 1 or two complex operations].

2 Likes

I try to put your code and understand better, to learn more about it, but I don’t know why is not working if I put the same information that you.

Thank you very much for your help @Ewan_Opie I really apreciate so much,

This is one of my lectures that are in my watch list but, I haven’t time to watch it, so now that you recommend me I am watching out, thank you very much @JacobSmall

@Luiscko
Here is a way to do it in DesignScript


surface_split_DesignScript.dyn (102.1 KB)

5 Likes

It works for one surface, but if we put several surfaces, does not work propertly, so I find this node for springnodes that do the job, Thank you very much for your solution @Francois_Labonne

1 Like