Create Alignment Label for High and Low Point using c#

Create Alignment Label for High and Low Point using c#

alexisgacia
Advocate Advocate
447 Views
2 Replies
Message 1 of 3

Create Alignment Label for High and Low Point using c#

alexisgacia
Advocate
Advocate

Hi,

 

Good day.

 

I'm trying to create a tool that will make High and Low Point labels in the selected alignment if detected using single profile. 

 

I was able to create this manually using the Alignment Label.

alexisgacia_0-1666885370885.png

 

Below the sample code attempting to create it automatically.

 

            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            Database db = doc.Database;
            var civdoc = CivilApplication.ActiveDocument;
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                string mLabelStyleName = "High Point v1";
                LabelStyle mLabelStyle = null;
 

                foreach (var vf in civdoc.Styles.LabelStyles.AlignmentLabelStyles.VerticalGeometryPointLabelStyles)
                {
                    var mStyle = tr.GetObject(vf, OpenMode.ForRead);
                    if(mStyle is LabelStyle)
                    {
                        mLabelStyle = (LabelStyle)mStyle;
                        if (mLabelStyle.Name == mLabelStyleName)
                        {
                            break;
                        }
                        else mLabelStyle = null;
                    }
                }



                acc3db.Alignment align = (acc3db.Alignment)tr.GetObject(civdoc.GetAlignmentIds()[0], OpenMode.ForRead);
                var lblsetId = civdoc.Styles.LabelStyles.AlignmentLabelStyles.VerticalGeometryPointLabelStyles[mLabelStyleName];

// I stuck in this area and try to find it the internet but no samples provided.                Autodesk.Civil.DatabaseServices.AlignmentVerticalGeometryPointLabelGroup.Create(mLabelStyle.ObjectId, align.ObjectId, )

 

 

0 Likes
448 Views
2 Replies
Replies (2)
Message 2 of 3

hosneyalaa
Advisor
Advisor
0 Likes
Message 3 of 3

alexisgacia
Advocate
Advocate

Hi,

 

Thank you for your reply. 

 

What I'm trying to create is a tool to make it automatically generate Label for High Point and Low Point to all alignments using the first profile detected. 

 

I can do it manually based on the link that you provided but only for 1 alignment. For multiple alignments, its not yet available.

0 Likes