Good Day! Is anyone know how to get the bearing for the pipe from pipe networks in Civil 3D? I try to get the dictionary out from the part data, but seems the node is not available.
Hi @BEK ,
Have you looked into the nodes from the Civil3DToolkit package?
That package has a lot of extra nodes, among which PipeNetwork nodes.
Hi @BEK,
Here’s a way to get the bearing via Python. It will return the angle as a double measured in radians, with a zero angle being due East.
import clr
clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.Civil.DatabaseServices import *
from Autodesk.Civil.ApplicationServices import *
adoc = Application.DocumentManager.MdiActiveDocument
def get_pipe_bearing(pipes):
global adoc
output = []
if not pipes:
return
if not isinstance(pipes, list):
pipes = [pipes]
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
for pipe in pipes:
pipeId = pipe.InternalObjectId
obj = t.GetObject(pipeId, OpenMode.ForRead)
if isinstance(obj, Pipe):
output.append(obj.Bearing)
t.Commit()
return output
OUT = get_pipe_bearing(IN[0])
4 Likes
@Daan , I cant see it in the latest C3Dtoolkit package.
@zachri.jensen, thanks a lot. I still having this issue. Sorry for me not knowing what is exactly happen here. I would like to use from the pipes in pipe network to get the bearing out.
1 Like
Hi @BEK
You can use the node list.flatten to bring it back to a single list
3 Likes
Thanks. Wonderful! The pipe list need to flatten it as what @lebinhx3c2012 suggested below.
1 Like
Thanks a lot!
1 Like
Good call @KirkWM - forgot about that one.
2 Likes