getProfileLabelSetStyle(string name) { ObjectId idStyle = ObjectId.Null; try { using (Transaction tr = BaseObjs.startTransactionDb()) { ProfileLabelSetStyleCollection styles = BaseObjs._civDoc.Styles.LabelSetStyles.ProfileLabelSetStyles; if (styles.Contains(name)) { idStyle = styles[name]; } else { idStyle = CreateProfileLabelSetStyle(name); } tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 230", ex.Message)); } return(idStyle); }
addProfileBySurface(string nameProfile, Alignment align, TinSurface surf, string nameLayer, string nameLabelSet) { ObjectId id = ObjectId.Null; CivilDocument civDoc = BaseObjs._civDoc; ObjectId idAlign = ObjectId.Null; ObjectId idSurf = ObjectId.Null; ObjectId idLayer = ObjectId.Null; ObjectId idStyle = ObjectId.Null; ObjectId idLabel = ObjectId.Null; Profile profile = null; try { using (Transaction tr = BaseObjs.startTransactionDb()) { idAlign = align.Id; idSurf = surf.ObjectId; idLayer = Layer.manageLayers(nameLayer); try { ProfileStyleCollection idStyles = civDoc.Styles.ProfileStyles; if (idStyles.Contains(nameProfile)) { idStyle = idStyles[nameProfile]; } else { idStyle = idStyles["Standard"]; } ProfileLabelSetStyleCollection idLabelStyles = civDoc.Styles.LabelSetStyles.ProfileLabelSetStyles; if (idLabelStyles.Contains(nameLabelSet)) { idLabel = idLabelStyles[nameLabelSet]; } else { idLabel = idLabelStyles["Standard"]; } try { id = Profile.CreateFromSurface(nameProfile, idAlign, idSurf, idLayer, idStyle, idLabel); } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof.cs: line: 91", ex.Message)); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof.cs: line: 95", ex.Message)); } profile = (Profile)tr.GetObject(id, OpenMode.ForWrite); tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof.cs: line: 102", ex.Message)); } return(profile); }