I am having issues trying to figure out how to scan reference attachments for Civil data, like Alignments. There is nothing I can find in the examples or any of the (limited) documentation.
Does anyone have a snippet they can share that does this? I can scan references using Microstation methods, just confused on how the ConsensusConnectionEdit/GeometricModel methods interact with this.
Here's a method we use, it will return a list of alignment objects of all alignments in the active model and reference models (note: the reference model needs to be visible to find alignments in the reference).
We are only looking for baseline & centerline alignments. Hope this helps.
public static List<Alignment> GetAlignments()
Dictionary<string, Alignment> alignmentDictionary = new Dictionary<string, Alignment>();
//Get all the civil models in the current dgn model
BentleyCifNETSDK.ConsensusConnection sdkConnection = new BentleyCifNETSDK.ConsensusConnection(Session.Instance.GetActiveDgnModel());
List<GeometricModel> models = sdkConnection.GetAllGeometricModels().ToList();
foreach (GeometricModel geoModel in models)
foreach (Alignment alignment in geoModel.Alignments)
if (alignment.IsFinalElement && alignment.Name != string.Empty)
string featureName = alignment.FeatureName;
//be sure alignment has not already been added from a different model and is either a baseline or centerline
if (featureName.ToLower() == "alignment\\baseline" || featureName.ToLower() == "alignment\\centerline")
List<Alignment> alignments = new List<Alignment>();
foreach (KeyValuePair<string, Alignment> kvp in alignmentDictionary)
Answer Verified By: Mark Shamoun
Hi Mike Robertson,
I tried to use your code snippet to use collect the Alignment from the reference file and assigning it to point control in a corridor. but it does not work
editCr.CorridorEdit coredit = (editCr.CorridorEdit)cor;
var profilese = AlignCol2[index].ActiveProfile;
editCr.PointControlParameter pointControl = new editCr.PointControlParameter(AlignCol2[index], profilese, 0, cor.CorridorAlignment.LinearGeometry.Length, PointControlMode.Both, PointControlType.Alignment);
pointControl.PointName = tableData.Rows[i]["Point"].ToString();
editCr.PointControlEdit addpoint = coredit.AddPointControl(pointControl);
when I run the code it work to create new pointcontrol, but under point control did not apply the alignment to the plan Element.
I am using Openroad Designer 10.09.0.91
The original question was how to scan a reference for Alignments. Your question is about point control, you need to start a new thread if you haven't figured it out yet.