Simple polyline offset to different layers?

After digging through learning material for several hours I’ve given up and have come here to ask, “how do I offset a polyline and set its layer?” It was quite a while yesterday before I just happened across mention that I ought to download the Civil3Dtoolkit package as the default functionality wouldn’t deal with polylines–or maybe it does, I’m not sure–as dynamo says lines are curves, unless they’re polylines, then that’s distinct from a polycurve and dynamo doesn’t like any attempted inputs/outputs I try. The nomenclature isn’t very clear so far. Ultimately I am trying to offset my centerline to create the running lines for my edge of pavement and my RoW on both sides of the centerline.

I’ve successfully managed to get an offset to draw in my modelspace, but the output from the offset line is Object and not Object and I don’t know why. Why does it generate a list when the input is a single polyline? What do I need inbetween the offset output and the setlayer input to make the script happy?

Hi @glasnoct,

Here’s a similar example that might help.

I did actually go through that thread yesterday since it seemed very close to what I wanted to achieve but the included script has so many nodes it’s hard to know which are required for my situation and the why behind some of the workflow (e.g. why do I need to extract the geometry of the alignment and then flatten the resulting list and join them into a polycurve?)

Is there documentation out there that explains the data theory on how an object is defined? polylines/polycurves seem to simultaneously act as a single object and a collection of individual objects based on the node they pass through.

I’ll type up a more detailed response in a bit, but in the meantime you could check out the primer and dictionary if you haven’t already.

OK, here’s the follow-up.

Sounds like there’s some confusion with the Dynamo geometry nomenclature and how it relates to AutoCAD geometry. I think the first thing to mention here is that Dynamo is designed to be a completely standalone application. While it looks like a plugin/extension for Civil 3D, there’s actually a “base” version of Dynamo called Dynamo Sandbox that will run on its own without being strictly tied to Revit, Civil 3D, FormIt, etc. The point I’m trying to make is that Dynamo has its own geometry library so that it can function on its own without being tied to any host software. So, you end up with a sort of “conversion” process if you want to get AutoCAD geometry into the Dynamo workspace, and then conversely the Dynamo geometry objects have to be “converted” back to AutoCAD geometry if you want to create something in model space. This is the root of the reason why the nomenclature is different.

Now on to some of the differences. When you use the Object.Geometry node, an attempt is made to “convert” from AutoCAD geometry to Dynamo geometry. And in the other direction, the Object.ByGeometry node attempts to create AutoCAD geometry from Dynamo geometry. With the out-of-the-box functionality, here’s a summary table of what that mapping looks like. The left column contains every object in the AutoCAD API that is classified as a Curve, and the right column would be its corresponding object type from the Dynamo geometry library.

AutoCAD Object Corresponding Dynamo Object
Arc Arc
Circle Circle
Ellipse Not implemented
Leader Not implemented
Line Line
Polyline Polycurve*
Polyline2d Polycurve*
Polyline3d Polycurve*
Spline Not implemented
Xline Not implemented

Note that many of these items on not implemented on the Dynamo side, which means that the Civil 3D development team hasn’t added that functionality yet. You will see a warning with the Object.Geometry node that says “Not implemented” when this happens. Also note the asterisks with the Polycurves. Using the Object.ByGeometry node with a Polycurve won’t produce a Polyline because a Polycurve in Dynamo can contain much more complex geometry than an AutoCAD Polyline can. A Polyline can only consist of line and arc segments, but a Polycurve could have lines, arc, nurbs curves (i.e. splines), etc. and can be 2D or 3D. So it’s easy to go Polyline → Polycurve, but not the other way around.

With the Civil 3D Toolkit, the above table becomes a little more complete when you use the PolylineExtensions.GetGeometry and PolylineExtensions.ObjectByGeometry nodes.

AutoCAD Object Corresponding Dynamo Object
Arc Arc
Circle Circle
Ellipse Ellipse
Leader Not implemented
Line Line
Polyline Polycurve
Polyline2d Polycurve
Polyline3d Polycurve
Spline NurbsCurve
Xline Not implemented

You don’t have to. The primary reason for doing this is that joining them to a Polycurve gives you more control over the direction of the offset. In AutoCAD, you choose the direction of the offset with a mouse click. You can’t do that in Dynamo, so the direction is specified with either a positive or negative offset value. This will give different results depending on the direction of the individual lines and arcs. By joining to a Polycurve, you are guaranteed that the direction will match that of the Alignment, and then positive offsets will be to the right and negative offsets will be to the left when looking up-station.


Thanks for the much needed clarification on the interopability between dynamo and C3D; I haven’t run into anything as elucidating as that so far!

Back to my original problem, though, What is the PolylineExtensions.Offset outputting? It generates a complete polyline in modelspace but the output isn’t just “Object” but “Object” What does Dynamo think it is?

I wrote out some more info on my setlayer issue but it seems to have magically resolved itself so…I don’t know what was going on there but everything is working ok and that’s all I can ask for at this point haha.

My next “moon on a stick” script would be running this first script across multiple polylines and having the intersections of their offset lines trim, such as how the edges of pavement trim when they meet at a road intersection. That may or may not be beyond Dynamo’s capability, but it’s certainly beyond my at this point in time.

The brackets are just a way of indicating that something is a list of items instead of a single item. So Object just means a list of objects. But of course, it’s certainly possible to have a list with a single item in it. The reason the node outputs the more generic “Object” is because the output could be one of many things depending on the type of input. If you want to dig a little deeper, a high-level overview of inheritance in object-oriented programming will be very helpful for understanding this concept.

This information is so good I feel like it should be pinned somewhere lol!


Jumping in to discussion here as i am feeling some similar issue,

i have some polylines and want to create offset of that polylines to different layer but not sure how to resolve these error i am getting in polycurve.byJoinedCurves ?

An input of layer for PolylineExtensions.offset would have been really helpful.

Thanks for support.

Geometry scaling?


You should be able to replicate this error, as i hv just drawn random polylines near origin.

So are you trying to join a list of random polycurves that don’t share common endpoints?

Yes as direct curve input for geometry is not working after offsetting.

so i am just using it to convert offset curve to polycurve.

There is a list of 4 curves, and the PolyCurve.ByJoinedCurves node is trying to join all 4 of them together into a single polycurve. It throws a warning because it’s not possible to join them all. So you either need to chop up the list into sublists of one curve each or set the lacing to @L1.

1 Like

Thanks that helps, let me tryout with lacing or chopping.