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.
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.