List of Structures/pipes between Strucures

I have the user select two structures on a network and want to retrieve a list of the pipes and structures between the two structures selected. I was looking at some nodes from Camber Package as shown but its not enough to get what I want. Ive looked at so many nodes and I cant see how I can do it. Essentially Im trying to adopt the ‘Alignment from Network’ command principles.

If you don’t find what you want in the Camber Package you need to

Ok, thanks Hosneyalaa, that would do it alright. Above my skills right now so will see what I can do with it

No problem,
you tried because Friday is a holiday
If no one helps you on Saturday,
I will help you

I’m going to add a FindShortestNetworkPath node to Camber, there were just a couple of issues the first time around so I didn’t include it in the initial release.


Thats great mzjensen, appreciate your time. @hosneyalaa - also thanks for the offer, see what the node brings so you enjoy the weekend !

That would be awesome! I would love the ability to get all the parts in between the shortest path that way you could identify different branches perhaps.

see this

import sys
import clr
import csv
# Add Assemblies for AutoCAD and Civil 3D APIs
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
import Autodesk.AutoCAD.ApplicationServices.Application as acapp

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references for Civil 3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

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

adoc = acapp.DocumentManager.MdiActiveDocument
ed = adoc.Editor
civdoc = CivilApplication.ActiveDocument


objects = IN[1]

def move_labels(ids,PROFILE_VIEW):
	if not hasattr(PROFILE_VIEW, "__iter__"):

	if not hasattr(ids, "__iter__"):
		ids = [ids]
	error_report = None
	res = []
		with adoc.LockDocument():		
		    with adoc.Database as db:		
		        with db.TransactionManager.StartTransaction() as t:		    
		            sampleLineId1 = PROFILE_VIEW[0].InternalObjectId
		            objVIEW1 = t.GetObject(sampleLineId1, OpenMode.ForWrite)
		            sampleLineId2 = ids[0].InternalObjectId
		            objVIEW2 = t.GetObject(sampleLineId2, OpenMode.ForWrite)
		            corid2oN = t.GetObject(objVIEW2.NetworkId, OpenMode.ForWrite)
		            minLength = 0 
		            boundaryEntities = corid2oN.FindShortestNetworkPath(objVIEW2.Id,objVIEW1.Id,float(minLength))
		            for sid in boundaryEntities[0]:
		                site = t.GetObject(sid, OpenMode.ForRead)
		import traceback
		error_report = traceback.format_exc()
	if error_report is None:
		return res
		return error_report

OUT = move_labels(objects,PROFILE_VIEW)

1 Like

Hosneyalaa, tested it and no surprise from yourself, it works. Thanks again for your efforts, its really appreciated. When I seen the input labels as Profile_View, I thought it wasnt going to work but its probably a copy/paste leftover. I found I had to swap the structure inputs around to get the right order on output. Thats ok though, all working. Thanks again


Thanks for sharing this python code, this is cool stuff. I think the python output is missing the first structure? And should the list be reversed? It’s a little bit tricky to have to feed it structure objects like this but doable. Also, It would be nice to have object outputs instead of string incase a pipe has the same as a structure. Thanks again!

Tip, you can use Camber Package to directly convert a selected structure civilobject to the part

Thank you @KirkWM
The mothed is not to enter the second item in the list Therefore,
you must add it to the list on demand
She gives id she gives directly And
I put the name to illustrate as an example
Define change in code by task
It also works with the pipe or the manhal