Hi,
I have an issue with set point control with an Alignment that came from the Ref file. But if the Alignment is in the same file with the corridor then I work fine otherwise it crashes the ORD.
Please see the code below. Is there another way to make it or how can I fix the issue:
Get ALignment class:
public static List<Alignment> GetAlignments() { Dictionary<string, Alignment> alignmentDictionary = new Dictionary<string, Alignment>(); BentleyCifNETSDK.ConsensusConnection sdkConnection = Bentley.CifNET.SDK.Edit.ConsensusConnectionEdit.GetActive(); List<GeometricModel> models = sdkConnection.GetAllGeometricModels().ToList(); foreach (GeometricModel geoModel in models) { foreach (Alignment alignment in geoModel.Alignments) { if (!alignmentDictionary.ContainsKey(alignment.Name)) { if (alignment.IsFinalElement && alignment.Name != string.Empty) { string featureName = alignment.FeatureName; alignmentDictionary.Add(alignment.Name, alignment); } } } } List<Alignment> alignments = new List<Alignment>(); foreach (KeyValuePair<string, Alignment> kvp in alignmentDictionary) { alignments.Add(kvp.Value); } return alignments; }
main code
List<Alignment> AlignCol2 = GetData.GetAlignments(); foreach (Alignment align in AlignCol2) { if(align.Name == "GeomBL1") { editCr.CorridorEdit corEdit = (editCr.CorridorEdit)cor; editCr.PointControlParameter pointControl = new editCr.PointControlParameter(align, align.ActiveProfile, 0.0000000001, cor.CorridorAlignment.LinearGeometry.Length, PointControlMode.Both, PointControlType.Alignment); pointControl.PointName = "TP4"; corEdit.AddPointControl(pointControl); } }
for example: if Alignment GeomBL1 is in the same file as the corridor. the code work but if it in the ref file it crashes.
Thanks,
Jason