Creating pipe from CAD file

Hi there,

I’ve modified this python script in order to create ducts from a cad file and now it works.

Now I would like to do the same but with pipes. The thing is that I should change at least the line 40 and 31:

Ducttype = IN[3]
doc.Create.NewDuct(x, y, Ducttype)

Could somebody tell me the correct command and parameters for pipes?

thks

1 Like

line 40 is invalid
Document.NewDuct Method (Connector, Connector, DuctType) - it takes Connector, not location. You can pass location via Connector.Origin Property
http://revitapisearch.com/html/d508084a-1306-c3e6-fd81-5915a8896db9.htm
http://revitapisearch.com/html/28a9cf5e-9191-f9ce-74c8-622a681201f6.htm

Hi Tomas,
It works for me. Document.NewDuct Method (XYZ, XYZ, DuctType)
http://revitapisearch.com/html/6f8b1fa9-5e94-2a31-c921-ec1db957b31b.htm
What I’m asking for is the same command for pipes (python). Do you know it?

Thks

2 Likes

Hi Jose,

As you could see, he doesn’t say anything about the important python scripts, so you could just know that you could od it, but don’t know how.

Thks

Hello,

I’ve made a script that creates the pipes. It’s a different method from the one posted in the first post but it will create pipes that are assigned to a system type. Something the above method doesn’t do.


The first 2 inputs are startpoints and endpoints of the curves.

I’d like to share the code, but I don’t know how to format it properly in this forum’s text editor.

The problem with this script is about fittings.
The pipe is created but is without fittings, it could be very good if the run is complete. Then we can easily study also coordination and clash free routing.
Thanks
Cesare

I think the best approach for making connected systems would be to start with Pipe Placeholders, using Pipe.CreatePlaceholder(…
This would simplify things a lot as the endpoints of joined lines/placeholders will be the same and there are several ‘Connect Placeholder’ methods that will join the connectors. (Actually the API help suggests the connectors dont even need to be on the same point, just in the same plane and it should work).
Then let revit do the complicated task of making and joining the fittings. there is also a Convert Placeholder method to do this via api.

(Taco, I have taken to using links to Pastebin or Hastebin for code, both have python formatting options)

Although creating fittings through a script might seem desirable, the reality is that most of the time pipes will probably not connect in a way that you would like. The script would also have to take into account when pipes cross and need to create bridges at those points for it to work well.

Using pipe placeholders sound like a good idea, I’m gonna give that a go, might make it a bit more flexible in choosing where you want the pipes to connect.

Thanks for the suggestions Joseph, I’ll check those out :+1:

Hi T_Pover,

I’m trying to make the script, but it doesn’t work for me.

Find attached pictures of that


Seems like it’s getting wrong input for the len() on line 38. What have you plugged into IN[3]?
It should be a list of multiple system types. If you only have 1 system type then you could remove line 38 completely and also remove the ‘[n]’ after systemtype on line 39

Thks P_Pover

Now I got this error:

line 32: levelId -> change to LevelId

Thks everybody for your help.
That’s the result:

7 Likes

Thanks @Manel_Fernandez for posting the whole picture for us. But I am wondering whats wrong for mine, there’s still an error. :sob:

You are feeding it a single point instead of a list of points.

1 Like

Hi All,

When I run the python node, dynamo hangs up and I can’t figure out why. Any help is greatly appreciated.
Cheers,

Hi Charles,
You need to feed lines in IN[0] to Python. Currently your feeding points.

Hi Kulkul,
IN[0] is meant to take in an array of points. I mislabeled the variable name. Apparently restarting my computer worked for some reason.

Cheers,

Good to know that. Next time create new post and add reference links to the post instead of hijacking others. Thanks :slight_smile: