Create Reference Lines from CAD (DWG) Curves (3D Polylines)

Hello everyone!
This is my first post here, I hope it’s in the right place.
In order to model a ‘simple’ bridge I just dived into Dynamo.

Here’s what I got so far and it’s working for single curves:

What I would like to achieve is importing all available Curves (3D Polylines) from my AutoCAD drawing into Revit to be able to place a profile along those curves.
I have already created a bridge profile as adaptive family with 4 adaptive points and so this profile has to be run along my 4 curves.

Maybe there’s a much better way to achieve this, any advice appreciated.

Best Regards

Hello and Welcome!

Can you repost the image with the node preview bubbles pinned so we can see what’s going on in your graph? Also post the error messages as they may explain what’s causing the node to fail.

Hello Nick.

Here’s a new screenshot from Dynamo:

and here the error messages:
Warning: ReferencePoint.ByPoint operation failed. Element cannot be created in current context
Warning: CurveByPoints.ByReferencePoints operation failed. Object reference not set to an instance of an object.

But these errors haven’t been there before. It has definitely worked and at some point the error popped up. No idea why and unfortunately I can’t fix it anymore.

A brief description what the Dynamo Script does (or should):
Pick the imported CAD lines from the model, take the line with index 0, place 10 points on that line (from start point to end point), create reference points from these points and finally create a curve on these reference points.

What I actually need are reference lines or curves from all CAD lines in Revit.

Maybe someone has an idea

Best regards

Are you in an adaptive or massing environment (.rfa file) , or a project (.rvt)?

I am in a project (*.rvt)


EDIT: 2025/01/17 15:45 CET

I’ve also tried it in a family (*.rfa) and throws the same errors.

It is not possible to create a reference point in a project via the UI or API, and therefore you can’t do so with Dynamo. I believe you’ll want to run your automation in a massing environment, or an adaptive family. Start from a Generic Model Adaptive template (you won’t have standard extrusion tools in the UI).

Thanks Jacob,
I’ll stick with the massing environment in my project.

Now I am facing another problem:
I tried using an adaptive family (from template “Metric_Generic_Model_Adaptive-ENU.rft”) and the Dynamo Script works, but each time I run it, new points/curve are created and the previously created points/curve disappear.
Should it be that way?

A better solution would be to create multiple curves, but I have absolutely no idea how to do that.
Can this be done by modifying the script?
Maybe with a loop function or something similar?

Actually I have zero experience in Dynamo, but know some other languages like VBA and JS.
In JavaScript/VBA, for example, you can iterate a function with a for each loop, but there doesn’t seem to be something similar in Dynamo.

Could someone help me out here?

Kind regards

Yes - this is to prevent creating duplicate instances when authoring graphs. Save the file, clear out any Element Binding, and leverage Dynamo Player to circumvent the issue.

This is certainly a better option - and super easy. Check out the Dynamo Primer section on list lacing and then list levels for information on how Dynamo manages for loops: What's a List | Dynamo

The whole primer is likely worth going through as you’ll learn a bunch of stuff which will smooth over your adoption. Skip the section on Civil 3D if you don’t use Vibil 3D or AutoCAD.

Alright, I’ve read the topic but could’t find anything I could use.

Is there a simple way to “convert” AutoCAD curves to Revit curves?
Maybe the script I use is not suitable for this task and I have to take a different approach…

Could need some help here.

There’s not really anything to “use”, it’s just understanding how Dynamo works and how nodes operate with lists. Converting a list of curves is the same process as converting a single curve. The only difference is (potentially) how certain nodes interact with multiple inputs and structures.

The simplest way is to get the AutoCAD curves into Dynamo (as Dynamo curves) and then create new Revit curves from the Dynamo geometry. Start with your imported CAD curves and either DetailCurve.ByCurve or ModelCurve.ByCurve (depending on which one you want) and see where that gets you.

Thanks for resurfacing this one @Nick_Boyts - had a draft but forgot to come back to it.

Assuming the topic was the linked Element Binding topic, there is nothing to ‘use’ but a lot to learn. From what I can tell you can skip the binding stuff for now and focus on list lacing and levels. Binding (an advanced topic for sure) will come much later if at all (most just avoid it).

It depends on what you want to do with it. By the looks of it you’re after creating somewhat parametric families, which means you’re on the right track. What isn’t clear is what you’re after - one curvy spline created by looping though all the Reference points you generated, or something more akin to the profile view you showed in the “Revit Project with imported CAD” portion of your first screenshot.

To automate Revit you must first understand how to use Revit; so if you’re after creating 8 lines that make up the imported profile view, you need 8 pairs of Reference Points (though your profile as adaptive family shows 4 adaptive points), created from 9 points in the correct sequence. The ‘10 points’ might also work (and even be necessary if you’re attempting to capture the curvature of the roadway section), but you’ll want ot check the lacing and list levels. Skip over the List.GetItemAtIndex and wire the Element.Geometry node directly into the Curve.PointAtParmater. Then set the curve input of the Curve.PointAtParameter node to use @L1 list level. This shoudl give you 8 lists of 10 points, and then 8 sets of 10 reference points, and then 8 CurveByPoint elements. The 8 CurveByPoint elements can then have their “IsReference” parameter set to ‘true’, which should set you up.

However these are not yet adaptive points, and you’ll have points on top of points due to how you generated the sequence. As a result hosting this profile in another adpative component (to allow the bridge to form a solid) or placing an instance in a project might prove challenging.