Transfering curves from Dynamo to AutoCad without using CivilConnection

Hi

I made a script that transfers some polycurves from Revit to Civil3D. It does this using the CivilConnection package. However performance can be really slow. For only 30 simple curves it can take up to multiple hours which is of course undesirable.

I am investigating workarounds for this. An idea that comes to mind is to connect Dynamo to Autocad directly and transfer the curves without using the Civil Connection. Two examples of how that is possible are published on these pages: Connect AutoCAD to Revit with Dynamo and Integrate Dynamo with Autocad.

The first one shows how to transfer lines from AutoCad to Dynamo.
The second one shows how to transfer lines from Dynamo to AutoCad.

The second one is what I am after, however the example is limited to transferring straight lines with one start and one end point. In my case, I am trying to transfer polycurves, which can have straight but also curved line segments.

Does anybody know how can I transfer these partially curved polycurves from Dynamo to AutoCad using a similar method as described, so without using the Civil Connection package?

Would be very helpful. Many thanks in advance.

PS. @Paolo_Emilio_Serra1

If it’s speed you are after I would go a different route.

  1. Install refinery, and Dynamo for Civil 3D.
  2. Move the Refinery package in to your Dynamo for Civil 3D package directory.
  3. In Dynamo for Revit, add a remember node right after the list of geometry. Run the graph so the data is serialized into the Remember node. Save the graph.
  4. Open the graph in Dynamo for Civil 3D. Place an Object.ByGeometry node after the remember node. Run the graph.
  5. Confirm the objects are in C3D correctly.
1 Like

You can serialize the geometry to JSON and read it back in Dynamo for Civil 3D. You can use Civil 3D Toolkit to convert the PolyCurves with Arcs into AutoCAD Polylines or Civil 3D Feature Lines.

3 Likes

You can serialize the geometry to JSON and read it back in Dynamo for Civil 3D

How do i do that? Using Refinery? Or is there also some other method?

image

2 Likes

How do i save the string to a file and import it in another graph?

With extension JSON

image

… or since you are proficient with Python with the json module that comes with Python.
I prefer the Python route as I can classify the geometry as I need.
It used to be the only method I could use to handle the serialization of of lists of geometries, I even created my own Python module to handle the JSON serialization.
Luckily now is out of the box.

1 Like

Paolo, Good afternoon!
Hope you are well!
I am using your advise for solids transfer (C3D to Revit), and trying to get PropertySet values across as well.

I have 2 scripts:
1: C3D side takes geometry SolidDef.ToGeometry → FileSystem.WriteText ( as you show):


2: Revit side takes Json from FilePath through Filesystem.ReadText → Geometry.FromSolidDef.
it produces only 1 “solid” output, is there a parsing issue?

if so, is there formatting node that I am missing?

Many thanks, and keep your amazing workProcessing: C-ALL-ALL-00005_U-UTIL-COMB-F...
C-ALL-ALL-00005_U-UTIL-WATR-F.json.txt (9.5 KB)

@denis.erlichLQ8SB there is effectively one object in the JSON you shared.
When you are serializing to JSON in Civil 3D you need to make sure the list of obejcts is processed.

1 Like

Paolo, good evening!
It worked!

Here is my C3D side:

and on Revit side script is as follows:

next step will be to see how to transfer metadata from Civil solid to Revit family
Thank you very much !

3 Likes

@denis.erlichLQ8SB since you are using CivilConnection you can apply the transform via RevitUtils.DocumentTotalTransform

1 Like

ok, got this all worked. Here is the node.C3D-ConvertACADSolidsAndMetadataToJson.dyn (632.0 KB)
RVT-ConvertJsonACADSolidsAndMetadataToGenericFamilies.dyn (2.2 MB)

and this one - on C3D side, but not from Solids, it is from Networks RVT-ConvertJsonPipeNetworksAndMetadataToGenericFamilies.dyn (181.6 KB)
1.0.C3DNetworksAndSetMetadataToJsonAndCSV.dyn (80.3 KB)