Generative Design for Revit 2023 Output * = No Value

Hi All, I’m having issues with the below dynamo script in Generative Design for Revit 2023. I get No Value as my outputs and I suspect a node essentially isn’t be allowed to run for one reason or another, which might be due to the usage of the Revit API. Reference material below. Appreciate any assistance!


Mimimum Spanning Tree_WYDC.dyn (223.7 KB)

What is in the Python script below the ‘total weight’ output?

Do the samples run for you?

And errors on your generative design log file?

Hi Jacob, samples run for me and I can’t see anything in the refinery-server-log.txt.1 file. Below is my python code:

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

# Input: points (List of Point objects from Dynamo), weights (List of weights corresponding to the points)
# Output: MSTEdges (List of Line objects representing MST edges)

def find(parent, i):
    """Find the root of the set to which element i belongs."""
    if parent[i] == i:
        return i
    return find(parent, parent[i])

def union(parent, rank, x, y):
    """Perform union of two sets x and y based on rank."""
    xroot = find(parent, x)
    yroot = find(parent, y)

    if rank[xroot] < rank[yroot]:
        parent[xroot] = yroot
    elif rank[xroot] > rank[yroot]:
        parent[yroot] = xroot
    else:
        parent[yroot] = xroot
        rank[xroot] += 1

def compute_mst(points, weights):
    """Compute the Minimum Spanning Tree (MST) using Kruskal's algorithm with point weights."""
    edges = []
    num_points = len(points)

    # Create all possible edges and calculate their weighted distances
    for i in range(num_points):
        for j in range(i + 1, num_points):
            distance = points[i].DistanceTo(points[j])
            weighted_distance = distance * (weights[i] + weights[j]) / 2
            edges.append((weighted_distance, i, j))

    # Sort edges by weighted distance
    edges.sort(key=lambda x: x[0])

    # Initialize parent and rank arrays for union-find
    parent = list(range(num_points))
    rank = [0] * num_points

    mst_edges = []

    # Process edges in ascending order of weighted distance
    for edge in edges:
        weight, u, v = edge
        uroot = find(parent, u)
        vroot = find(parent, v)

        # If including this edge doesn't form a cycle
        if uroot != vroot:
            mst_edges.append((u, v))
            union(parent, rank, uroot, vroot)

    return mst_edges

# Main script execution
points = IN[0]  # Input: List of Dynamo Point objects
weights = IN[1]  # Input: List of weights corresponding to the points

# Debug: Check input validity
if not points:
    OUT = "Error: No points provided."
elif not weights:
    OUT = "Error: No weights provided."
elif len(points) != len(weights):
    OUT = f"Error: Points and weights count mismatch. Points: {len(points)}, Weights: {len(weights)}"
elif len(points) < 2:
    OUT = "Error: At least two points are required to compute an MST."
else:
    try:
        # Compute MST
        mst_indices = compute_mst(points, weights)

        # Create Line objects for MST edges
        mst_edges = [Line.ByStartPointEndPoint(points[u], points[v]) for u, v in mst_indices]

        OUT = mst_edges  # Output: List of Line objects
    except Exception as e:
        OUT = f"Error during MST computation: {str(e)}"

Found this in the log files actually: 2025-01-30 13:07:47,879 INFO Loading Refinery API schemas…
2025-01-30 13:07:47,962 WARNING The swagger_ui directory could not be found.
Please install connexion with extra install: pip install connexion[swagger-ui]
or provide the path to your local installation by passing swagger_path=

2025-01-30 13:07:47,963 WARNING The swagger_ui directory could not be found.
Please install connexion with extra install: pip install connexion[swagger-ui]
or provide the path to your local installation by passing swagger_path=


I tested the script on DynamoSandbox and it ran fine, but the Data.Remember nodes added an input and an output for some reason and then I saved it and got the above result now … some progress I suppose
both are running 2.16.2 …

Conflicting package or extension.

My next guess is that it is over the memory limit, which I believe is 750 MB. When you run it in sandbox does the RAM consumed by Dynamo exceed 750mb? And when running in GD do any of the Dynamo instances exceed 750mb?

If you open one of the designs which fails do you get output?

Okay, assume I have to uninstall packages till it works?

It’s sitting at 940mb without running it.

I can’t open one of the designs because the geometry is not showing.

If I recall cap for 2023 to 2025 is 750mb… instead of the model you’re currently using, try a simpler dataset - say 20 pipes with no elevation change instead of what you have now. If that works then we can confirm it’s a memory issue and a shift to a more effective processing method can be sought out.

Thanks Jacob for your assistance - I have done so and now get the below error … thoughts?

Restart the CPU and see if that fixes it. If not comment out sections until you get a handle on which line is out of wack. Also double check to see what data types you have for inputs now vs before.

Thanks Jacob, it’s working now. Not sure exactly what the solution was here but for reference:

  • Restarted PC
  • Reduced/simplified script
  • Removed all packages then only installed those required for this script