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.
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…
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
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
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].
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 @jacob.small
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