AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Distinguished Mentor
Civil3DReminders
Posts: 909
Registered: ‎03-24-2009
Message 1 of 3 (271 Views)

Profile Data Band Label Group

271 Views, 2 Replies
04-07-2012 12:13 PM

So I've got a collection of the LabelGroupSubEntity in the ProfileDataBandLabelGroup. I need to replace some values inside them based on what Vertical Geometry Point they are labeling. Is there an easy way to determine what station value it is labeling?

 

Christopher 

*Expert Elite*
Jeff_M
Posts: 4,297
Registered: ‎07-22-2003
Message 2 of 3 (259 Views)

Re: Profile Data Band Label Group

04-08-2012 05:15 PM in reply to: Civil3DReminders

Will this give you what you need?

 

            CivilDocument civdoc = CivilApplication.ActiveDocument;
            using (Transaction tr = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
            {
                Alignment oAlign = (Alignment)civdoc.GetAlignmentIds()[0].GetObject(OpenMode.ForRead);
                ProfileView pv = (ProfileView)oAlign.GetProfileViewIds()[0].GetObject(OpenMode.ForWrite);
                RXClass profDataBandLabelGroupRXClass = SystemObjects.ClassDictionary["AeccDbProfileDataBandLabeling"] as RXClass;
                ObjectIdCollection profBandLabelsObjIdColl = ProfileBandLabelGroup.GetAvailableLabelGroups(profDataBandLabelGroupRXClass, pv.ObjectId, false);
                if (profBandLabelsObjIdColl.Count > 0)
                {
                    ProfileBandLabelGroup grp = (ProfileBandLabelGroup)profBandLabelsObjIdColl[0].GetObject(OpenMode.ForRead);
                    if (grp.GetType() == typeof(ProfileDataBandLabelGroup))
                    {
                        foreach (LabelGroupSubEntity subent in grp.SubEntities)
                        {
                            double station = Double.NaN;
                            double elevation = Double.NaN;
                            pv.FindStationAndElevationAtXY(subent.AnchorInfo.Location.X, subent.AnchorInfo.Location.Y, ref station, ref elevation);
                        }
                    }
                }
                tr.Commit();
            }

 

Jeff_M, also a frequent Swamper
Distinguished Mentor
Civil3DReminders
Posts: 909
Registered: ‎03-24-2009
Message 3 of 3 (253 Views)

Re: Profile Data Band Label Group

04-08-2012 06:28 PM in reply to: Jeff_M

Yes and no. It works if my labels are not staggered. Unfortunatley my labels are staggered so they won't be a the point being labeled.

 

Christopher

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.