Help in Alignment From Network Parts Using C# ?

y.awwad
Contributor

Help in Alignment From Network Parts Using C# ?

y.awwad
Contributor
Contributor

I have a C3D Storm Network File , I want to create alignments from network parts and create profiles for created alignments , Test File Attached

if you can help @Jeff_M  🙏

0 Likes
Reply
Accepted solutions (1)
472 Views
10 Replies
Replies (10)

Jeff_M
Consultant
Consultant

@ Have you tried the CreateAlignFromNetwork command?

2025-03-28_09-06-35.png

Jeff_M, also a frequent Swamper
EESignature
0 Likes

y.awwad
Contributor
Contributor

Yes ,but this is a manual method .. i ask for a C# code , i searched but didn't find Alignment from network parts in documentation

0 Likes

Jeff_M
Consultant
Consultant

@y.awwad your initial post did noy mention anything abut c# code. Neither post suggests how you want it to work, nor do you show any code that you have created to attempt this project. If you want someone to create it from scratch for you, at the very least you would need to explain the steps you would expect to take when executing the command. 

Jeff_M, also a frequent Swamper
EESignature

hosneyalaa
Advisor
Advisor

@y.awwad  hi

Why delete your code in your first post

It's better to repost it as  @Jeff_M said

0 Likes

y.awwad
Contributor
Contributor

@hosneyalaa
That code was generated using AI and was not working so i thought people will laugh when see the code  🙄

0 Likes

y.awwad
Contributor
Contributor

@Jeff_M 
sorry , I just mentioned in title ( using C# )

I just need a guide if there is a C# Method to do same steps as ( Create Alignment From Network Parts ) because I searched in documentation but all I found was alignment in general of from polyline ( without any structure selecting )

Steps For Creating an Alignment :

Select last ( structure ) then first  ( structure )  , it will automatically select all structures and pipes between them and add all to the created alignment

0 Likes

Jeff_M
Consultant
Consultant
Accepted solution

@y.awwad The Network Object has the FindShortestNetworkPath method which returns the ObjectIds of the parts in that path. You can use the coordinates of the pipes and/or structures to add the segments of the Alignment (create an Alignment without geometry) by adding a FixedLine segment to the AlignmentEntties.

Jeff_M, also a frequent Swamper
EESignature

y.awwad
Contributor
Contributor

@Jeff_M 

Thanks for help 💙

0 Likes

y.awwad
Contributor
Contributor


when create Alignment from polyline, its type be "Centerline" 

I want to change alignment type to "Miscellaneous" , plz help  @Jeff_M  🙏

I tried but i got error that Alignment Type is read only
in civil 3D i can manually open Alignment properties and select type to "Miscellaneous"

https://help.autodesk.com/view/CIV3D/2020/ENU/?guid=a11fcbba-1e90-ad37-d265-2243da4da299

0 Likes

Jeff_M
Consultant
Consultant

@y.awwad As you have found, the AlignmentType is read only. So the Civil 3D developers have decided that we 3rd party programmers won't ever need to set this. Sounds like a shout out to @TimYarris & @dsimeone is in order to maybe get this remedied.

Jeff_M, also a frequent Swamper
EESignature

Type a product name