public static ProfileViewBandSet ByName(Autodesk.AutoCAD.DynamoNodes.Document document, string labelStyleName)
        {
            ProfileViewBandSet retLabel;
            Database           db = document.AcDocument.Database;
            ProfileViewBandSetStyleCollection bandRoot = CivilDocument.GetCivilDocument(db).Styles.ProfileViewBandSetStyles;

            using (Transaction trans = db.TransactionManager.StartTransaction())
            {
                retLabel = new ProfileViewBandSet(trans.GetObject(bandRoot[labelStyleName], OpenMode.ForRead), false);
                trans.Commit();
            }
            return(retLabel);
        }
        public static List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet> GetProfileViewBandSets(Autodesk.AutoCAD.DynamoNodes.Document document)
        {
            List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet> alignmentLabels = new List <CivilDynamoTools.LabelStyles.ProfileViews.ProfileViewBandSet>();
            Database db = document.AcDocument.Database;
            ProfileViewBandSetStyleCollection bandRoot = CivilDocument.GetCivilDocument(db).Styles.ProfileViewBandSetStyles;

            foreach (ObjectId setStyle in bandRoot)
            {
                using (Transaction trans = db.TransactionManager.StartTransaction())
                {
                    ProfileViewBandSet labelSet = new ProfileViewBandSet(trans.GetObject(setStyle, OpenMode.ForRead), false);
                    alignmentLabels.Add(labelSet);
                    trans.Commit();
                }
            }
            return(alignmentLabels);
        }
Example #3
0
        getProfileViewBandSetStyle()
        {
            ObjectId idBandStyle = ObjectId.Null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDb())
                {
                    ProfileViewBandSetStyleCollection styles = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles;
                    idBandStyle = styles[0];
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 333", ex.Message));
            }
            return(idBandStyle);
        }
Example #4
0
 getProfileViewBandSetStyle(string name)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDb())
         {
             ProfileViewBandSetStyleCollection styles = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles;
             if (styles.Contains(name))
             {
                 return(styles[name]);
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 333", ex.Message));
     }
     return(ObjectId.Null);
 }
Example #5
0
        CreateProfileViewBandSetStyle(string name)
        {
            string PROFILEVIEW_BANDSET_STYLE_NAME      = name;
            string PROFILEVIEW_PROFILE_BAND_STYLE_NAME = name;

            ObjectId idPVBandSetStyle = ObjectId.Null;

            ProfileViewBandSetStyleCollection pvBandSetStyleCol = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles;

            try{
                idPVBandSetStyle = pvBandSetStyleCol[PROFILEVIEW_BANDSET_STYLE_NAME];
            }
            catch {}

            if (!idPVBandSetStyle.IsNull)
            {
                return(idPVBandSetStyle);
            }

            idPVBandSetStyle = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles.Add(PROFILEVIEW_BANDSET_STYLE_NAME);

            using (var tr = BaseObjs.startTransactionDb()){
                ProfileViewBandSetStyle pvBandSetStyle = (ProfileViewBandSetStyle)tr.GetObject(idPVBandSetStyle, OpenMode.ForWrite);
                ObjectId id = ObjectId.Null;

                try{
                    id = BaseObjs._civDoc.Styles.BandStyles.ProfileViewProfileDataBandStyles[PROFILEVIEW_PROFILE_BAND_STYLE_NAME];
                }
                catch {}

                if (!id.IsNull)
                {
                    return(idPVBandSetStyle);
                }

                id = BaseObjs._civDoc.Styles.BandStyles.ProfileViewProfileDataBandStyles.Add(PROFILEVIEW_PROFILE_BAND_STYLE_NAME);
                ProfileDataBandStyle pDataBandStyle = (ProfileDataBandStyle)tr.GetObject(id, OpenMode.ForWrite);

                DisplayStyle displayStyle = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.LabelsAtVGP);
                displayStyle.Visible = true;

                displayStyle         = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TicksAtHGP);
                displayStyle.Color   = clr.red;
                displayStyle.Visible = true;

                id = pDataBandStyle.HGPLabelStyleId;
                LabelStyle labelStyle = (LabelStyle)tr.GetObject(id, OpenMode.ForWrite);

                ObjectIdCollection ids = labelStyle.GetComponents(LabelStyleComponentType.Text);
                id = ids[0];

                LabelStyleTextComponent labelStyleText = (LabelStyleTextComponent)tr.GetObject(id, OpenMode.ForWrite);
                labelStyleText.Text.Contents.Value = "<[Station Value(Uft|FS|P0|RN|AP|Sn|TP|B2|EN|W0|OF)]>";
                labelStyleText.Text.Color.Value    = clr.c11;

                displayStyle          = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TitleBox);
                displayStyle.Color    = clr.red;
                displayStyle.Linetype = "ByBlock";
                displayStyle.Visible  = true;

                displayStyle         = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TitleBoxText);
                displayStyle.Color   = clr.grn;
                displayStyle.Visible = true;

                id         = pDataBandStyle.TitleTextLabelStyleId;
                labelStyle = (LabelStyle)tr.GetObject(id, OpenMode.ForWrite);

                ids            = labelStyle.GetComponents(LabelStyleComponentType.Text);
                id             = ids[0];
                labelStyleText = (LabelStyleTextComponent)tr.GetObject(id, OpenMode.ForWrite);
                labelStyleText.Text.Contents.Value = "Profile Data: XX";
                labelStyleText.Text.Height.Value   = 0.09;

                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MajorStationLabel).Visible        = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MajorTicks).Visible               = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MinorStationLabel).Visible        = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MinorTicks).Visible               = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TicksAtVGP).Visible               = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TicksAtStationEquations).Visible  = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.LabelsAtVGP).Visible              = false;
                pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.LabelsAtStationEquations).Visible = false;

                pvBandSetStyle.GetBottomBandSetItems().Add(BaseObjs._db, Autodesk.Civil.BandType.ProfileData, PROFILEVIEW_PROFILE_BAND_STYLE_NAME);
            }



            return(idPVBandSetStyle);
        }