Dynamo, Cleaning up T-Splines

Hi I’m trying to Create a workflow for a Tool i’ve been designing. Basically a point-and-click Revit Voronoi Shape Creator.

So the jist of the tool is to use the T-Splines feature in experimental mode to build pipes along the linework. The linework it self is an adaptation of Lynn Kims homemade Voronoi pattern creator. I’m quite new to T-Splines so I’m not sure of what a best practice solution might look like.

Steps i’ve taken:

  • select any surface in Revit
  • set parameters for the radius and quantity of nodes
  • create spheres that cut your surface
  • extract the linework
  • project onto the surface
  • use the node TSplineSurface.BuildPipes to get a smooth looking lattice.

Steps remaining:

  • clean up the geometry, I get overlapping surfaces and I have no idea how to best go about creating a union out of everything.
  • exporting the result to Revit.

I believe I have a lot of issues due to the fact that there are a lot of intersecting surfaces. My goal is to merge it together.

Is there a way to export the shape directly into Revit?

Below I have added the nodes and picture for reference.


I have identified 2 different ways to go about it, but I can’t quite manage to reach the desired result:

Option 1): cleaning up the linework before creating T-Splines:
The linework created is a multitude of curves that each intersect the next adjacent curve segment (see red and blue linework below)

I have a feeling that the TSplines BuildPipe will not work properly if I clean the linework before sending it to the BuildPipe node.

Option 2) Merging the shapes so that the intersecting parts gets cut and then glued together.
Here is where I get lost, because I have very little experience working with TSplines.

Edit: uploaded the original rvt and dyn-file:
Surface-TsplinePipes.dyn (62.1 KB)
Surface-TSplinePipes.rvt (2.0 MB)

have you tried to convert it to mesh, then use DirectShape.ToMesh ?

1 Like

Yes I have. What happens is that dynamo eats up a lot of memory and/or stops working. I might have set the parameters wrong, though. My initial line of thinking is that it is better to fix the geometry and convert to Brep is better, and way friendlier to the computer here? I prefer to keep the original geometry as much as possible. Converting to mesh is a last resort in my book.

When I try to convert to Brep I get the “IG_SURFACE_PARALLEL_SINGULARITY” error message, which seems to be fair.

Perhaps a Solid.ByUnion node will work here. Not sure though. Also it will take a bit to run. I recommend making some coffee. :slight_smile:

1 Like

Thank you Jacob!

I tried using a Solid.ByUnion node but it looks like it does not accept TSplineSurface as an input. I can show you where I am stuck, I think I managed to create one single TsplineSurface but I get called with the previous error code when trying to convert to BRep.

Converting the surface to a solid is not a bad idea though, I’m just not sure how to go about it when normal methods seem to fly out the window.

Ah. Didn’t realize you were still in surface land. Solid.ByJoinedSurfaces might do the trick.

1 Like

Normally that would seem like the way to go. But the node requires Geometry.Surface input, while I have Geometry.Tspline.TsplineSurface as my input.

Hmmm… let me dig on this and see where I get. Assuming you are in Revit 2021?

1 Like

Yes that is correct. I also posted the .dyn file for reference.

Can you post the RVT as well? Trying to rebuild but without knowing what your initial settings are is leading me on a goose chase.

I added the rvt-file to the original post as well, thank you.

1 Like

Thanks. Late here but I’ll check in on it tomorrow. :slight_smile:

1 Like

Seems like tweaking the T-Spline parameters a little should sort out the B-rep issue.
Though, in my example below, I’ve altered the Voronoi creation a little.

Surface-TsplinePipes.dyn (26.7 KB)


Thank you so much! Looks like creating B-Reps work majestically, albeit a bit slow (I only blame my self for throwing in thousands of control points there).

Although the code is a bit hard to follow, the changes makes sense.

Again. Thank you!

1 Like

Again, thank you for your help Vikram!
I have looked further into my options a bit, for obtaining a clean look and a smooth workflow.

Would you say that this is a better workflow:

  • import surface from revit
  • apply linework
  • export linework and surface to .tsm file
  • open tsm in fusion 360
  • run and clean up in f360
  • export to revit

I realised that I probably want at least 2-4 segments depending on curve length. (short segments probably only need 1 or two, while longer segments should have 3 or 4).

I also realised that when using dynamo for Revit, I will get a lot of intersecting surfaces that makes it near impossible to export importinstance directly.

1 Like

So I wanted to keep this thread updated for those interested in doing similar things:

Concerning the Geometries, I found some things of note:

  1. Creating a surface from each “loop” of curves and then joining it to a polysurface works really well. Especially since the surfaces share edges.
  2. Fusion360 is a lot easier to work with when creating complex T-Spline geometry. When the desired geometry is achieved you can easily import it back to Revit.
  3. I really really wish Revit had a decent implementation of working with T-Splines.


you are right! For converting from T-spline to B-reb,
we need to create the correct faces. It shouldn’t be intersected faces, and to do that, there are not too few segments for the pipe.

1 Like