Python code + Generative Design = Output *

I’m developing stadium seating using Dynamo and Generative Design. I have encountered a problem in that my Python code in a node that is giving me an output of * (no value). I started to debug it using a simple OUT_debug output to see which node caused the error. I’ve found that the node script below is giving me no output. Is this a limitation with Revit 2021 Generative Design? The node script is not complex nor is it using any special libraries. This node is part of a larger script flow, but it seems to be the one that is causing a problem as I’m debugging.

  • Select a Revit Detail Line and convert to poly curve
  • IN are doubles and int for setting the distance.
  • OUT is the array of offset, original curve, and debug
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Selected Revit detail line converted (Polycurve)
curve = IN[0]
# Seating offset T (double)
offset = IN[1]
# Row offset (int)
D = IN[2]
# Eye offset from rear (double)
T = IN[3]
# Row offset X value (int)
x = IN[4]
# Top of riser Y value (int)
y = IN[5]
# size of field (int)
fieldSize = IN[6] / 2
# focal distance (double)
F = IN[7]

#debug output
OUT_debug = 555

# inital point at edge of field
pt = Point.ByCoordinates(x[0] + fieldSize, y[0], 0)
# distance from point to loft curve
distance = Geometry.DistanceTo(pt, curve)

OUT_offsetCurves = [] 

# offset curves to create seating
for i in offset:
	curveEdge = i - F + distance
	seatCurve = curveEdge + (D - T)
	x = Curve.Offset(curve, seatCurve)
	OUT_offsetCurves.append(x)
	
# Original focus curve
OUT_focusCurve = Curve.Offset(curve, -F)

OUT = OUT_offsetCurves, OUT_focusCurve, OUT_debug

Below is an image of the debug output. I would assume that this would have the give 555, but if the node is not compiling it will give a null result. I also assume that is the node is giving a null it also will not generate any geometry.

If you have any information on what might be causing this any help would be much appreciated.

Kindest Regards,
Danny Bentley

Do you have a remember node to serialize the geometry dat from Revit into the graph? You can test if this is the issue by looking. At the graph in Dynamo Sandbox instead of Dynamo for Revit.

Hi Jacob,

It worked. I had forgotten to add the remember node. I have added the link to the documenation incase someone else runs into the same issue.

Kindest Regards,
Danny Bentley

1 Like