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) #2 - Read from database all Pressure Networks ids: PressureNetwork_Ids = ACAC.GetPressurePipeNetworkIds(AD) # Assign your output to the OUT variable. OUT = NewNet,PressureNetwork_Ids