Geometry.SplitByTools failing


I’m using the Ampersand package by @colin.mccrone with Revit 2020 and Dynamo 2.3. I’m noticing that some of the nodes keep failing. They run once, but then if a change is made (say in Revit), they don’t work again. I’m aware that Python nodes need to be retriggered but even disconnecting and reconnecting the node doesn’t seem work. Restarting Revit sometimes works.

The node, in particular, I’m having issues with is the Geometry.SplitByTools.

Extracting the Python code from within reveals an error:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. 
Traceback (most recent call last):
  File "<string>", line 33, in <module>

What does this mean? Line 33 is: newPieces.append(Flatten2D(Geometry.Split(piece,tool)))

# Colin McCrone
# Twitter:
# LinkedIn:
# Updated:  2016-05-15
import clr
from Autodesk.DesignScript.Geometry import *

def Flatten2D(ls):
	flat = []	
	for x in ls:
		if type(x) is list:
			for y in x:
	return flat

# Main function
geom = IN[0]
tools = IN[1]

pieces = []

for tool in tools:
	assert type(tool) is not list
	newPieces = []
	for piece in pieces:
		assert type(piece) is not list
	pieces = Flatten2D(newPieces)

OUT = pieces

I see that Springs (@Dimitar_Venkov) has a ‘Geometry.SplitRecursively’ node. But for geometry like this, how would you define the ‘pick point’ input?


Based on what it looks like you’re after…

This may be of interest:

if you’re being more ‘artful’ in the placement of the UV grids, I recommend making a single polysurface from the U and V grid lines, and splitting into Rows and then cells accordingly. This reduces the number of geometry interactions from n to 2. Even though there is a SIGNIFICANTLY complex data set in the polysurface intersection, the many operations is usually slower in Dynamo). Doing it in two sets helps keep the data in a structured result which can helpful for many applications.

If you’re not after cells and just want to divide up the surface and order isn’t a concern, then a single polysurface of all lines will usually work, but you can get some geometry errors depending on what you’re creating.

Thanks Jacob. But for various reasons, neither of those options will work in this scenario.

It is not a simple UV subdivisions. And a polysurface can’t be created as the graph is split into two (setout lines in part 1, subdivision in part 2).

Any other thoughts?

Can you post data set so I can recreate the creation of the lines and surfaces? If not, maybe place a Remember node (via Generative Design or Refinery package) to record the geometry data into the graph for first the lines, and then another Remember node for the surface, save the graph, delete everything up to the remember nodes, save again, ensure there is data in the nodes, and post that.

If you get it to me before I finish my evening AU work I’ll see what I can come up with tonight. :slight_smile:

From the error message, it looks like it’s failing because it expects a single geometry and you’re feeding it a list with one surface. If I’m not mistaken, that package hasn’t been updated in a while. The node was probably not set up with ranked inputs because they were added later.

Regarding using Geometry.SplitRecursively, you’ll need to first split the surface in one direction and then split the resulting pieces in the other direction. Usually using the bounding box max point is good enough for the pick point input

I’m not sure what is happening here. There appears to be a bug with Dynamo somewhere. The file is repeatedly crashing. I though it was the recursively splitting node but now I’m getting this error:

Warning: PolyCurve.ByJoinedCurves operation failed. 
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

@Dimitar_Venkov I couldn’t get your node to work. Separated out the tools into x and y elements. Got one direction to work but not the other. End up finding the ‘Intersection.GeometrySplit’ node in Lunchbox. But if I move one of the setout lines in Revit, it crashes. Not sure if this is Dynamo or that particular node.

@JacobSmall I’ve attached the files. Revit 2020 and Dynamo 2.3.

Demo.rvt (1.3 MB) Create Base Surface_Error.dyn (29.5 KB)

If you also look at this video, you can see that it works fine in Revit 2021 and Dynamo 2.6. Crashes in Revit 2020 and Dynamo 2.3.

After separating the cutting lines by direction, you’ll also need to sort them by their cutting order. I like to use the bounding box’s min point for the order and the max point for the “direction” (the pickpoint):

Sometimes, when the geometry is simple and there aren’t a lot of cuts, I try extruding the cutting lines into surfaces, joining them into a polysurface and using that as the split tool in “Geometry.Split”, but in this particular case that approach fails…

1 Like

Are you splitting the U and V simultaneously or in sequence? I may have time to look into this later today.

Thanks Dimitar. The sorting them by their cutting order is the part I missed. I’ll give this a try.

Interesting I had also tried extruding the surfaces and joining them into one polysurface. But alas, this also failed. When do you think this would work?


I’ve discovered that the Lunchbox ‘Intersection.GeometrySplit’ node crashes if a ‘tool’ is aligned with the surface boundary. I guess in this scenario when it tries to split the geometry, instead of receiving a surface to continue the recursive subdivision, it receives a line and can’t process that.

1 Like