Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get Invert Elevations and coordinate of all Pressure Pipe

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
NoelRico
299 Views, 4 Replies

Get Invert Elevations and coordinate of all Pressure Pipe

Hi Everyone,

 

I got Civil3d 2023 drawing from designer that contains pressure pipe.

I want to collect all the start/end coordinate and invert elevation of all pressure pipe so I can draw a 3d polyline on it and give to surveyor for staking in the field.

 

I'm currently creating profile by tracing the bottom of pressure pipes and fittings in the profile view then create featureline from alignment, but its taking time. Please send me any C# code to automate this process.

 

Any help will be greatly appreciated.

 

Thanks,

 

Noel

 

 

Tags (3)
Labels (3)
4 REPLIES 4
Message 2 of 5
hosneyalaa
in reply to: NoelRico

 

Hi @NoelRico 

For best answer , can you attached example drawing

 

Note , can you use this code with some changes

Looking at it 

 

 

 

https://forums.autodesk.com/t5/civil-3d-customization/read-property-data-from-an-entity/m-p/6393069

CivilDocument doc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
Document acDoc = acDocMgr.MdiActiveDocument;
Database acCurDb = acDoc.Database;
using (System.IO.StreamWriter sw = new StreamWriter(@"d:\output.txt", true))
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
{
    ObjectIdCollection pipeNetworkIds = doc.GetPipeNetworkIds();
    foreach (ObjectId pipeNetworkId in pipeNetworkIds)
    {
        Network oNetwork = ts.GetObject(pipeNetworkId, OpenMode.ForWrite) as Network;
        ObjectIdCollection pipeIds = oNetwork.GetPipeIds();
        foreach (ObjectId pipeId in pipeIds)
        {
            Pipe oPipe = ts.GetObject(pipeId, OpenMode.ForWrite) as Pipe;
            ObjectIdCollection setIds = PropertyDataServices.GetPropertySets(oPipe);
            foreach (ObjectId psId in setIds)
            {
                PropertySet pset = ts.GetObject(psId, OpenMode.ForRead, false, false) as PropertySet;
                PropertySetDefinition psd = ts.GetObject(pset.PropertySetDefinition, OpenMode.ForRead) as PropertySetDefinition;
                foreach (PropertyDefinition pd in psd.Definitions)
                {
                    int propertyId=pset.PropertyNameToId(pd.Name);
                    object value = pset.GetAt(propertyId);
                    sw.WriteLine("Handler: " + oPipe.Handle.ToString() + "; " + pd.Name + ": " + value.ToString().Trim());
                 }  
                 //PropertySetDataCollection psetDataColl = pset.PropertySetData;
                 //PropertySetData pPropData;
                //for (int c = 0; c < psetDataColl.Count; c++)
                //{
                    // pPropData = psetDataColl[c];
                    // object data = pPropData.GetData();
                    //}
                }
                sw.WriteLine(System.Environment.NewLine);

            }
        }
}

 

 

Message 3 of 5
NoelRico
in reply to: hosneyalaa

Hi Alaa Hosney;

 

Thanks for the Code. I have already code for Pipe Network. I need only some properties of Pressure Network, please see below image.

 

Thanks,

Message 4 of 5
hosneyalaa
in reply to: NoelRico

 

hi @NoelRico 

try

public void InvertElevationscoordinates()
        {
            CivilDocument doc = CivilApplication.ActiveDocument;
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
            {
                ObjectIdCollection pipeNetworkIds = doc.GetPressurePipeNetworkIds();
                foreach (ObjectId pipeNetworkId in pipeNetworkIds)
                {
                    PressurePipeNetwork oNetwork = ts.GetObject(pipeNetworkId, OpenMode.ForWrite) as PressurePipeNetwork;
                    ObjectIdCollection pipeIds = oNetwork.GetPipeIds();
                    foreach (ObjectId pipeId in pipeIds)
                    {
                        PressurePipe oPipe = ts.GetObject(pipeId, OpenMode.ForWrite) as PressurePipe;

                        ed.WriteMessage(" " + System.Environment.NewLine);

                        ed.WriteMessage(oPipe.Name + System.Environment.NewLine);

                        string ContentText = string.Format("{0} StartPoint.X {1} StartPoint.Y {2} EndPoint.X {3} EndPoint.Y" +
                            " {4} Start Invert  {5} End Invert          ",
                            oPipe.StartPoint.X, oPipe.StartPoint.Y, oPipe.EndPoint.X, oPipe.EndPoint.Y, oPipe.StartElevation -( oPipe.InnerDiameter / 2 )
                            , oPipe.EndElevation - (oPipe.InnerDiameter / 2) );
                        ed.WriteMessage(ContentText);

                        ed.WriteMessage(" " + System.Environment.NewLine);
                        

                    }
                }
            }
        }

 

Captureq.JPG

Message 5 of 5
NoelRico
in reply to: hosneyalaa

Thanks,

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report