Solid.BySweep operation failed. Profile Curve must be closed

Hello, everyone!
I am creating a profile for a barrier fence in Dynamo for Civil 3D 2026.2.
And I get an error: Solid.BySweep operation failed.
Profile Curve must be closed.
Please help me figure out what I am doing wrong.

Create guardrial poles.dyn (31.2 KB)

Hi you only have one curve in the profile

You have to close your PolyCurve using the true boolean after the list of points

You can get contextual tip as well
image

2 Likes

Try using the PolyCurve.ByPoints method which has the Boolean input for ‘closed’, setting it to ‘true’.

1 Like

Thank you for your reply.

I added true. But I still get an error. And the curve length is small.

Make sure geometry scaling is set to medium.

If that doesn’t work, can you post the graph or at least the contents of that code block sono one has to retype all that?

I’m attaching it again.

Create guardrial poles.dyn (31.2 KB)

Not a fix, but a question.

Why not build the profile as a block in your library, and then recreate instances thereof?

What if it becomes necessary to change the thickness of the support walls? What if it becomes necessary to change the height of the support depending on the profile?

Both of those concerns are valid, but are easier to maintain and update by adjusting dynamic properties of the blocks. The resulting file will be easier to maintain and update, and will perform better as well as (I’m assuming) you’ll be putting all of these geometries into your file as unique blocks and (again assuming) you’ll have a LOT of them over the course of the project.

As far as the problem goes, I tested Dynamo 3.5 and 4.0 - not sure which version you’re using. Both reproduced the error so I poked around a bit more, and found it seems to stem from the PolyCurve.ByPoints applying some rounding somewhere to account for the use of curved segements (which you don’t have as you’re defining your shape by points). Fortunately you’ve got a closed profile consisting of only straight line segments, so you can leverage PolyGon.ByPoints(pointsList) to do the work. Change line 16 to remove the ,true and swap PolyCurve for Polygon and you should be all set if you want to continue on this path (I would exercise some caution though).

Generally speaking Dynamo will give better results for “closed line loops” using Polygon instead of polycurve as it doesn’t have to account for arcing segments.

2 Likes

Thanks a lot, everyone!

1 Like