- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i want to add all alignments to baseline, it is works for one alignment as per below code;
but i want to loop through all the alignments.
Using ts As Transaction = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction()
Dim _civildoc = CivilApplication.ActiveDocument()
Dim corridorName As String = "Corridor - (1)"
Dim corridor As Corridor = TryCast(ts.GetObject(_civildoc.CorridorCollection(corridorName), OpenMode.ForWrite), Corridor)
Dim alignmentId As ObjectId = _civildoc.GetAlignmentIds()(0)
Dim Alignment As Alignment = TryCast(ts.GetObject(alignmentId, OpenMode.ForRead), Alignment)
Dim alignmentname As String = Alignment.Name.ToString
Dim profileId As ObjectId = Alignment.GetProfileIds()(0)
Dim Baseline As Baseline = corridor.Baselines.Add("New Baseline" & alignmentname, alignmentId, profileId)
ts.Commit()
End Using
but when i try this for all alignments it getting error; "duplicate baseline"
can any one help me in the below code..?
For Each alignmentId As ObjectId In alignColl
Dim Alignment As Alignment = TryCast(ts.GetObject(alignmentId, OpenMode.ForRead), Alignment)
Dim alignmentname As String = Alignment.Name.ToString
Dim profileIds As ObjectIdCollection = Alignment.GetProfileIds()
For Each profileId In profileIds
Dim Baseline As Baseline = corridor.Baselines.Add("New Baseline" & alignmentname, alignmentId, profileId)
Next
Next
Solved! Go to Solution.
Link copied