Is there an API for Corridor Transition ?

Hi.

I am writing ORD CE 2021 third party using C#.

I need to add Transition to Corridor. But I can not find any c# API for Corridor Transition.

How can I add Transition to Corridor using c# API?

Thank you.

  • You can follow these steps:

    First, make sure you have the necessary references in your project. You will need to reference the AeccDbMgd and AeccRoadwayMgd libraries.

    These can be found in the Civil 3D installation directory, typically located at C:\Program Files\Autodesk\AutoCAD 20XX\C3D\bin.

    Import the required namespaces in your C# code file:

    using Autodesk.Civil;

    using Autodesk.Civil.DatabaseServices;

    Get a reference to the corridor you want to add the transition to.

    You can use the corridor's name or other properties to locate it:

    using (Transaction transaction = civilDocument.TransactionManager.StartTransaction()) { Corridor corridor = transaction.GetObject(corridorId, OpenMode.ForWrite) as Corridor; if (corridor != null) { // Add the transition to the corridor Transition transition = new Transition(corridor); // Set transition properties (e.g., start station, end station, etc.) transition.StartStation = startStation; transition.EndStation = endStation; // Add the transition to the corridor corridor.Transitions.Add(transition); transaction.Commit(); } }

    In the above code, civilDocument represents the Civil 3D document you are working with, and corridorId is the ObjectId of the corridor you want to modify. startStation and endStation represent the start and end stations of the transition, respectively. Adjust these values according to your specific corridor configuration. Ensure that you wrap the code within a transaction to maintain data integrity. Remember to handle exceptions and dispose of the transaction appropriately to prevent memory leaks.

    Please note that the code provided is a general example, and you may need to adapt it based on your specific requirements and the structure of your code. Additionally, make sure you have the appropriate permissions and access rights to modify the corridor data. You can also read this article about API, it may be useful for you.

  • Regards

    Chris


    AECOM Roads UK&I Digital Engineering, Design & Solutions Lead | Sector Information Management Lead

    Associate Director – Digital

    OpenRoads Designer 10.12 | MicroStation 2023 | ProjectWise CE 10.3.4 | ContextCapture | ProjectWise PowerShell 2023 | ProjectWise WSG API | Generative Components | OpenBridge Designer 10.12

    Civil 3D 2023 | Dynamo | Navisworks Manage

    PowerShell | Visual Studio | Office 365 | Power Platform | Teams | SharePoint | Visio

    Speckle | BIMVision | Revizto | Solibri