Announcements

Announcement: We’re aware of an issue affecting starting a new topic from category pages and creating new blog posts. New topics can still be started directly from the relevant board. Learn more here.

Listing of Profile Station and Elevation Label

Listing of Profile Station and Elevation Label

alexisgacia
Advocate Advocate
794 Views
2 Replies
Message 1 of 3

Listing of Profile Station and Elevation Label

alexisgacia
Advocate
Advocate

Hi,

 

Good day.

 

I'm trying to find the list below but nowhere to be found. Can you point me to the right direction. 

 

I used the code below to search the list of Profile Station and Elevation Label  but failed.

            // Get all the Profile View Styles
            Autodesk.Civil.ApplicationServices.CivilDocument doc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
            {
                for (int i = 0; i < doc.Styles.ProfileViewStyles.Count; i++)
                {
                    ObjectId oId = doc.Styles.ProfileViewStyles[i];
                    ProfileViewStyle mObjs = oId.GetObject(OpenMode.ForRead) as ProfileViewStyle;
                    System.Diagnostics.Debug.Print("\nProfile View Style Name: " + mObjs.Name + " - " + mObjs.ObjectId);
                }
                //for (int i = 0; i < doc.Styles.ProfileStyles.Count; i++)
                //for (int i = 0; i < doc.Styles.ProjectionStyles.Count; i++)

                //for (int i = 0; i < doc.Styles.LabelStyles.ProfileLabelStyles.MajorStationLabelStyles.Count; i++)
                for (int i = 0; i < doc.Styles.PipeRuleSetStyles.Count; i++)
                {

                    ObjectId PipeRuleSetStyleId = doc.Styles.PipeRuleSetStyles[i];
                    PipeRuleSetStyle mPipeRuleSetStyle = PipeRuleSetStyleId.GetObject(OpenMode.ForRead) as PipeRuleSetStyle;

                    ed.WriteMessage("\nPipe Rule Set Style Name: {0} - {1}", mPipeRuleSetStyle.Name, mPipeRuleSetStyle.ObjectId);
                    
                    //ObjectId profileViewStyleId = doc.Styles.ProfileViewStyles[i];
                    //var o = profileViewStyleId.GetObject(OpenMode.ForRead);
                    //ProfileViewStyle oProfileViewStyle = ts.GetObject(profileViewStyleId, OpenMode.ForRead) as ProfileViewStyle;


                    //ed.WriteMessage("\nProfile View Style Name: {0} - {1}", oProfileViewStyle.Name, oProfileViewStyle.ObjectId);
                    //System.Diagnostics.Debug.Print("\nProfile View Style Name: " + oProfileViewStyle.Name + " - " + oProfileViewStyle.ObjectId);
                    //ed.WriteMessage("\nProfile View Style Name: {0} - {1}", oProfileViewStyle.Name, oProfileViewStyle.ObjectId);
                }

                ts.Commit();
            }

 

alexisgacia_0-1661752350766.png

 

Many Thanks in advance

 

0 Likes
Accepted solutions (1)
795 Views
2 Replies
Replies (2)
Message 2 of 3

hosneyalaa
Advisor
Advisor
Accepted solution

HI    

TRY

LabelStyleCollection lbFVlstyles = civdoc.Styles.LabelStyles.ProfileViewLabelStyles.StationElevationLabelStyles;

 

 

Message 3 of 3

alexisgacia
Advocate
Advocate

I was trying to find the civilDoc.Styles.LabelStyles.ProfileViewLabelStyles.StationElevationLabelStyles because it was not available, after changing the version of my reference I was able to access it.

 

Thank you

0 Likes