Sweep profile along complex 2D/3D polylines


I am looking to sweep a circular profile along 3D polylines with a large number of vertices, I thought I would try performing this task using simple polylines to start with. Using the below script I can easily sweep a profile along a polyline with 2D vertices, as soon as I introduce a small amount of complexity as shown in the second image Dynamo fails to sweep along the full length of the path or goes into a never ending computation process. Any help would be appreciated.

I have tried using the Coordinate System at Parameter code to ensure the circular profile is perpendicular with the start vertices however I get the same geometry result.

I think we need a bit more information. How is the polyline constructed? Is it just 3d-model lines, or is it a dwg-import. (You could also import dwg-files to get polylines, FYI.)

I am not generally scripting this type of geometry in Revit, but I would assume there are some sort of MEP-functions which should also accomplish this. Is the shape just a pipe?

Anyways, this is what I cam up with:

Thank you for your reply, this is all within Civil 3D/AutoCAD so I am selecting a native 2D polyline element in the example shown in order to sweep a circular profile. My goal is to use a 3D polyline. From your script it appears we are using similar methods but getting different results.

Here is a suggestion:

1 Like

Hi @Clive_Owen,

As you said, the performance of the sweep nodes in Dynamo is not good in this situation. You could try creating circles at the start and ends of each segment and then creating the solid by loft (lofting seems to perform better than sweeping), but it may not look good at the angle points. What I’ve typically done in the situation that you are describing is to break the polyline down into its individual segments and then sweep solids along those. It breaks up the computation into smaller, more manageable chunks. However, the downside is that the angle points won’t be “cleaned up” like you would get with a single continuous sweep. That sacrifice of detail has been worth it for me in order to reap the performance benefits.

Thank you for clarifying this limitation @mzjensen, I was hoping the script would eliminate the need for manually creating profiles and sweeping them within AutoCAD however the loss of detail would be an issue for me. I will try using the loft function with guides as an alternative.

Hi @Clive_Owen ,

Maybe you can split your polyline into “single lines” and then try to find the correct plane which is exactly the half of each line, if you understand what i mean.

Then you can use the solid.byloft node to get nice ends and quick results.

Hi @Daan ,

Thanks for the suggestion, I have just tried this and Dynamo doesn’t want to loft with the sort of geometry shown below, I tried with guide curves and received the same error. The surface loft produced something but it was way off the expected result.

Hi @Clive_Owen i meant something like this:

  1. Split each line
  2. Create a plane on the start/endpoint of each line in such a way that the plane is half the “angle” for each line.
  3. Create a loft from each individual line (green, blue and purple in snippet).
  4. Join them together to get 1 final solid.

What result do you want to have? Solid smoothed or non-smoothed?


@Daan @Ge0rges again thank you for coming back to me, the smoother option would be most preferable as that outcome closer matches an AutoCAD sweep solid

Use NurbsCurve.ByPoints

1 Like