Create Pipe from DWG


I am trying to create a dynamo script that I can select a linked/inserted .dwg file and have it create pipes for me.

I currently have it working, however I have a couple of issues.

The first issue is if I have a dwg that has lines that join and change direction those elements are not in the list created by element.curves and curves.endpoints. It process any other lines fine.

If I explode the dwg in revit first, then select the individual elements then it will create pipes as expected (without any pipe fittings which is fine)
The issue I am having with this is when I explode the dwg within revit, all of the lines loose the z values.

From what I can see the solutions i need is to either figure out why revit is stripping the z values out when exploding the dwg, or change the dynamo script to something that might handle it better.

I am also trying to pass the level id to the python script but i need to extract just the level element id as an id, not an integer. I cant figure out how to do that either.

The python script just gets start and end xyz values and uses pipe.create to create the pipes.

Thanks in advance.

1 Like

I have it working at the moment. Still need to develop it further but have a working base at the moment.

Hi Paul,

You don’t really need to explode as long as you’ve pre-isolated the curves in the CAD file. Have you tried using “Element.Geometry” instead of “Element.Curves” ?

Also you can avoid that manual conversion if you use the built in point.ToXyz(True) python method:

Paul, i cant find a pipe. create how have you made this python Script ? any help on this issue i would really appreciate

Anyone know how to do this?


Good morning to all, is there any way to have a look at the python code used for the script? I already imported all the lines and point but i really don’t know how to create the pipes and the fittings. I tried to create a macro to create only pipes from an excel file but I don’t know how to convert my macro into a python code for dynamo, it would be very appreciate if someone could share these information or the script to look inside.

Hi Cesare,

I haven’t tried but you can check out this

if you can convert your macro to “dll” then its easy to import to dynamo

see if it helps!

Using AutoLISP to write the endpoints of lines from AutoCAD to a CSV, then reading that CSV in Dynamo is another way.

I’m looking for your script. Can you share it ?

@c.barribaud I’ve recently launched a new package called BimorphNodes that includes optimised nodes for converting curves from DWG/DGN’s and which may enable you to significantly simplify the workflow demonstrated in this thread (or more specifically, eliminate the need for reconstructing the curves via Excel).

The CurvesFromCADLayer node is the first node in Dynamo Sandbox (Revit version of Dynamo) that enables conversion of curves from CAD links or imports by layer name - essentially, you can pick and choose what you want to convert to curves from the CAD link/import by layer, like a filter.

It is also optimised to convert curve types that typically fail when using Explode or Revit.Elements.Element.Curve node which mitigates the ‘missing curve’ problem or issues with Z coordinates being zeroed when using explode.

That should help to get you started


Thank you for your very quick answer and your sharing. It works lovely to convert DWG to revit line.

Is it possible to create pipe or duct from the line you create from DWG ?

Hi @c.barribaud

Could you create new thread for this query? Thanks :slight_smile:

Hi Kulkul,

I don’t know why you want me to create a new thread because, it’s exactaly the the title of this subject.

Do you still want me to create a new thread ?

Title is matching but not the user. This is someone else post to avoid hijacking others post i request you create a new post and link this as reference. Hope that make sense!

Yes please. Thanks :slight_smile:

@c.barribaud Is this what your looking?


yes it’s this I’m looking for. Video goes too speed…

Hi all,
Can you see everything with this video.
We only use this method to create pipes on the layout.
For take off quantity when you want to ignore pipe fitting

1 Like

Hi! Could you paste graph here if it possible? Or what package used for this work?

Kulkul could you send me a snapshot of this definition or the a video for my mortal (not godspeed) eyes?

@i.tzivanidis Create Pipe or duct from dwg