CAD to BIM polyline issue

HI All,

I’ve been creating a script to take 2D polylines from AutoCAD through Dynamo to create floors in Revit. The method I’ve used is to grab the polylines using the GroupGeometriesByLayer from the LinkDWG package. I then make surfaces from the resulting polycurves then trim these surfaces to get surfaces that have interior holes. I then get the perimeter curves of the trimmed surfaces and use these to draw floors.

The script works fine until I have an AutoCAD polyline the contains arc segments. Dynamo breaks the polylines up into separate arcs and polycurves. This means I end up with a bunch of open polycurves so the surface by patch operation fails. I’ve tried rebuilding the polycurves from their points but these are now out of sequence and the lines do not create properly.

I’ve done a version of this script that grabs 3D polylines and this works fine. I wanted to get it working with 2D polylines as these support arc segments 3D polylines don’t and I have so many 3D line segments to represent an arc that running the script is very slow.
12823-01-2d_CAD_Link_Tweak_Only.dwg (69.7 KB)
Create Floors from CAD layer_V8_No_Point_Raise.dyn (79.0 KB)

I’ve attached a copy of my graph and the CAD file I’m pulling the polylines from.

It would be great if anyone has experience of this type of problem and can nudge me in the right direction.

If you have access to Civil 3D you can use Civil 3D to open the DWG and serialize the content into a Data.Remember node or an external JSON file with Dynamo for Civil 3D.

You can then use Dynamo for Revit to open the same graph (in the case of using the data.remember node) or a new graph to read the JSON and use the resulting geometry.

All Dynamo geometry types (any complexity of solids, surfaces, or curves will work).

  • Okay, I had a problem like yours before, it took me a long time to find the right direction.

  • Here is my method, please refer to it if it helps you:

  • First, in AutoCAD, although we draw a Polyline consisting of (Line or Polyline + Arc), when entering Revit it will separate them into 2 parts: “Line or Polyline” and “Arc”, it is very difficult to arrange them. Arrange them to be self-contained, my way is to use AutoCAD’s COM through the Package “LinkDWG”
  • From “LinkDWG” —> All Objects —> Polyline —> Create Floor
  • There are some notes as follows:
  • Make sure when you insert or Link an AutoCAD File into Revit use “Auto - Origin to Internal Origin”, if you choose otherwise, you are required to calculate and relocate the geometry in Dynamo to be accurate in Revit
  • Make sure Poylines in AutoCAD have the “Closed = true” attribute
  • Hope this helps you.
  • In addition, I have also developed an Addin using Revit API combined with WPF to make Floor modeling work with AutoCAD COM easier.
  • I will soon post them to the Autodesk Store

Hi Jacob,

I do have Civil 3D so will give this a go. Having never used Dynamo in C3D I have no Ideas which nodes to use to grab the data. A starter hint would be much appreciated…

Some nodes:

  • Select Object
  • All Objects On Layer
  • Select by Property
  • Object.Geometry

If you use a more specific object type than PolyLine (i.e. sites) you might need more specific selection methods.

Thank you Jacob, much appreciated. I tried the all objects on layer node
image

Its also asking for a block, I’ve no blocks in the drawing… Some more reading on Dynamo for C3D required I think…

Everything you can draw a line in is a block, including model space and every paper space. You likely want Document.Current and Document.ModelSpace as the block input.

Many thanks for your reply. I’ve added the AllObjectsOnLayer & GroupByLayer nodes from the LinkDWG package. This sucessfuly grabs the polylines as COM objects. I’m not sure how to convert these to Dynamo Objects though. I tried the ImportGeometriesByCOM node but this did not convert all objects. How did you do the conversion?

So I got this to work, I just had to explode the polycurves, group all the lines and curves with the Archilab node and recombine them… simple when you know how…

Might want to try PolyCurve.ByGroupedCurves which produces a polycurve from each curve group. Saves you the step of the Archilab node.

Thanks Jacob, that sounds like a great idea will update my graph

1 Like