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.
# 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
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)
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!
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.
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
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??
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)