Toposolid points

Hello everyone,
I’ve been trying to extract topopoints, but since revit2024 is using toposolids now, dynamo (or atleast for myself) is not recognizing the toposolid as a topography to use with topopoints.
What is your solution.
Also, since toposolids are not sliced ( as previously in toposurfaces), and are subregioned, is it possible to extract points of that exact subregion of the toposolid.
Thanks

1 Like

It seems the dynamo node only accepts old style topography - I would use a little bit of Python.

2 Likes

For the Subdivisons, you need a bit more.

import clr

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc =  DocumentManager.Instance.CurrentDBDocument

topo=IN[0]
output = []

profile = doc.GetElement(UnwrapElement(topo).SketchId).Profile

for obj in profile[0]:
    output.append(obj.ToProtoType())
    
OUT = output

But somebody probably made a package to do this already I suppose :wink:
TopoSubDivision.dyn (4.8 KB)

3 Likes

I haven’t seen much of package to do basic function as for the former topography, nor an OOTB package from Dynamo.

I wish that Dynamo kept up with Revit changes, as this complicated deployment on machines of users with basic knowledge of Dynamo

1 Like

Slab shape editor can get the points.

import clr

# Add references to Revit and Dynamo libraries
clr.AddReference("RevitServices")
clr.AddReference("RevitAPI")
clr.AddReference("RevitNodes")
clr.AddReference("ProtoGeometry")

# Import namespaces for Revit
from RevitServices.Persistence import DocumentManager
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *  # For Toposolid and Slab Shape Editor
from Autodesk.DesignScript.Geometry import Point  # For Dynamo points

# Custom function to convert Revit XYZ to Dynamo Point
def XYZToDynamoPoint(xyz):
    return Point.ByCoordinates(xyz.X, xyz.Y, xyz.Z)

# Access the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Get the Toposolid input from Dynamo (connected to IN[0])
toposolid = UnwrapElement(IN[0])  # Unwrap Dynamo element to Revit element

# Initialize an empty list to store the extracted points
toposolid_points = []

# Check if the input is a valid Toposolid
if isinstance(toposolid, Toposolid):
    # Get the Slab Shape Editor for the Toposolid
    slab_shape_editor = toposolid.GetSlabShapeEditor()
    
    if slab_shape_editor:
        # Get all control points (SlabShapeVertex) using SlabShapeVertices
        slab_shape_vertices = slab_shape_editor.SlabShapeVertices
        
        # Extract the position of each vertex and convert it to Dynamo Points
        for vertex in slab_shape_vertices:
            position = vertex.Position  # Get the XYZ position
            toposolid_points.append(XYZToDynamoPoint(position))  # Convert to Dynamo Point

# Output the list of points (or an empty list if no points are found)
OUT = toposolid_points

Honestly Revit can barely keep up with Revit these days as is.

Can’t even get a release date for 2025 Issues addin and 2026 is around the corner…

Python is definitely a necessary middle ground to access newer API or get around the Revit version tied Dynamo issues/limitations that pop up from time to time, given they don’t always fast track revit updates for the sake of Dynamo (at least, it seems).

2 Likes

Hi Vanman,
Please can you help me to write a similar script for Adding Points to existing Toposolid.

Look up topoalign. Good addin. Might solve it for ya quick

But can get help if needed. I just get AI to write stuff I need to do these days.

If yoy want to learn, this is the method to get the editor which manages the points:

This is the way to add points to it:

1 Like

It works but something with units is wrong.

Here units are fixed:

import clr

# Add references to Revit and Dynamo libraries
clr.AddReference("RevitServices")
clr.AddReference("RevitAPI")
clr.AddReference("RevitNodes")
clr.AddReference("ProtoGeometry")

# Import namespaces for Revit
from RevitServices.Persistence import DocumentManager
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *  # For Toposolid and Slab Shape Editor
from Autodesk.DesignScript.Geometry import Point  # For Dynamo points

# Custom function to convert Revit XYZ to Dynamo Point
def XYZToDynamoPoint(xyz, conversion_factor):
    return Point.ByCoordinates(xyz.X * conversion_factor, xyz.Y * conversion_factor, xyz.Z * conversion_factor)

# Access the current Revit document
doc = DocumentManager.Instance.CurrentDBDocument

# Get the Toposolid input from Dynamo (connected to IN[0])
toposolid = UnwrapElement(IN[0])  # Unwrap Dynamo element to Revit element

# Initialize an empty list to store the extracted points
toposolid_points = []

# Get the internal units ID for length
intUnitsId = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()

# Conversion factor from Revit internal units (feet) to the current project units
conversion_factor = UnitUtils.ConvertFromInternalUnits(1, intUnitsId)

# Check if the input is a valid Toposolid
if isinstance(toposolid, Toposolid):
    # Get the Slab Shape Editor for the Toposolid
    slab_shape_editor = toposolid.GetSlabShapeEditor()
    
    if slab_shape_editor:
        # Get all control points (SlabShapeVertex) using SlabShapeVertices
        slab_shape_vertices = slab_shape_editor.SlabShapeVertices
        
        # Extract the position of each vertex and convert it to Dynamo Points
        for vertex in slab_shape_vertices:
            position = vertex.Position  # Get the XYZ position
            toposolid_points.append(XYZToDynamoPoint(position, conversion_factor))  # Convert to Dynamo Point

# Output the list of points (or an empty list if no points are found)
OUT = toposolid_points
1 Like