Skip to main content

Tutorial - Civil 3D

info

Level: Intermediate
Time: 30–45 min

Prerequisites:

  • You have a VIKTOR account. No account? Get one here.
  • You have Civil 3D installed and licensed on a Windows computer.
  • You can install VIKTOR Desktop on that computer and open a writable Civil 3D drawing.
  • Introduction​

    Welcome to this tutorial on how to create VIKTOR apps that work directly in Civil 3D!

    Road geometry often changes during a project. Instead of repeating the same drawing operations, you can describe a workflow in the VIKTOR App Builder, adjust a few inputs, and create native Civil 3D objects in your open drawing. In this tutorial, you will explore three workflows:

    1. Create a road alignment and set-out points.
    2. Create an existing-ground longitudinal profile.
    3. Create three cross sections.
    Prefer writing Python?

    If you're comfortable with Python and want to build the app yourself, select the Local development tab under Choose your approach. You'll build a simple longitudinal-profile app step by step. Complete the Civil 3D and VIKTOR Desktop setup below first, as it applies to both approaches.

    1. Set up Civil 3D and VIKTOR Desktop​

    The apps use a personal worker to connect VIKTOR to Civil 3D on your Windows computer. Check the VIKTOR Desktop requirements, then download and install VIKTOR Desktop and log in with your VIKTOR account.

    In VIKTOR Desktop, click Add, choose Civil 3D, and start the worker. Follow the Civil 3D worker installation steps for the complete setup. The worker and Civil 3D must run on the same computer, under the same Windows user, in a logged-in desktop session. You do not need to install Python on the worker computer.

    Select Civil 3D in the Add worker window:

    Civil 3D highlighted in the VIKTOR Desktop Add worker window

    After starting the worker, check that its status is Running:

    Civil 3D personal worker with Running status in VIKTOR Desktop

    Before running either app:

    1. Open Civil 3D and a copy of the drawing you want to work with.
    2. Use a metric drawing for these examples and set the worker's units to metric.
    3. Make sure the drawing is writable and Model Space is active.
    4. Close any dialogs and finish active commands so Civil 3D is idle.
    5. Check that the Civil 3D worker is running in VIKTOR Desktop.
    note

    These apps change the drawing that is already open. Test on a copy, review the result, and save it yourself in Civil 3D. Closing a connection does not undo drawing changes.

    2. Understand the key concepts​

    Although you can get quite far with a clear prompt, a little context helps you choose the right inputs:

    • Personal worker: the connection between the VIKTOR app and Civil 3D on your computer. The app uses vkt.civil3d.attach() to reach the instance that is already open.
    • Alignment and station: an alignment describes a route in plan. A station is a distance measured along that route, so you can identify where a point or section belongs.
    • COGO points: Civil 3D survey points with coordinates and descriptions. Set-out points help locate the route on site. E/N/Z means easting, northing, and elevation.
    • PI, PC, and PT: the intersection of two tangents, the start of a circular curve, and the end of that curve.
    • Surface and profile: a surface represents terrain. An existing-ground profile shows its elevation along an alignment; a profile view displays that information on a grid.
    • Sample lines and cross sections: sample lines cut across an alignment at selected stations. Sections show the sampled terrain to the left and right, and section views display those cuts in the drawing.
    • Styles: drawing settings that control how Civil 3D objects and labels look. The profile and cross-section apps inspect your drawing so you can choose styles that already exist.
    note

    You can also use vkt.civil3d.connect() to start a new Civil 3D instance, do the work, and close it when the session ends. This tutorial uses attach() to keep the drawing open so you can review and save it yourself. Both methods are BETA and require viktor >= 14.36.0.

    3. Choose your approach​

    Use the Prompt guide to generate an app with the App Builder, or Local development to build a small longitudinal-profile app step by step. Both approaches use the Desktop and worker setup above.

    Explore Civil 3D workflows with prompts​

    Select the arrow to open a prompt in the VIKTOR App Builder. Review the generated app and its preview before running an action that changes your drawing. The screenshots show example results; your app's layout may differ.

    Prompt 1: Create a road alignment and set-out points​

    Let's start with a road alignment. This workflow is useful when you want to explore a route from a few geometric inputs and check its set-out coordinates before adding anything to Civil 3D. Enter the starting coordinates, bearing, and tangent and curve values, then review the alignment preview and point table.

    Road alignment and set-out points

    Once the App Builder finishes, adjust the inputs and inspect the curve geometry and point coordinates in VIKTOR. This lets you catch an unexpected bearing or radius before writing to the drawing.

    VIKTOR alignment preview and inputs before creating Civil 3D objects

    When the preview looks right, run the creation action. In Civil 3D, inspect the native alignment, point labels, and polyline connecting the set-out points. Check the app's verification results before saving the drawing.

    Native Civil 3D road alignment and set-out points beside the generated VIKTOR app

    tip

    Ask the App Builder to add an Excel export of the point table or checks for your project's minimum curve radius. Keep the preview separate from the drawing action so you can compare alternatives before creating objects.

    Prepare a drawing for prompts 2 and 3​

    For the next two prompts, download and open the sample Civil 3D drawing in Civil 3D. You can also use your own metric drawing with an existing alignment and a terrain surface covering the stations and sampling widths you want to use. It should contain the profile, sample-line, section, view, group-plot, and band-set styles requested by the apps. Work on a copy and inspect the available objects and styles before creating a result.

    The sample drawing contains a road layout and terrain surface. The following apps read those existing objects; you do not need to run prompt 1 first.

    Sample Civil 3D drawing with road alignments and terrain contours

    Prompt 2: Create an existing-ground longitudinal profile​

    The second workflow shows how the terrain changes along a road. This is useful for reviewing existing ground levels before developing a vertical design. Instead of entering elevations manually, the app samples an existing surface along your chosen alignment and creates a native dynamic profile and profile view.

    Existing-ground longitudinal profile

    With the sample drawing or your own model open, click Inspect open drawing. Select the alignment and existing-ground surface, then choose the styles, names, layer, and insertion coordinates. Place the profile view in an empty area of Model Space so it does not overlap your plan.

    Civil 3D longitudinal-profile app with alignment, surface, and style selections

    Run the creation action and review the app's verification results. In Civil 3D, locate the profile view and check that its station range and ground elevations match the alignment and surface you selected.

    Native existing-ground profile view in Civil 3D and verification results in VIKTOR

    tip

    Extend the app to compare existing-ground profiles from different surfaces, or flag steep stretches for review. Ask it to use your office's profile-view and band styles for consistent presentation across projects.

    Prompt 3: Create three cross sections​

    The third workflow looks across the road instead of along it. Cross sections help you review terrain on both sides of an alignment at selected locations. Using the same sample drawing, the app creates three native section views from your station range and sampling widths.

    Three native cross sections

    Click Inspect open drawing, select the alignment and surface, and choose the station range and sampling widths. Review the three proposed stations before creating the sections. Make sure the surface extends far enough on both sides of the alignment to cover your sampling widths.

    After creation, inspect all three section views in Model Space and check their station labels and terrain lines. If the app reports a missing view, retry with the same naming prefix so it can reuse verified objects instead of duplicating completed work.

    Three native Civil 3D cross-section views beside the generated VIKTOR app

    tip

    Ask the App Builder to let you choose the number of sections or enter specific stations, such as junctions and terrain transitions. You can also request a consistent view spacing and naming convention to make the results easier to review.

    Limitations of the Civil 3D integration​

    The integration works through Civil 3D's automation interface, so not every action available in the desktop interface is available to the app. See the Civil 3D integration guide for the supported approach and troubleshooting guidance.

    • Civil 3D must be open in a logged-in Windows session, with the correct drawing active and no blocking dialogs or commands.
    • These prompts create real drawing objects. A failed operation may still have created an object, which is why the apps reconnect and verify before retrying.
    • The worker does not allow operations such as SendCommand, SetVariable, or Save. Review and save the drawing yourself in Civil 3D.
    • Generated geometry is not an engineering design check. Verify coordinates, units, terrain coverage, and project requirements before using the results.

    To infinity and beyond!​

    Well done! You now have three starting points for creating road alignments, set-out points, longitudinal profiles, and cross sections from a VIKTOR app.

    Try adapting the inputs and drawing styles to your own workflow. Continue with the AutoCAD tutorial to explore other drawing tasks, or check out our other tutorials.