How can I create a Pressure Network?

Hello,

I’m trying to create a new Pressure network in my file. But when I do this in a python script, it creates a Pressure Network Id but it doesn’t appear in ToolSpace. In my code I checked the database of the file if there really was any network and the Id of the network I created appeared.

I tried to create a Pressure Pipe in this Network, but I have the same problem, it creates a Pressure Pipe Id, but my pipe doesn’t appear in the model.

Someone knows how can I correct this?

# Load the Python Standard and DesignScript Libraries
import sys #sys is a fundamental Python library - here, we're using it to load in the standard IronPython libraries
import clr #This is .NET's Common Language Runtime. It's an execution environment that is able to execute code from several different languages.
import os
import math

# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry') #A Dynamo library for its proxy geometry
#classes. You'll only need this if you're interacting with geometry
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('System.Windows.Forms')
clr.AddReference('acdbmgdbrep')
clr.AddReference('Civil3DNodes')
clr.AddReference('AutoCADNodes')

# Add references to manage arrays, collections and interact with the user
from System import *
from System.IO import *
from System.Collections.Specialized import *
from System.Windows.Forms import MessageBox

import Autodesk #Loads the Autodesk namespace
# Import references from AutoCAD
AAR = Autodesk.AutoCAD.Runtime
AAA = Autodesk.AutoCAD.ApplicationServices #Setting a handle to the currently-open instance of the AutoCAD application
AAD = Autodesk.AutoCAD.DatabaseServices
AAE = Autodesk.AutoCAD.EditorInput
AAG = Autodesk.AutoCAD.Geometry
AADy = Autodesk.AutoCAD.DynamoNodes

AUX = Autodesk.Aec.DatabaseServices

OP = AAD.OpenMode
TS = AAD.Transaction

# Import references from Civil3D
ACA = Autodesk.Civil.ApplicationServices #Setting a handle to the currently-open instance of the Civil3D application
ACD = Autodesk.Civil.DatabaseServices
ACDy = Autodesk.Civil.DynamoNodes

AD = ACA.CivilApplication.ActiveDocument #Finally, setting up handles to the active Civil3D document
ACAC = Autodesk.Civil.ApplicationServices.CivilDocumentPressurePipesExtension
adoc = AAA.Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # E vem ai

            #1 - Create a new Pressure Pipe Network:
            NewNet = ACD.PressurePipeNetwork.Create(db,IN[0])

            #2 - Read from database all Pressure Networks ids:
            PressureNetwork_Ids = ACAC.GetPressurePipeNetworkIds(AD)            

# Assign your output to the OUT variable.
OUT = NewNet,PressureNetwork_Ids

hi
I think first you should get this PressurePartListCollection Members
PressurePartListCollection Members
and
PressurePartList Members

I was trying it and couldn’t get a result

Have you tried to get it

1 Like

I’ve already managed to create a pressure pipe, I already know how to read and see the part lists. But even creating, it doesn’t appear in my file.

# Load the Python Standard and DesignScript Libraries
import sys #sys is a fundamental Python library - here, we're using it to load in the standard IronPython libraries
import clr #This is .NET's Common Language Runtime. It's an execution environment that is able to execute code from several different languages.
import os
import math

# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry') #A Dynamo library for its proxy geometry
#classes. You'll only need this if you're interacting with geometry
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('System.Windows.Forms')
clr.AddReference('acdbmgdbrep')
clr.AddReference('Civil3DNodes')
clr.AddReference('AutoCADNodes')

# Add references to manage arrays, collections and interact with the user
from System import *
from System.IO import *
from System.Collections.Specialized import *
from System.Windows.Forms import MessageBox

import Autodesk #Loads the Autodesk namespace
# Import references from AutoCAD
AAR = Autodesk.AutoCAD.Runtime
AAA = Autodesk.AutoCAD.ApplicationServices #Setting a handle to the currently-open instance of the AutoCAD application
AAD = Autodesk.AutoCAD.DatabaseServices
AAE = Autodesk.AutoCAD.EditorInput
AAG = Autodesk.AutoCAD.Geometry
AADy = Autodesk.AutoCAD.DynamoNodes

AUX = Autodesk.Aec.DatabaseServices

OP = AAD.OpenMode
TS = AAD.Transaction

# Import references from Civil3D
ACA = Autodesk.Civil.ApplicationServices #Setting a handle to the currently-open instance of the Civil3D application
ACD = Autodesk.Civil.DatabaseServices
ACDy = Autodesk.Civil.DynamoNodes

AD = ACA.CivilApplication.ActiveDocument #Finally, setting up handles to the active Civil3D document
ACAC = Autodesk.Civil.ApplicationServices.CivilDocumentPressurePipesExtension
adoc = AAA.Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            # E vem ai
            
            #1 - Coletar e pega a PartList escolhida para a pressure pipes (Collect and get the partlist choose to pressure pipe):
                        
            PartList_Collection = ACD.Styles.PressurePartList.GetAvailablePartLists(db) 
            PartList_Selected = []
            for id in PartList_Collection:
                PartList = TS.GetObject(t,id,OP.ForRead)
                PartList_Description = PartList.Description
                if PartList_Description.Contains(IN[0]) is True:
                    PartList_Selected = PartList
            
            #2 - Ler o catálogo (Read the catalog):
            
            PipeType = ACD.PressurePartDomainType.Pipe
            FittingsType = ACD.PressurePartDomainType.Fitting
            PipeSize = PartList_Selected.GetParts(PipeType) 
            PipeSize_Name = []
            FittingsSize = PartList_Selected.GetParts(FittingsType)
            FittingsSize_Name = []
            for i in PipeSize:
                PipeSize_Name.append(i.Description)
                
            for i in FittingsSize: 
                FittingsSize_Name.append(i.Description)
                
            #3 - Criar Pressure Network pelo nome (Create Pressure Network by name):
            NewNet = ACD.PressurePipeNetwork.Create(db,IN[1])
            Net = TS.GetObject(t,NewNet,OP.ForWrite)
            Net.UpgradeOpen()
            
            Ponto1 = AAG.Point3d(279867.7154,9114672.9238,0)
            Ponto2 = AAG.Point3d(279785.0385,9114495.0680,0)
            Linha = AAG.LineSegment3d(Ponto1,Ponto2)
            
            #Create Pressure Pipe by Line and PipePartSize
            TuboTeste = Net.AddLinePipe(Linha,PipeSize[0])
            Pipe = TS.GetObject(t,TuboTeste,OP.ForWrite)
            
# Assign your output to the OUT variable.
OUT = dir(Net)
2 Likes

good job
Thanks for sharing the code Tomorrow

I will try it can i get a result?

2 Likes

You must already have a catalog and partlist on file. I filtered by name (ex. “R22”) and was able to access the tubes and fittings.


1 Like

Did you try to add another line?
Code
t.Commit()

1 Like

OMG! Worked!!! Thanks!!

2 Likes

good job

We wish you good luck
Thanks

@hosneyalaa @andre.demski FYI there are some nodes in Camber to create and work with Pressure Networks.

3 Likes

Dear demski,

it is a great example for create the pressure network, but the problem is how we can add the pressure fitting to the network, do you have any example for that and i will be gratefully.

@zachri.jensen I have been tinkering with the Pressure nodes in Camber, really good stuff. I hav’nt figured out how to tie them all together in a workflow yet. Do you have any images of eamples? Thanks!

Haha I haven’t either! :rofl:

I did enough testing to know that they work, but didn’t have time for much more than that. I was hoping someone would play around with it and then share their experience. There’s more functionality that exists in the API that I haven’t had time to implement yet, so I’d love to know if you think of some nodes that would be important for various workflows.

As a side note, I’ve learned that developing stuff like this (and probably any software for that matter) is a delicate balance between identifying the key features that are actually useful versus just making a tool that has every available option under the sun. The API is quite extensive, so if there was a Dynamo node for everything it would be a monster. So in summary, I’m keen to hear what is useful and what isn’t, or what you think is missing. I usually come up with ideas for new nodes as I’m working on my day-to-day projects, but I haven’t done one lately that needed Pressure Networks.

1 Like

Really it’s just these 2 nodes from Gravity Pipes that are needed, image

Anybody want to team up and try to get the Pressure Network Nodes into something cool for the community? May require some Python for the 2 nodes above? @KirkWM

1 Like

Great stuff out there. I think, its useful too that you add the following:

  • AddPressurePipe from Object or Curve
  • AddPipeRunFromObject from Object or Curve
1 Like

Hi Andre ! I really appreciate your efforts and sharing them with us ! May you tell me what learning materials or steps I have to go through in order to understand C3D native runtime language??

Thanks !!!

I would like to vote for these two nodes to be added to the pressure network Camber Catalog. Any updates would be much appreciated. I looked moments ago and didn’t see anything that creates pipes, fittings, or appurtenances. (may have missed them though)

I’ll add them to the list :+1:

2 Likes

Hi @mzjensen,

I used Pressurepiperun.ByObject node. In this node surfaceOffset not working I think surface reference option should be there in this node

I was tried to use pipe run profile option in dynamo. I have end up with error. Could you please assist me

Hi @Manrajan.Kalimuthu1,

The reference surface is set for the entire pressure network, not for individual pipe runs.