AutoCAD Civil 3D 2011 Developer S Guide
AutoCAD Civil 3D 2011 Developer S Guide
AutoCAD Civil 3D 2011 Developer S Guide
Developer’s Guide
April 2010
© 2010 Autodesk, Inc. All Rights Reserved. Except as otherwise permitted by Autodesk, Inc., this publication, or parts thereof, may not be
reproduced in any form, by any method, for any purpose.
Certain materials included in this publication are reprinted with the permission of the copyright holder.
Trademarks
The following are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and other countries:
3DEC (design/logo), 3December, 3December.com, 3ds Max, Algor, Alias, Alias (swirl design/logo), AliasStudio, Alias|Wavefront (design/logo),
ATC, AUGI, AutoCAD, AutoCAD Learning Assistance, AutoCAD LT, AutoCAD Simulator, AutoCAD SQL Extension, AutoCAD SQL Interface,
Autodesk, Autodesk Envision, Autodesk Intent, Autodesk Inventor, Autodesk Map, Autodesk MapGuide, Autodesk Streamline, AutoLISP, AutoSnap,
AutoSketch, AutoTrack, Backburner, Backdraft, Built with ObjectARX (logo), Burn, Buzzsaw, CAiCE, Civil 3D, Cleaner, Cleaner Central, ClearScale,
Colour Warper, Combustion, Communication Specification, Constructware, Content Explorer, Dancing Baby (image), DesignCenter, Design
Doctor, Designer's Toolkit, DesignKids, DesignProf, DesignServer, DesignStudio, Design Web Format, Discreet, DWF, DWG, DWG (logo), DWG
Extreme, DWG TrueConvert, DWG TrueView, DXF, Ecotect, Exposure, Extending the Design Team, Face Robot, FBX, Fempro, Fire, Flame, Flare,
Flint, FMDesktop, Freewheel, GDX Driver, Green Building Studio, Heads-up Design, Heidi, HumanIK, IDEA Server, i-drop, ImageModeler, iMOUT,
Incinerator, Inferno, Inventor, Inventor LT, Kaydara, Kaydara (design/logo), Kynapse, Kynogon, LandXplorer, Lustre, MatchMover, Maya,
Mechanical Desktop, Moldflow, Moonbox, MotionBuilder, Movimento, MPA, MPA (design/logo), Moldflow Plastics Advisers, MPI, Moldflow
Plastics Insight, MPX, MPX (design/logo), Moldflow Plastics Xpert, Mudbox, Multi-Master Editing, Navisworks, ObjectARX, ObjectDBX, Open
Reality, Opticore, Opticore Opus, Pipeplus, PolarSnap, PortfolioWall, Powered with Autodesk Technology, Productstream, ProjectPoint, ProMaterials,
RasterDWG, RealDWG, Real-time Roto, Recognize, Render Queue, Retimer,Reveal, Revit, Showcase, ShowMotion, SketchBook, Smoke, Softimage,
Softimage|XSI (design/logo), Sparks, SteeringWheels, Stitcher, Stone, StudioTools, ToolClip, Topobase, Toxik, TrustedDWG, ViewCube, Visual,
Visual LISP, Volo, Vtour, Wire, Wiretap, WiretapCentral, XSI, and XSI (design/logo).
All other brand names, product names or trademarks belong to their respective holders.
Disclaimer
THIS PUBLICATION AND THE INFORMATION CONTAINED HEREIN IS MADE AVAILABLE BY AUTODESK, INC. "AS IS." AUTODESK, INC. DISCLAIMS
ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
FITNESS FOR A PARTICULAR PURPOSE REGARDING THESE MATERIALS.
Published By:
Autodesk, Inc.
111 Mclnnis Parkway
San Rafael, CA 94903, USA
Contents
iii
Using Property Fields in Label Style Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Sharing Syles Between Drawings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Chapter 4 Survey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Obtaining Survey-Specific Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Changing Survey-Specific Ambient Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Changing Survey User Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Using the Equipment Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Creating a Survey Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Adjusting Survey Project Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Accessing Extended Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Survey Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Creating a Survey Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Adding Control Points to a Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Adding Directions to a Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Adding Setups to a Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Adding Non-control Points to a Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Creating Paths for Traverse Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Adding Survey Data to the Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Getting Survey Network Drawing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Creating a Figure Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Adding Lines to a Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Adding Arcs to a Figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Adding Figures to the Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Figures and AutoCAD Civil 3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Creating a Figure Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Using the Figure Prefix Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Chapter 5 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Using the Points Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Accessing Points in a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Using Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Point User-Defined Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Creating Point Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Creating Point Label Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Using Point Description Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Point Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
iv | Contents
Creating Point Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Adding Points to a Point Group Using QueryBuilder . . . . . . . . . . . . . . . . . . . . . . . . 54
Using Point Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Chapter 6 Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Using the Surfaces Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Creating a Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Creating a Surface From a LandXML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Creating a TIN Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Creating a Grid Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Creating a Volume Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Working with Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Adding a Boundary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Adding Data from DEM Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Improving Performance By Using Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Finding Intersections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Working with TIN Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Adding Point Data to a TIN Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Adding Points Using Point Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Adding Points Using Point Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Adding a Breakline to a TIN Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Adding a Standard Breakline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Adding a Proximity Breakline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Adding a Non-destructive Breakline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Adding a Wall Breakline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Importing Breaklines from a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Adding Contours to a TIN Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Extracting Contours from a TIN Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Surface Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Creating a Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Changing a Surface Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Assigning a Style to a Surface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Performing Surface Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Creating an Elevation Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Creating a Watershed Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Contents | v
Defining an Alignment Path Using Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Determining Entities Within an Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Modifying Stations with Station Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Creating Station Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Specifying Design Speeds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
Superelevation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Alignment Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Creating an Alignment Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Alignment Label Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
vi | Contents
Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Contents | vii
Performing an Interference Check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Listing the Interferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Interference Check Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
viii | Contents
Corridors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Corridor Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Listing Corridors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Creating Corridors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Listing Baselines in a Corridor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Adding a Baseline to a Corridor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Listing Baseline Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
Accessing and Modifying Baseline Stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Listing Offset Baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Assemblies and Subassemblies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Listing Applied Assemblies in a Baseline Region . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Getting Applied Subassembly Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Feature Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Listing Feature Lines Along a Baseline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Listing Feature Lines Along Offset Baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Corridor Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Listing Corridor Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Listing Surface Boundaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Computing Cut and Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Assembly Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Link Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Shape Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Roadway Style Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Contents | ix
Roadway Style Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
x | Contents
About the Developer's
Guide
Intended Audience
The AutoCAD Civil 3D API Developer’s Guide is designed for developers who want to customize AutoCAD®
AutoCAD Civil 3D® or create applications using the underlying APIs. It can also be used for creating macros
to automate repetitive tasks for AutoCAD Civil 3D users and for developers of custom subassemblies.
■ COM API — you can create clients that access the COM API from managed (.NET) or unmanaged (C++)
code. See Creating Client Applications (page 277). In addition, this API can be used in the Visual Basic for
Applications (VBA) IDE, which is available as a separate download. VBA support is deprecated.
■ .NET API — allows you to write extensions to AutoCAD Civil 3D in any .NET language. In general, the
AutoCAD Civil 3D.NET API performs significantly faster than the COM API. Development requires
Microsoft Visual Studio 2008 SP1 or better.
■ Custom Draw API (in C++) — an extension of the AutoCAD ObjectARX API that allows you to customize
the way AutoCAD Civil 3D renders objects. Development requires Microsoft Visual Studio.
The COM and .NET APIs are described in this guide. For more information about the Custom Draw API, see
the Custom Draw API Reference (civildraw-reference.chm).
In addition, an API is provided for creating custom subassemblies in .NET. See Creating Custom Subassemblies
Using .NET (page 193).
Which API you choose to use depends on what you want to do:
Customize the way objects are rendered the Custom Draw API. The Custom Draw
in AutoCAD Civil 3D API is an extension of the AutoCAD Ob-
jectARX API. For example, if you wanted
1
If you want to: Use:
to number the triangles on a TIN surface,
you could create a DLL using the Custom
Draw API. See the sample applications
shipped with AutoCAD Civil 3D for an ex-
ample.
Customize the AutoCAD Civil 3D UI, for ObjectARX base UI classes, and either COM
example create pallets or menus or .NET APIs to access AutoCAD Civil 3D-
specific objects.
NOTE Where possible, you should use the Civil .NET API instead of the COM API, especially for longer operations,
as the .NET API is a thin layer to Civil objects and has better performance. However, the COM API is more mature
and has more functionality. You may find you need to use the COM object to access some functionality or object
members that are not yet exposed by the .NET API. In this case it's possible to use both. See Limitations and Using
Interop (page 11) .
Organization
This guide is organized by the major features of AutoCAD Civil 3D. It consists of the following chapters,
each of which includes samples from applicable APIs taken from one or more demonstration programs:
Organization | 3
Chapter 18: Creating Custom Subassemblies Using .NET (page 193)
Explains how to create and install custom subassemblies using Visual Basic .NET and the creation of catalog
files which enables users to access custom subassemblies. You can also convert subassemblies written in VBA
to .NET (see the Appendix Converting VBA Subassemblies to .NET (page 267) for more information).
Also see the AutoCAD Civil 3D .NET API Reference for detailed information about these new APIs, and items
that have been deprecated in this release.
NOTE VBA support is not included with AutoCAD Civil 3D by default, and must be obtained as a separate download.
■ VBAMAN - Displays a dialog box allowing you to load, unload, edit, embed, extract, edit, and save copies
of VBA applications.
■ VBARUN - Displays a dialog box where you can choose a macro to run from all the available subroutines.
■ VBALOAD - Loads a global VBA project into the current work session. After entering this instruction, you
are presented with a file selection dialog box.
■ -VBALOAD <full path and filename> - Loads a particular project from the command line. If the path contains
spaces, you need to type quotes around the path and filename string.
■ VBAUNLOAD - Unloads an existing VBA project. After entering this instruction, you are prompted to
type in the full path and filename of the project. If the path contains spaces, you need to type quotes
around the path and filename string.
■ VBASTMT - Executes a VBA statement on the command line. A statement generally occupies a single
line, although you can use a colon (:) to include more than one statement on a line. VBA statements are
executed in the context of the current drawing.
VBA projects are usually stored in separate .dvb files, which allow macros to interact with many separate
AutoCAD Civil 3D drawings.
5
Setting up a .NET Project for AutoCAD Civil 3D
This section describes the basic steps to set up a .NET solution using Visual Studio and the AutoCAD Civil
3D managed classes. The steps are the similar whether you use Microsoft Visual C# .NET or Visual Basic
.NET. The example below uses C# in Visual Studio 2008. Express (free) versions of Visual Studio may look
slightly different, but can also be used.
To create a new project that uses the AutoCAD Civil 3D managed classes in Microsoft Visual Studio
1 In Visual Studio .NET, create a new class library solution and project.
2 Select Project menu ➤ Add References, or right-click References in the Solution Explorer and select
Add References.
3 Browse to the install directory for AutoCAD Civil 3D, and select the base libraries acdbmgd.dll, acmgd.dll,
AecBaseMgd.dll, and AeccDbMgd.dll.
NOTE These are the base AutoCAD and AutoCAD Civil 3D managed libraries. Your .NET assembly can use
classes defined in additional libraries.
To allow debugging and reduce the disk space requirements for your projects, select these libraries in
the Visual Studio Solution Explorer, and set the Copy Local property to False.
4 Optionally, you can configure your project to start AutoCAD Civil 3D when you run the application
from Visual Studio, which is useful for debugging.
NOTE This option is not avaiable in Express (free) versions of Visual Studio.
2 Under Start Action, choose Start external program, and enter the path to the acad.exe executable
in the AutoCAD Civil 3D directory.
4 Under Start Options, fill in the Working directory, for example: C:\Program Files\AutoCAD Civil
3D 2011\UserDataCache\
5 Implement the IExtensionApplication interface in your main class. Add the Autodesk.AutoCAD.Runtime
namespace (which is where this interface is defined), and IExtensionApplication after your class
definition: Visual Studio will provide a code complete option to implement stubs for the interface. Your
code should now look like this:
using System;
using Autodesk.AutoCAD.Runtime;
namespace GettingStarted
{
public class Class1 : IExtensionApplication
{
#region IExtensionApplication Members
#endregion
}
}
You can remove or comment out the default content of these methods. Initialize() is called when
your assembly is first loaded by a NETLOAD command in AutoCAD Civil 3D, and can be used for setting
up resources, reading configuration files, and other initialization tasks. Terminate() is called when
AutoCAD Civil 3D shuts down (there is no NETUNLOAD command to unload .NET assemblies), and
can be used for cleanup to free resources.
6 You are now ready to create a public method that is the target of a CommandMethod attribute. This attribute
defines the AutoCAD Civil 3D command that invokes the method. For example:
[CommandMethod("HelloWorld")]
public void HelloWorld()
{
7 Let’s make the method print out a “Hello World” message on the command line. Add the
Autodesk.AutoCAD.ApplicationServices namespace, and add this line to the HelloWorld() method:
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nHello World!\n");
You can now build the assembly and run it. Start AutoCAD Civil 3D, and type NETLOAD at the command
line. In the Choose .NET Assembly dialog, browse to your assembly DLL (if you are using the project
settings from step 1, this will be GettingStarted.dll). Type HELLOWORLD at the command line, and you
will see the command output:
}
Open or create a document in AutoCAD Civil 3D that contains alignments and sites. When you run
the HELLOWORLD command now, you should see output similar to this:
1 CMD - the command name is sent to the command line to execute. This is the recommended execution
type for both .NET and ARX commands.
2 .NET - a method name is located, via Reflection, in the assembly, and is executed directly. No attribute
flags are read and the code is always run in application context. (A command executed from the
command line runs in the drawing context by default). Therefore, code run as as a .NET execute type
must always be a static method, and must handle its own document locking.
NOTE It is safe to explicitly lock a document, even if the code might be run in document context.
To create a toolbox macro for a compiled command using the Toolbox Editor
6 For Execute Type, click the drop-down and select CMD or .NET.
NOTE CMD is the recommended execution type in most cases, because you do not need to explicitly handle
document locking. See the discussion above.
7 For Execute File, browse to the .NET assembly or ARX DLL that contains the command.
9 Optionally, enter a help file and help topic for the command.
After a command has been set up, it can be run by right-clicking it and clicking Execute.
Base Objects
The COM API requires that you access the AcadApplication object (via the ThisDrawing.Application object),
get the interface object for the AeccApplication object, and from that get the active document. In the .NET
There is a single root document object, CivilDocument, instead of four domain-specific root objects for Land,
Pipe, Roadway and Survey.
NOTE See the section Use Transactions with the Transaction Manager in the AutoCAD .NET Developer’s Guide for
more information about using the Transaction object to open and modify drawing database objects.
In the .NET API, objects that you get from collections are, in most cases, type ObjectId, which have to be
cast to their intended type using a Transaction object (returned by TransactionManager.StartTransaction()).
Here’s an example:
m_AligmentStyleId = m_doc.Styles.AlignmentStyles.Item(sStyleName)
oAlignmentStyle = m_trans.GetObject(m_AligmentStyleId, OpenMode.ForWrite) As AlignmentStyle
Styles
In the COM API, styles are held by the root document object. In the .NET API, they are located under
CivilDocument.Styles, which is an object of type StylesRoot and contains style objects inherited from
StyleBase. Getting and setting style attributes for StyleBase objects requires using a GetDisplayStyle*()
method rather than a property. Here’s an example from COM VBA:
oAlignmentStyle.ArrowDisplayStyle2d.Visible = False
oAlignmentStyle.ArrowDisplayStyle3d.Visible = False
' Display curves using violet.
oAlignmentStyle.CurveDisplayStyle2d.color = 200 ' violet
oAlignmentStyle.CurveDisplayStyle3d.color = 200 ' violet
oAlignmentStyle.CurveDisplayStyle2d.Visible = True
oAlignmentStyle.CurveDisplayStyle3d.Visible = True
Settings
In the COM API, settings are accessed through the AeccDatabase::Settings object, which contains properties
representing the settings object hierarchy. In the .NET API, you use a method to retrieve specific settings
objects, for example:
SettingsPipeNetwork oSettingsPipeNetwork = doc.Settings.GetFeatureSettings<SettingsPipeNet
work>() as SettingsPipeNetwork;
Properties
In the COM API, properties are usually simple built-in types, such as double, or types such as BSTR that map
to built-in VBA types such as String. In the .NET API, most properties are one of the Property* classes that
implement the IProperty interface. For these properties, you get or set the Value of the property. For example,
this code in COM:
oLabelStyleLineComponent.Visibility = True
NOTE There are a few other changes here: the Visibility property is renamed Visible, which has moved to
a sub-property of LabelStyleLineComponent called General.
■ Survey
■ Points
■ Surfaces
■ Sections
■ Data Bands
Settings | 11
In addition, there are some areas in implemented functionality that are not yet complete:
■ Corridors:
■ creating new corridors
If you require this functionality in your .NET project, you can use the corresponding COM objects.
3 On the COM tab, select the AutoCAD 2011 Type Library and the AutoCAD/ObjectDBX Common 18.0 Type
Library.
4 On the COM tab, selec the AEC Base 6.5 Application Library and the AEC Base 6.5 Object Library.
5 On the COM tab, select the required Autodesk Civil Engineering 8.0 libraries for the functionality you
require (for example, Land and UI Land for Alignments).
NOTE You may see warnings about types not being found in various Autodesk.AutoCAD.Interop namespaces
(warning type 1684). To disable these warnings, enter 1684 under Supress Warnings on the Build tab of the
project’s properties.
}
}
For more interoprability examples, see the CSharpClient and VbDotNetClient sample projects located in
<Install directory>\Sample\AutoCAD Civil 3D\COM\.
Object Hierarchy
15
This example demonstrates the process of accessing the AeccApplication and AeccDocument objects:
Dim oAcadApp As AcadApplication
Set oAcadApp = ThisDrawing.Application
' Specify the COM name of the object we want to access.
' Note that this always accesses the most recent version
' of AutoCAD Civil 3D installed.
Const sCivilAppName = "AeccXUiLand.AeccApplication.6.0"
Dim oCivilApp As AeccApplication
Set oCivilApp = oAcadApp.GetInterfaceObject(sCivilAppName)
This sample gets the objects from AutoCAD Civil 3D 2009. To gain access to the libraries of an older version,
use the version number of the desired libraries to the COM object name. For example, to make a program
that works with AutoCAD Civil 3D 2007, replace:
Const sCivilAppName = "AeccXUiLand.AeccApplication.4.0"
The application object contains references to all open documents in the AeccApplication.Documents
collection and the AeccApplication.ActiveDocument property. AeccDocument is inherited from the AutoCAD
object AcadDocument. See the AutoCAD ObjectARX documentation for information on all inherited methods
and properties.
If you attempt to add a new element with properties that match an already existing element, try to access
an item that does not exist, or remove an item that does not exist or is in use, an error will result. You should
trap the error and respond accordingly.
The AeccDatabase object also has an AddEvent() method, that lets you send an event to the Event Viewer
in the AutoCAD Civil 3D user interface:
Dim oAeccApp As AeccApplication
Set oAeccApp = ThisDrawing.Application.GetInterfaceObject("AeccXUiLand.AeccApplication.6.0")
oAeccApp.Init ThisDrawing.Application
Dim oDatabase As AeccDatabase
Set oDatabase = oAeccApp.ActiveDocument.Database
oDatabase.AddEvent aeccEventMessageError, "PipeLengthRule", "Parameter Bad"
Ambient Settings
This section explains the purpose and use of the document settings objects, and covers changing general
and specific settings.
Label Styles
This section explains common features of label styles. It covers creating a new label style object, defining a
label style, and using property fields in label style text strings. Details specific to each construct are covered
in the appropriate chapters.
Label Styles | 19
Object Hierarchy
When first created, the label style object is set according to the ambient settings. Because of this, a new label
style object may already contain features. If you are creating a new label style object, be sure to check for
such existing features or your style might contain unintended elements.
' Check to see if text components already exist in the
' collection. If any do, just modify the first text
' feature instead of making a new one.
Dim oLabelStyleTextComponent As AeccLabelStyleTextComponent
If (oLabelStyle.TextComponents.Count > 0) Then
Set oLabelStyleTextComponent = oLabelStyle _
.TextComponents.Item(0)
Else
Set oLabelStyleTextComponent = oLabelStyle _
.TextComponents.Add("New Text")
End If
The ambient settings also define which units are used. If you are creating an application designed to work
with different drawings, you should take ambient settings into account or labels may demonstrate unexpected
behavior in each document.
Valid property fields for each element are listed in the appropriate chapter.
Root Objects
This section explains how to acquire references to the base objects, which are required for all applications
using the .NET API. It also explains the uses of the application, document, and database objects and how to
use collections, which are commonly used throughout the .NET API. To help developers who are already
familiar with COM to migrate existing code to .NET, the differences between the two APIs are highlighted
with notes.
NOTE Unlike the COM API, CivilApplication does not inherit from the AutoCAD object
Autodesk.AutoCAD.ApplicationServices.Application. Therefore, if you need access to application-level
methods and properties (such as the collection of all open documents, information about the main window, etc.),
you need to access through the AutoCAD Application object. See the ObjectARX Managed Class Reference in the
ObjectARX SDK for information about this class.
23
Using Collections Within the Document Object
The document object not only contains collections of AutoCAD Civil 3D drawing elements (such as points
and alignments) but also objects that modify those elements (such as styles and label styles). Collections in
CivilDocument are ObjectID collections (Autodesk::AutoCAD::DatabaseServices::ObjectIdCollection)
for most objects. Objects in these collections must be retrieved with a Transaction.GetObject(), and cast
to their type before they can be used.
NOTE In the COM API, document objects are contained in collections of objects that do not need to be cast.
ObjectIdCollection objects implement the IList interface, and can be enumerated or accessed by index.
Here’s an example of iterating through the Corridor collection with foreach, and retrieving and casting the
resulting ObjectId to a Corridor to access its methods and properties:
public static void iterateCorridors () {
CivilDocument doc = CivilApplication.ActiveDocument;
using ( Transaction ts = Application.DocumentManager.MdiActiveDocument.
Database.TransactionManager.StartTransaction() ) {
foreach ( ObjectId objId in doc.CorridorCollection ) {
Corridor oCorridor = ts.GetObject(objId, OpenMode.ForRead) as Corridor;
Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Corridor:
{0}\nLargest possible triangle side: {1}\n",
oCorridor.Name, oCorridor.MaximumTriangleSideLength);
}
}
}
For more information about ObjectIdCollections, see the ObjectARX Managed Class Reference.
This example creates a new point style:
ObjectId pointStyleID = doc.Styles.PointStyles.Add("Name");
// Now a new point style is added to the collection of styles,
// and we can modify it by setting the properties
// of the oPointStyle object, which we get from the Transaction ts:
PointStyle oPointStyle = ts.GetObject(pointStyleID, OpenMode.ForWrite) as PointStyle;
oPointStyle.Elevation = 114.6;
// You must commit the transaction for the add / modify operation
// to take effect
ts.Commit();
If you attempt to add a new element with properties that match an already existing element, try to access
an item that does not exist, or remove an item that does not exist or is in use, an error will result. You should
trap the error and respond accordingly.
The following sample demonstrates one method of dealing with such errors:
// Try to access the style named "Name"
try {
// This raises an ArgumentException if the item doesn't
// exist:
ObjectId pointStyleId = doc.Styles.PointStyles["Name"];
// do something with the point style...
} catch ( ArgumentException e ) {
ed.WriteMessage(e.Message);
}
Settings
This section explains the purpose and use of the document settings objects, and covers changing general
and specific settings.
1 Drawing level: there are drawing-wide settings, such as units and zone, abbreviations, etc. There are
also ambient settings, which affect a variety of AutoCAD Civil 3D behaviors. While these settings also
apply drawing-wide, they can be overridden at the feature or command level.
2 Feature (object) level: ambient settings override drawing level ambient settings for that feature only.
There are also feature-specific settings, such as default styles.
3 Command level: ambient settings can be set on a command-by-command basis. These settings override
both drawing level and feature level settings.
For more information on settings in general, see Understanding Settings in the AutoCAD Civil 3D User’s
Guide.
A document’s settings are accessed through the properties of the SettingsRoot object, which is obtained
from the Document.Settings property. This object contains the DrawingSettings property (type
SettingsDrawing), which contains all the top-level ambient settings for the document. It also has the
GetSettings() method, which gets feature and command settings.
Drawing settings and general ambient settings are in the Autodesk::Civil::Settings namespace, while
feature and command settings are in the namespace for the related feature. For example, alignment-related
ambient and command settings are in the Autodesk::Civil::Land::Settings namespace.
The following sample shows how to access the angle settings for alignments:
SettingsAlignment alignmentSettings = doc.Settings.GetSettings<SettingsAlignment>();
Autodesk.Civil.Settings.SettingsAmbient.SettingsAngle angleSettings = alignmentSettings.Angle;
ed.WriteMessage(@"Alignment settings:\n Precision: {0}\n Rounding: {1}
Unit: {2}\n Drop Decimal: {3}\n DropZeros: {4}\n ",
angleSettings.Precision.Value, angleSettings.Rounding.Value,
angleSettings.Unit.Value, angleSettings.DropDecimalForWholeNumbers.Value,
angleSettings.DropLeadingZerosForDegrees.Value);
The command settings apply to commands, and correspond to the settings in the Commands folder for
each item in the AutoCAD Civil 3D Toolspace Settings Tab. Each command setting has a corresponding
class named SettingsCmdCommandName. For example, the settings class corresponding to the
CreateAlignmentLayout command is SettingsCmdCreateAlignmentLayout. As with other types of settings, you
use the CivilDocument.Settings.GetSettings() method to access command settings objects in the document.
Label Styles
This section explains common features of label styles. It covers creating a new label style object, defining a
label style, and using property fields in label style text strings. Details specific to each construct are covered
in the appropriate chapters.
■ Text
■ Line
■ Block - symbols
■ ReferenceText
■ DirectionArrow
■ TextForEach
Not all of these may be valid, depending on the label style type. For example, adding a tick mark component
to a label style meant for a point has no visible effect. Label styles also depend on graphical objects that may
or may not be part of the current document. For example, if the style references a block that is not part of
the current document, then the specified block or tick components are not shown.
When first created, the label style object is set according to the ambient settings. Because of this, a new label
style object may already contain features. If you are creating a new label style object, be sure to check for
such existing features or your style might contain unintended elements.
// Check to see whether any text components already exist.
// If not, add one.
if (oLabelStyle.GetComponentsCount(LabelStyleComponentType.Text) == 0)
{
// Add a text component
oLabelStyle.AddComponent("New Text ", LabelStyleComponentType.Text);
}
// Now modify the first one:
ObjectIdCollection textCompCol = oLabelStyle.GetComponents(LabelStyleComponentType.Text);
var newTextComponent = ts.GetObject(textCompCol[0], OpenMode.ForWrite) as LabelStyleTextCom
ponent;
The ambient settings also define which units are used. If you are creating an application designed to work
with different drawings, you should take ambient settings into account or labels may demonstrate unexpected
behavior in each document.
Valid property fields for each element are listed in the appropriate chapter.
NOTE You can also export collections of styles to another drawing by using the static StyleBase::ExportTo()
method.
When exporting styles, you specify how conflicts are resolved using the StyleConflictResolverType enum.
In this example, the first style in the MajorStationLabelStyles collection is exported from the active drawing
to another open drawing named Drawing1.dwg:
[CommandMethod("ExportStyle")]
public void ExportStyle()
{
CivilDocument doc = CivilApplication.ActiveDocument;
Document AcadDoc = Application.DocumentManager.MdiActiveDocument;
Database destDb = null;
// Find the database for "Drawing 1"
foreach (Document d in Application.DocumentManager)
{
if (d.Name.Equals("Drawing1.dwg")) destDb = d.Database;
}
// cancel if no matching drawing:
if (destDb == null) return;
using (Transaction ts = AcadDoc.Database.TransactionManager.StartTransaction())
{
// Export style:
ObjectId styleId = doc.Styles.LabelStyles.AlignmentLabelStyles.MajorStationLa
belStyles[0];
LabelStyle oLabelStyle = ts.GetObject(styleId, OpenMode.ForRead) as LabelStyle;
oLabelStyle.ExportTo(destDb, Autodesk.Civil.StyleConflictResolverType.Rename);
}
}
NOTE In certain situations attempts to abort the transaction will fail when calling ExportTo(). This is the case
when all the following conditions are all true: multiple styles are being exported, there is a naming conflict between
styles, and the StyleConflictResolverType is StyleConflictResolverType.Override.
CommandSettingsSample
<installation-directory>\Sample\Civil 3D API\DotNet\CSharp\CommandSettingsSample\
This sample demonstrates how to iterate through all the command settings defined in a drawing using
Reflection. All commands are exported to an xml file.
CompareStyles
<installation-directory>\Sample\Civil 3D API\DotNet\CSharp\CompareStyles\
This sample illustrates how to compare styles defined in two drawings.
DraggedLabelSample
<installation-directory>\Sample\Civil 3D API\DotNet\CSharp\DraggedLabelSample\
This sample illustrates how to add a new label in a dragged state.
EditLabelStyleSample
<installation-directory>\Sample\Civil 3D API\DotNet\CSharp\EditLabelStyleSample\
This sample illustrates how to batch copy label styles from one label to multiple selected labels.
31
Object Hierarchy
Root Objects
This section describes how to gain access to the survey-specific versions of the root document and database
objects. It covers the use of ambient settings, user settings, and the equipment database. It also describes
the creation of survey projects, which contain networks and figures, and provide access to survey points.
32 | Chapter 4 Survey
When using survey root objects, be sure to reference the “Autodesk Civil Engineering Survey 6.0 Object
Library” (AeccXSurvey.tlb) and “Autodesk Civil Engineering UI Survey 6.0 Object Library” (AeccXUISurvey.tlb)
libraries.
This sample demonstrates how to retrieve the survey root objects:
Dim oApp As AcadApplication
Set oApp = ThisDrawing.Application
Dim sAppName As String
sAppName = "AeccXUiSurvey.AeccSurveyApplication"
Dim oSurveyApplication As AeccSurveyApplication
Set oSurveyApplication = oApp.GetInterfaceObject(sAppName)
34 | Chapter 4 Survey
This sample program displays selected information about each equipment item in the document’s database:
Dim oEquipDatabases As AeccSurveyEquipmentDatabases
Dim oEquipDatabase As AeccSurveyEquipmentDatabase
Dim oEquipment As AeccSurveyEquipment
Survey Network
A network represents the spatial framework of a survey. Each network contains a collection of control points,
directions, setups, and non-control points. It also contains information on how these objects are related,
such as how the control points and setups are connected relative to one another.
36 | Chapter 4 Survey
Creating a Survey Network
Survey networks are created through the Create method of the AeccSurveyProject.Networks collection.
Dim oSurveyNetwork As AeccSurveyNetwork
Set oSurveyNetwork = oSurveyProject.Networks.Create("Net_01")
38 | Chapter 4 Survey
This sample creates a setup at the location of point 3001 using the location of point 3004 as the backsight.
It then creates an observation to another location, which is given the identification “3002”.
Dim oSetups As AeccSurveySetups
Dim oSetup1 As AeccSurveySetup
A non-control point may be promoted to a control point if you reference the point as a control point when
creating a traverse, or reference the point as a setup to make observations to other points that may affect
locations during an analysis.
40 | Chapter 4 Survey
Getting Survey Network Drawing Objects
You can get and manipulate the AutoCAD drawing objects that make up a survey network from the AutoCAD
Civil 3D user interface. The drawing objects are represented by the AeccSurveyNetworkEntity object. For
example, this code prompts the user to select the survey network, tests whether it is the survey network
object, and then prints some information about it:
Dim objPart As AeccSurveyNetworkEntity
Dim objEnt As AcadObject
Dim objAcadEnt As AcadEntity
Dim varPick As Variant
ThisDrawing.Utility.GetEntity objEnt, varPick, "Select the Survey Network"
If TypeOf objEnt Is AeccSurveyNetworkEntity Then
Set objPart = objEnt
Debug.Print objPart.Name, TypeName(objPart)
ElseIf TypeOf objEnt Is AcadEntity Then
Set objAcadEnt = objEnt
Debug.Print objAcadEnt.Name, TypeName(objAcadEnt)
End If
Figures
Figures are a group of connected lines and arcs that have meaning within a survey. A figure can represent a
fence, building, road, parcel, or similar object. Unlike a normal polyline, a vertex in a figure can reference
a survey point. If a referenced survey point is moved, vertices in the figure are moved as well. The first line
or arc added to the figure sets the location all other lines and arcs will be drawn from. Each line and arc
added to a figure is in turn based on the endpoint of the previous element. The position of the last endpoint
can be determined from the read-only properties AeccSurveyFigure.LastPointX and
AeccSurveyFigure.LastPointY.
AddLineByAzimuthDistance
AddLineByAzimuthDistance adds a line to the figure of the specified length and of the specified angle from
the major axis of the survey project.
' Draw a line 30 meters long at 10 degrees from the major axis.
oFigure.AddLineByAzimuthDistance 0.17453, 30
AddLineByDeltaAzimuthDistance
AddLineByDeltaAzimuthDistance adds a line to the figure of the specified length and of the specified angle
from the endpoint of the previous line.
' Draw a line 20 meters long at 270 degrees from the
' previous line.
oFigure.AddLineByDeltaAzimuthDistance 4.7124, 20
42 | Chapter 4 Survey
A figure can also form a breakline that defines how surfaces are triangulated. This is accomplished by setting
the AeccSurveyFigure.IsBreakline property to True
This sample creates a new figure style object and adjusts some of the style settings:
Dim oFigureStyles As AeccSurveyFigureStyles
Dim oFigureStyle As AeccSurveyFigureStyle
Set oFigureStyles = oSurveyDocument.FigureStyles
Set oFigureStyle = oFigureStyles.Add(sStylename)
NOTE The similarly named AeccSurveyFigurePrefixDatabase.FindItem can only be used to search for the
identification numbers of prefixes within a database - to find a prefix by name, use the
AeccSurveyFigurePrefixDatabase.GetMatchedFigurePrefix method.
This sample creates a new figure prefix database and a new figure prefix. It switches the current database to
the newly created one, and sets an existing figure to use the new prefix’s style.
' Get a reference to all the prefix databases.
Dim oPrefixDatabases As AeccSurveyFigurePrefixDatabases
Set oPrefixDatabases = oSurveyDocument.FigurePrefixDatabases
You can set a figure to use a prefix style manually by using the
AeccSurveyFigure.InitializeFromFigurePrefix method. It searches through the current prefix database
for a prefix name that matches the first part of the name of the figure. For example, a figure with the name
“BV 01” matches a prefix with the name “BV”. The current prefix database can be determined through the
44 | Chapter 4 Survey
CurrentFigurePrefixDatabase property of the document’s survey user settings. The following code shows
the correct method for doing this:
Dim oUserSettings As AeccSurveyUserSettings
Dim CurrentDatabase As String
Set oUserSettings = oSurveyDocument.GetUserSettings
CurrentDatabase = oUserSettings.CurrentFigurePrefixDatabase
You can change the current database by setting the CurrentFigurePrefixDatabase property to the new
name and then updating the survey user settings:
oUserSettings.CurrentFigurePrefixDatabase = "NewDB"
oSurveyDocument.UpdateUserSettings oUserSettings
Sample Program
SurveySample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Survey\SurveySample.dvb
This sample creates a simple survey from hard-coded data using control points, setups, directions, and figures.
A survey style is created and applied. The ambient settings and other global settings are demonstrated.
Sample Program | 45
46
Points
5
Object Hierarchy
Points
This section covers the collection of all points in a document, accessing points stored in a file, and the use
of the point object.
47
The following example adds a series of points to the AeccDocument.Points collection using AddMultiple
and then accesses points in the collection directly:
' This adds an array of point locations to the document's
' points collection.
Dim lNumAdded As Long
Const NUM_LOCATIONS As Long = 3
' One dimensional array, 3 for each point location.
Dim dLocations(0 To (3 * NUM_LOCATIONS) - 1) As Double
' One point per line
dLocations(0) = 4927: dLocations(1) = 3887: dLocations(2) = 150
dLocations(3) = 5101: dLocations(4) = 3660: dLocations(5) = 250
dLocations(6) = 5144: dLocations(7) = 3743: dLocations(8) = 350
lNumAdded = oPoints.AddMultiple(NUM_LOCATIONS, dLocations, 0)
The second parameter of the ImportPoints and ExportPoints methods is a string that describes how the
point values are stored in the file. The following table lists some commonly available file formats. You can
create other formats by using the Point File Format dialog box.
Point File Formats
String Literal Format of values in the file
48 | Chapter 5 Points
String Literal Format of values in the file
The third parameter of the ImportPoints method is an object of type AeccPointImportOptions, which can
be set to perform actions as the data is being loaded. For example, you can add offsets to the point positions
or elevations, determine which points to read from the file, or specify the point group where the points are
placed. The third parameter of the ExportPoints method is of the similar AeccPointExportOptions type.
This example demonstrates the ImportPoints and ExportPoints methods:
Dim oPoints As AeccPoints
Dim oImportOptions As New AeccPointImportOptions
Dim sFilename As String
Dim sFileFormat As String
Dim iCount As Integer
NOTE When you add points using the ImportPoints method, it is possible that the point numbers will conflict
with those that already exist in the drawing. In such cases, the user is given an option to renumber the point
numbers from the file, or to cancel the operation which will result with a Visual Basic error. An application that
uses ImportPoints should take this into account.
Using Points
Each individual point is represented by an object of type AeccPoint. The point object contains the
identification number, description, and location for the point. The identification number, held in the
Point.Number property, is unique and is automatically assigned when the point is first created. It cannot be
changed. The read-only Point.FullDescription property is only meaningful when the point is read from
a file that contains description information.
You can access the local position through either the AeccPoint.Easting and AeccPoint.Northing properties
or by using the AeccPoint.Location property, a three-element array containing the easting, northing, and
Using Points | 49
elevation. The point’s location can also be specified by using the AeccPoint.Grideasting and
AeccPoint.GridNorthing properties or the AeccPoint.Latitude and AeccPoint.Longitude properties,
depending on the coordinate settings of the drawing.
This sample adds a new point to the document’s collection of points and sets some of its properties.
Dim oPoints As AeccPoints
Set oPoints = g_oAeccDocument.Points
Dim oPoint1 As AeccPoint
Dim dLocation(0 To 2) As Double
dLocation(0) = 4958
dLocation(1) = 4078
Set oPoint1 = oPoints.Add(dLocation)
oPoint1.Name = "point1"
oPoint1.RawDescription = "Point Description"
Style
This section covers the creation of point styles and point-specific features of the point label style object. It
also explains point description keys, which are used to assign styles to points read from a text file.
50 | Chapter 5 Points
You can also create custom styles and add them to the document’s collection of point styles. First, add a
new style to the document’s list of styles using the AeccDocument.PointStyles.Add method. This method
returns a new style object that is set with all the properties of the default style. You can then make the
changes to the style object you require.
This sample creates a new points style, adjusts the style settings, and the assigns the style to point “Point1”:
' Create the style objects to use.
Dim oPointStyles As AeccPointStyles
Dim oPointStyle As AeccPointStyle
Point label styles can use the following property fields in the contents of any text components:
<[Name(CP)]>
<[Point Number]>
<[Northing(Uft|P4|RN|AP|Sn|OF)]>
<[Easting(Uft|P4|RN|AP|Sn|OF)]>
<[Raw Description(CP)]>
<[Full Description(CP)]>
<[Point Elevation(Uft|P3|RN|AP|Sn|OF)]>
<[Latitude(Udeg|FDMSdSp|P6|RN|DPSn|CU|AP|OF)]>
<[Longitude(Udeg|FDMSdSp|P6|RN|DPSn|CU|AP|OF)]>
<[Grid Northing(Uft|P4|RN|AP|Sn|OF)]>
<[Grid Easting(Uft|P4|RN|AP|Sn|OF)]>
<[Scale Factor(P3|RN|AP|OF)]>
<[Convergence(Udeg|FDMSdSp|P6|RN|AP|OF)]>
<[Survey Point]>
Label styles are described in detail in the chapter 1 section Label Styles (page 19).
52 | Chapter 5 Points
Point description keys are held in sets, objects of type AeccPointDescriptionKeySet. The collection of all
sets in a document are held in the document’s AeccDocument.PointDescriptionKeySets property.
' Create a key set in the document's collection
' of sets.
Dim oPointDescriptionKeySet As AeccPointDescriptionKeySet
Set oPointDescriptionKeySet = _
oDocument.PointDescriptionKeySets.Add("Sample Key Set")
' Create a new key in the set we just made. Match with
' any description beginning with "SMP".
Dim oPointDescriptionKey As AeccPointDescriptionKey
Set oPointDescriptionKey = oPointDescriptionKeySet.Add("SAMP*")
The following is the contents of a text file in “PENZD (comma delimited)” format with point information,
a description, and parameter. This creates two points using the previously defined SAMP* description key,
resulting in point markers four times normal size.
2000,3700.0,4900.0,150.0,SAMPLE 4
2001,3750.0,4950.0,150.0,SAMPLE 4
When a text file is loaded using Points.ImportPoints, the first alphanumeric element in a point’s description
is compared to the names of all point description keys. If a match is found, the point’s settings are adjusted
to match the description key. Any parameters to pass to the key are added after the description, separated
by spaces. If using parameters, use a comma delimited file format or else any parameters will be ignored.
This process only takes place when points are read from a file - after a point is created, setting the
AeccPoint.RawDescription property does nothing to change the point’s style.
Point Groups
This section explains the creation and use of point groups, which is a named subset of the points in a
document.
Point Groups | 53
AeccDocument.PointGroups.Add method and specifying a unique identifying string name. A new empty
point group is returned.
' Get the collection of all point groups from the document.
Dim oPtGroups As AeccPointGroups
Dim oPtGroup As AeccPointGroup
Set oPtGroups = oAeccDocument.PointGroups
InlcudeElevations ExcludeElevations
IncludeFullDescriptions ExcludeFullDescriptions
IncludeNames ExcludeNames
IncludeNumbers ExcludeNumbers
IncludeRawDescriptions ExcludeRawDescriptions
IncludePointGroups
Each of these properties is a string that describes the selection criteria used. As many properties may be used
as needed to make your selection. Any property left blank has no affect on the selection.
The properties that query string properties of points (FullDescription, Name, RawDescription) consist of a
comma-separated list of possible strings to match against. Each element in that list may contain the wildcards
“?” and “*”. The properties that deal with number properties of points consist of a comma delineated list of
specific numbers or ranges of numbers (two values separated by a hyphen, such as “100-200”). The properties
that deal with elevation consist of a comma delineated list of specific elevations, ranges of elevation, upper
54 | Chapter 5 Points
limits (a less-than symbol followed by a value, such as “<500”), or lower limits (a greater-than symbol
followed by a value, such as “>100”).
' Add points to the point group using the QueryBuilder.
To create a group that contains every point in the document, set the boolean
AeccPointGroup.InlcudeAllPoints property to True.
' Set the elevation of all the points in the group to 100.
oPtGroup.Elevation = 100
oPtGroup.OverrideElevation = True
Point groups can also be used to define or modify a TIN surface. The AeccTinSurface.PointGroups property
is a collection of point groups. When a point group is added to the collection, every point in the point group
is added to the TIN surface.
' oTinSurf is a valid object of type AeccTinSurface.
' oPointGroup is a valid object of type AeccPointGroup.
oTinSurf.PointGroups.Add oPointGroup
Sample Program
SurfacePointsSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\SurfacePoints\SurfacePointsSample.dvb
The sample code from this section can be found in context in the SurfacePointsSample.dvb program. The
Points module contains functions that load points from a text file, create points manually, use description
keys, deal with point groups, and use points to modify a surface. The PointStyles module demonstrates the
creation of a point style and a point label style.
57
name of the surface. The AeccSurfaces.Item method returns a generic reference of type AeccSurface, so
you need to check the AeccSurface.Type property to actually determine what kind of surface it is.
This sample examines each surface in the drawing and reports what kind of surface it is:
Dim oSurface As AeccSurface
Dim i As Integer
For i = 0 To oAeccDocument.Surfaces.Count - 1
Set oSurface = oAeccDocument.Surfaces.Item(i)
Select Case (oSurface.Type)
Case aecckGridSurface:
Dim oGridSurface As AeccGridSurface
Set oGridSurface = oSurface
Debug.Print oGridSurface.Name & ": Grid"
Case aecckTinSurface:
Dim oTinSurface As AeccTinSurface
Set oTinSurface = oSurface
Debug.Print oTinSurface.Name & ": TIN"
Case aecckGridVolumeSurface:
Dim oGridVolume As AeccGridVolumeSurface
Set oGridVolume = oSurface
Debug.Print oGridVolume.Name & ": Grid Volume"
Case aecckTinVolumeSurface:
Dim oTinVolume As AeccTinVolumeSurface
Set oTinVolume = oSurface
Debug.Print oTinVolume.Name & ": TIN Valume"
End Select
Next i
Creating a Surface
This section covers the various methods for creating surfaces. Loading surfaces from LandXML files, .TIN
files, or DEM files is explained. It also demonstrates creating new TIN, grid, and volume surfaces.
58 | Chapter 6 Surfaces
been loaded, you can examine the AeccSurface.Type property and assign the generic surface reference to a
more specific type.
Dim oSurface As AeccSurface
Dim sFileName As String
sFileName = "C:\My Documents\EG.xml"
Set oSurface = oAeccDocument.Surfaces.ImportXML(sFileName)
oTinData.Name = "EG"
oTinData.Description = "Sample TIN Surface"
oTinData.Layer = oAeccDocument.Layers.Item(0).Name
oTinData.BaseLayer = oAeccDocument.Layers.Item(0).Name
oTinData.Style = oAeccDocument.SurfaceStyles.Item(0).Name
Set oTinSurface = oAeccDocument.Surfaces
.AddTinSurface(oTinData)
60 | Chapter 6 Surfaces
This sample demonstrates the creation of a TIN volume surface from two existing surfaces, oTinSurfaceL
and oTinSurfaceH:
' Get the names of the layer and style to be used.
Dim sLayerName as String
sLayerName = g_oAeccDocument.Layers.Item(0).Name
Dim sStyleName as String
sStyleName = oAeccDocument.SurfaceStyles.Item(0).Name
Adding a Boundary
A boundary is a closed polyline that defines the visibility of surface triangles within it. A boundary can hide
all triangles outside it, hide all triangles inside it, or show triangles inside it that would otherwise be hidden.
Boundaries also change surface statistics such as area and number of triangles. Boundaries can either be
“destructive” (totally hiding triangles that cross the boundary) or “non-destructive” (clipping triangle edges
at the point where they cross the boundary). Normally, TIN surfaces use non-destructive boundaries, while
grid surfaces can only have destructive boundaries:
Destructive Boundary
All boundaries applied to a surface are stored in the AeccSurface.Boundaries collection. The boundary itself
is defined by an AutoCAD entity such as a closed POLYLINE or POLYGON. The height of the entity plays
no part in how surface triangles are clipped, so you can use 2D entities. This entity can also contain curves,
but the boundary always consists of lines. How these lines are tessellated is defined by the mid-ordinate
distance, which is the maximum distance between a curve and the lines that are generated to approximate
it:
Mid-ordinate Distance
62 | Chapter 6 Surfaces
This sample adds a square outside boundary to a surface:
' First we need an AutoCAD entity (in this case a polyline)
' which describes the boundary location.
Dim oPoly As AcadPolyline
Dim dPoints(0 To 11) As Double
dPoints(0) = 1000: dPoints(1) = 1000: dPoints(2) = 0
dPoints(3) = 1000: dPoints(4) = 4000: dPoints(5) = 0
dPoints(6) = 4000: dPoints(7) = 4000: dPoints(8) = 0
dPoints(9) = 4000: dPoints(10) = 1000: dPoints(11) = 0
Set oPoly = oAeccDocument.Database.ModelSpace _
.AddPolyline(dPoints)
oPoly.Closed = True
NOTE Any operation that causes the formation of new triangles (such as adding points or breaklines to a TIN
surface) may result in triangles that cross existing boundary lines. Boundaries should always be added after every
other operation that adds points to a surface.
TIP RebuildSnapshot will cause an error if the snapshot does not exist. CreateSnapshot and RebuildSnapshot
can also cause errors if the surface is out-of-date.
Finding Intersections
When working with surfaces, it can be useful to determine where a vector intersects with a surface, which
you can do with the surface’s IntersectPointWithSurface() method. For example, you can determine if
64 | Chapter 6 Surfaces
error. Unlike TIN or LandXML files, text files do not contain a list of faces - the points are automatically
joined into a series of triangles based on the settings of the AeccTinSurface.DefinitionProperties property.
' Add points from a .txt file to an existing TIN surface.
sFileName = "C:\My Documents\points.txt"
oTinSurface.PointFiles.Add sFileName
You can also add points to a surface by adding contour lines. See Adding Contours to a TIN Surface (page
68).
All points that make up a surface can be retrieved from the read-only AeccTinSurface.Points property,
which is an array of locations.
' Print the location (easting, northing, and elevation)
' of the 1000th point.
Dim vLocation as Variant
vLocation = oTinSurface.Points(1000)
66 | Chapter 6 Surfaces
you call AeccSurfaceBreaklines.AddProximityBreakline instead of
AeccSurfaceBreaklines.AddStandardBreakline.
■ aeccBreaklineFileMaintainLink: Reads the breaklines from the FLT file when they are added and when
the surface is rebuilt.
■ aeccBreaklineFileBreakLink: All breaklines in the FLT file are copied into the surface as Add Breakline
operations.
For more information about these options, see Importing Breaklines from a File in the AutoCAD Civil 3D
User’s Guide.
This sample shows how to import breaklines from a file named eg1.flt, and to get the first newly created
breakline:
Dim oBrkLine As AeccSurfaceBreakline
Set oBrkLine = brkLines.AddBreaklineFromFile("New Breakline", "C:\eg1.flt", 10#, aeccBreak
lineFileBreakLink)(0)
68 | Chapter 6 Surfaces
supplemental distance parameter. Any curves in the entity are also tessellated according to the mid-ordinate
distance, just like breaklines. The supplemental distance value has precedence over the weeding values, so
it is possible that the final contour will have line segments smaller than the weeding parameters specify.
For more information about weeding and countours, see Weeding and Supplementing Factors for Contours
in the AutoCAD Civil 3D User’s Guide.
A TIN surface has a collection of contours in the AeccTinSurface.Contours property. The following sample
demonstrates adding a contour to a surface:
Dim dPoints(0 To 8) As Double ' 3 points
Dim o3DPoly As AcadPolyline
...
Dim z As Double
Dim objSurf As AeccSurface
Set objSurf = g_oAeccDoc.Surfaces(0)
Dim varObjects As Variant
Dim objEnt As AcadEntity
Dim iCtr As Integer, iLow As Integer, iHigh As Integer
varObjects = objSurf.ExtractContour(aeccDisplayOrientationPlan, aeccSFMajorContours, 90, 95)
iLow = LBound(varObjects)
iHigh = UBound(varObjects)
For iCtr = iLow To iHigh
Set objEnt = varObjects(iCtr)
Debug.Print TypeName(objEnt)
Next iCtr
Surface Style
This section explains the creation and application of surface styles.
Creating a Style
All surface styles are stored in the AeccDocument.SurfaceStyles collection, an object of type
AeccSurfaceStyles. To create a new style, call the AeccSurfaceStyles.Add method with the name of your
new style. It is initially set according to the document’s ambient settings.
Dim oSurfaceStyle As AeccSurfaceStyle
oSurfaceStyle = oDocument.SurfaceStyles.Add("New Style")
70 | Chapter 6 Surfaces
ambient settings and may show some unwanted style elements. Always set the visibility properties of all
style elements to ensure the style behaves as you expect.
' Change the style so that it displays surface triangles,
' major contour lines, and any boundaries along the outside
' edge, but nothing else.
oSurfaceStyle.TriangleStyle.DisplayStylePlan.Visible = True
oSurfaceStyle.BoundaryStyle.DisplayExteriorBoundaries = True
oSurfaceStyle.BoundaryStyle.DisplayStylePlan.Visible = True
oSurfaceStyle.ContourStyle.MajorContourDisplayStylePlan _
.Visible = True
oSurfaceStyle.PointStyle.DisplayStylePlan.Visible = False
oSurfaceStyle.BoundaryStyle.DisplayInteriorBoundaries = False
oSurfaceStyle.ContourStyle.MinorContourDisplayStylePlan _
.Visible = False
oSurfaceStyle.ContourStyle.UserContourDisplayStylePlan _
.Visible = False
oSurfaceStyle.GridStyle.DisplayStylePlan.Visible = False
oSurfaceStyle.DirectionStyle.DisplayStylePlan.Visible = False
oSurfaceStyle.ElevationStyle.DisplayStylePlan.Visible = False
oSurfaceStyle.SlopeStyle.DisplayStylePlan.Visible = False
oSurfaceStyle.SlopeArrowStyle.DisplayStylePlan.Visible = False
oSurfaceStyle.WatershedStyle.DisplayStylePlan.Visible = False
' This must be repeated for all Model display styles as well.
Many elevation analysis features can be modified through the surface style - see the Surface Style (page 70)
section. For example, you can choose from among a number of pre-set color schemes.
72 | Chapter 6 Surfaces
AeccSurfaceAnalysisWatershed.WatershedRegions collection, you can then determine the specific type of
each region.
' Compute water drainage over the surface.
oSurface.SurfaceAnalysis.WatershedAnalysis _
.CalculateWatersheds
Dim i as Integer
For i = 0 To oWSAnalysis.Count - 1
Select Case (oWSAnalysis.Item(i).Type)
Case aeccWatershedBoundaryPoint
Dim oWSPoint As AeccWatershedRegionBoundaryPoint
Set oWSPoint = oWSAnalysis.Item(i)
Case aeccWatershedBoundarySegment
Dim oWSSegment As AeccWatershedRegionBoundarySegment
Set oWSSegment = oWSAnalysis.Item(i)
Case aeccWatershedDepression
Dim oWSDepression As AeccWatershedRegionDepression
Set oWSDepression = oWSAnalysis.Item(i)
Case aeccWatershedFlat
Dim oWSFlat As AeccWatershedRegionFlat
Set oWSFlat = oWSAnalysis.Item(i)
Case aeccWatershedMultiDrain
Dim oWSMulti As AeccWatershedRegionMultiRegionDrain
Set oWSMulti = oWSAnalysis.Item(i)
Case aeccWatershedMultiDrainNotch
Dim oWSNotch As AeccWatershedRegionMultiRegionDrainNotch
Set oWSNotch = oWSAnalysis.Item(i)
Case Else 'aeccWatershedUnknownSink
End Select
Next i
Objects derived from AeccWatershedRegion have other common features. They all have an identification
number in the AeccWatershedRegion.Id property. They also have a AeccWatershedRegion.Boundary property,
which contains a 2-dimensional array containing the points of a closed polygon enclosing the region.
Dim j as Integer
Debug.Print "This region drains through the following"
Debug.Print "line segments:"
For j = 0 To UBound(vDrainSegments, 1) - 1
Debug.Print vDrainSegments(j, 0) & ", " _
& vDrainSegments(j, 1) & ", " _
& vDrainSegments(j, 2) & " to ";
Debug.Print vDrainSegments(j + 1, 0) & ", " _
& vDrainSegments(j + 1, 1) _
& ", " & vDrainSegments(j + 1, 2)
Next j
Depression Regions
A region of type aeccWatershedDepression represents an area of the surface that water does not normally
leave. It is possible for the depression to fill and then drain into other regions. The lowest points on the
74 | Chapter 6 Surfaces
region edge where this overflow may take place and the regions that the water drains into are kept in the
aeccWatershedDepression.Drains collection.
For j = 0 To oDrains.Count - 1
' See what kind of drain targets we have.
If (UBound(oDrains.Item(j).Targets) = -1) Then
' This depression drains outside the surface.
Debug.Print "Drain through point: " & _
oDrains.Item(j).Location(0) & ", " & _
oDrains.Item(j).Location(1) & ", " & _
oDrains.Item(j).Location(2) & _
" to the surface boundary."
Else
' This depression can drain into other regions.
Dim lTargets() As Long
lTargets = oDrains.Item(j).Targets
sTargets = CStr(lTargets(0))
Dim k as Integer
For k = 1 To UBound(lTargets)
sTargets = sTargets & ", " & CStr(lTargets(k))
Next k
Debug.Print "Drain through point: " & _
oDrains.Item(j).Location(0) & ", " & _
oDrains.Item(j).Location(1) & ", " & _
oDrains.Item(j).Location(2) & _
" into the following regions: " & sTargets
Endif
Next j
Flat Regions
A flat area that only drains into one region is combined into that region. If a flat surface drains into multiple
regions, then it is created as a separate region of type AeccWatershedRegionFlat. The only feature of flat
regions is an array of all drain targets.
Dim oWSFlat As AeccWatershedRegionFlat
Set oWSFlat = oWSAnalysis.Item(i)
varDrainsInto = oWSFlat.DrainsInto
sTargets = CStr(varDrainsInto(0))
For k = 1 To UBound(varDrainsInto)
sTargets = sTargets & ", " & CStr(varDrainsInto(k))
Next k
Debug.Print "This region drains into regions " & sTargets
sTargets = CStr(varDrainsInto(0))
For k = 1 To UBound(varDrainsInto)
sTargets = sTargets & ", " & CStr(varDrainsInto(k))
Next k
Debug.Print "This region drains through these segments: "
For j = 0 To UBound(vDrainSegments, 1) - 1
Debug.Print vDrainSegments(j, 0) & ", " _
& vDrainSegments(j, 1) & ", " _
& vDrainSegments(j, 2) & " to ";
Debug.Print vDrainSegments(j + 1, 0) & ", " _
& vDrainSegments(j + 1, 1) _
& ", " & vDrainSegments(j + 1, 2)
Next j
Sample Programs
SurfacePointsSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\SurfacePoints\SurfacePointsSample.dvb
This sample program demonstrates the creation of surfaces using point data loaded from a file and through
use of point groups. Surface styles are created and applied.
76 | Chapter 6 Surfaces
SurfaceOperations.dvb
<installation-directory>\Sample\Civil 3D API\Vba\SurfaceOperations\SurfaceOperationsSample.dvb
This sample demonstrates the elevation analysis and watershed analysis features. The watershed analysis
includes a full report of all watershed regions. Breaklines of all kinds, contours, and borders are applied to
the surfaces as well.
CorridorSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Corridor\CorridorSample.dvb
A TIN volume surface is created between the corridor datum surface and the ground surface. Cut and fill
information is obtained from this volume surface.
Sample Programs | 77
78
Sites and Parcels
7
Object Hierarchy
Sites
This section explains the creation and use of sites, which are used as containers for parcels and alignments
(for information about alignments, see Chapter 6: Alignments in COM (page 87)).
79
Creating Sites
All sites in a document are held in the AeccDocument.Sites collection, an object of type AeccSites. The
AeccSites.Add method creates a new empty site with the specified name.
Using Sites
A site represents a distinct group of alignments and parcels. Besides containing collections of parcels and
alignments, the AeccSite object also contains properties describing how the site objects are numbered and
displayed.
' NextAutoCounterParcel sets the starting identification
' number for newly created parcels. The first parcel
' created from parcel segments will be 300, the next 301,
' and so on.
oSite.NextAutoCounterParcel = 300
Parcels
This section covers the creation and use of parcels. Parcel segments, parcel loops, and parcel styles and label
styles are also explained.
' Parcel 1
Call oSegments.AddLine(0, 0, 0, 200)
Call oSegments.AddCurve(0, 200, -0.5, 200, 200)
Call oSegments.AddLine(200, 200, 200, 0)
Call oSegments.AddLine(200, 0, 0, 0)
' Parcel 2
Call oSegments.AddCurve2(200, 200, 330, 240, 400, 200)
Call oSegments.AddLine(400, 200, 400, 0)
Dim i as Integer
For i = 0 to oSegment.Count - 1
Dim oElement As AeccParcelSegmentElement
Set oElement = oSegment.Item(i)
Dim i as Integer
For i = 0 to oParcel.ParcelLoops.Count - 1
Dim oElement As AeccParcelSegmentElement
Set oElement = oParcel.ParcelLoops.Item(i)
The style of individual parcel segments depends on the style of the parent parcel, but segments may be
shared by different parcels. This conflict is decided by the AeccParcels.Properties.SegmentDisplayOrder
' Set the style with the highest priority to the lowest
' priority.
Dim lLowestPosition as Long
lLowestPosition = oSegmentDisplayOrder.Count - 1
oSegmentDisplayOrder.SetPriority 0, lLowestPosition
Parcel label styles can use the following property fields in the contents of any text component:
<[Name(CU)]>
<[Description(CP)]>
<[Parcel Area(Usq_ft|P2|RN|AP|Sn|OF)]>
<[Parcel Number(Sn)]>
<[Parcel Perimeter(Uft|P3|RN|AP|Sn|OF)]>
<[Parcel Address(CP)]>
Label styles are described in detail in the chapter 1 section Label Styles (page 19).
Sample Program
ParcelSample.dvb
<installation-directory>\Sample\Civil 3D API\COM\Vba\Parcel\ParcelSample.dvb
This sample program accesses the active document, creates a site, and then creates three parcels by adding
line segments, curve segments, and entity segments. A new parcel style is composed and applied to one of
the parcels.
87
Object Hierarchy
Creating an Alignment
Alignments are usually created in existing sites. Each AeccSite object has its own collection of alignments
held in an AeccAlignments object in the AeccSite.Alignments property. There is also a collection of
alignments that are not associated with a site in the AeccDocument.AlignmentsSiteless property.
Creating an Alignment | 89
as the original, but it does not inherit any station labels, station equations, or design speeds from the original
alignment.
' Add an offset alignment 10.5 units to the left of the
' original.
oAlignment.Offset -10.5
Dim i as Integer
For i = 0 To oAlignment.Entities.Count - 1
Select Case (oAlignment.Entities.Item(i).Type)
Case aeccTangent
Dim oTangent As AeccAlignmentTangent
Set oTangent = oAlignment.Entities.Item(i)
Debug.Print "Tangent length:" & oTangent.Length
Case aeccArc
Dim oArc As AeccAlignmentArc
Set oArc = oAlignment.Entities.Item(i)
Debug.Print "Arc radius:" & oArc.Radius
Case aeccSpiral
Dim oSpiral As AeccAlignmentSpiral
Set oSpiral = oAlignment.Entities.Item(i)
Debug.Print "Spiral A value:" & oSpiral.A
Case aeccSpiralCurveSpiralGroup
Dim oSCSGroup As AeccAlignmentSCSGroup
Set oSCSGroup = oAlignment.Entities.Item(i)
Debug.Print "Radius of curve in SCS group:" _
& oSCSGroup.Arc.Radius
Each entity has an identification number contained in its AeccAlignmentEntity.Id property. Each entity
knows the numbers of the entities before and after it in the alignment, and you can access specific entities
by identification number through the AeccAlignmentEntities.EntityAtId method.
Stations
Stations | 91
The following code changes an alignment so that at a point 80 units from the beginning, stations will start
being numbered from the value 720:
Dim oStationEquation As AeccStationEquation
Set oStationEquation = oAlignment.StationEquations _
.Add(80, 0, 720, aeccIncreasing)
NOTE Some functions, such as AeccAlignment.InstantaneousRadius, require a “raw” station value without
regard to modifications made by station equations.
Superelevation
Another setting that can be applied to certain stations of an alignment is the superelevation, used to adjust
the angle of roadway section components for corridors based on the alignment. The inside and outside
shoulders and road surfaces can be adjusted for both the left and right sides of the road. The collection of
all superelevation information for an alignment is stored in the AeccAlignment.SuperelevationData property.
Note that, unlike most AutoCAD Civil 3D API collections, the Add method does not return a new default
entity but instead passes a reference to the new object through the second parameter. An individual
superelevation data element (type AeccSuperelevationDataElement) can be accessed through the
AeccAlignment.SuperelevationAtStation method.
Superelevation | 93
This code creates a new superelevation data element at station 11+00.00 and sets the properties of that
element:
Dim oSuperElevationData As AeccSuperElevationData
Dim oSuperElevationElem As AeccSuperElevationDataElem
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperLeftOutShoulderCrossSlope) = 0.05
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperLeftOutLaneCrossSlope) = 0.02
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperLeftInLaneCrossSlope) = 0.01
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperLeftInShoulderCrossSlope) = 0.03
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperRightInShoulderCrossSlope) = 0.03
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperRightInLaneCrossSlope) = 0.01
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperRightOutLaneCrossSlope) = 0.02
oSuperElevationElem.SegmentCrossSlope _
(aeccSuperRightOutShoulderCrossSlope) = 0.05
oSuperElevationElem.TransPointType = aeccSuperManual
oSuperElevationElem.TransPointDesc = "Manual adjustment"
oSuperElevationElem.RawStation = 1100
Each superelevation data element represents a point in the transition of the roadway cross section. A single
transition from normal to full superelevation and back is a zone. A collection of data elements representing
a single zone can be retrieved by calling the AeccAlignment.SuperelevationZoneAtStation method.
This sample retrieves the data elements that are part of the superelevation zone starting at station 0+00.00,
and prints all their descriptions:
Set oSuperElevationData = _
oAlignment.SuperelevationZoneAtStation(0)
Alignment Style
<[Station Value(Uft|FS|P0|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Raw Station(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Northing(Uft|P4|RN|AP|Sn|OF)]>
<[Easting(Uft|P4|RN|AP|Sn|OF)]>
<[Design Speed(P3|RN|AP|Sn|OF)]>
<[Instantaneous Direction(Udeg|FDMSdSp|MB|P4|RN|DSn|CU|AP|OF)]>
<[Perpendicular Direction(Udeg|FDMSdSp|MB|P4|RN|DSn|CU|AP|OF)]>
<[Alignment Name(CP)]>
<[Alignment Description(CP)]>
<[Alignment Length(Uft|P3|RN|AP|Sn|OF)]>
Label styles for minor stations, geometry points, design speeds, and station equations can also use the
following property fields:
Label styles are described in detail in the chapter 1 section Label Styles (page 19).
Sample Program
AlignmentSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Alignment\AlignmentSample.dvb
The sample code from this chapter can be found in context in the AlignmentSample.dbp project. This project
can create alignments based on AutoCAD polyline entities or through layout commands. It demonstrates
using styles, label styles, station equations, design speeds, and superelevation.
Creating an Alignment
Alignments are usually created without being associated with an existing site. Each CivilDocument object
has its own collection of alignments not associated with a site accessed with the GetSitelessAlignmentIds()
method. There is also a collection of all alignments (siteless and associated with a site) accessed with
GetAlignmentIds() method. Alignments can be moved into a site with the Alignment.CopyToSite() method.
A siteless alignment can be copied from a sited alignment using Alignment.CopyToSite(), and passing
ObjectId.Null or ““ as the site.
There are two overloads of the create() method for creating alignments from polylines. The first takes a
reference to the CivilDocument object, a PolylineOptions object (which contains the ID of the polyline to
create an alignment from), a name for the new alignment, the ObjectID of a layer to draw to, the ObjectID
of an alignment style, and the ObjectID of a label set object, and returns the OjectID of the new Alignment.
97
The second overload takes the same parameters, except the layer, alignment style, and label set are specified
by name instead of ObjectID.
This code creates an alignment from a 2D polyline, using existing styles:
[CommandMethod("CreateAlignment")]
public void CreateAlignment()
{
doc = CivilApplication.ActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
// uses an existing Alignment Style and Label Set Style named "Basic" (for example, from
// the Civil 3D (Imperial) NCS Base.dwt template. This call will fail if the named
styles
// don't exist.
ObjectId testAlignmentID = Alignment.Create(doc, plops, "New Alignment", "0", "Standard",
"Standard");
}
Here’s a short code snippet that illustrates one of the methods for adding a FixedCurve entitiy to an
alignment’s Entities collection:
Int32 previousEntityId = 0;
Point3d startPoint = new Point3d(8800.7906, 13098.1946, 0.0000);
Point3d middlePoint = new Point3d(8841.9624, 13108.6382, 0.0000);
Point3d endPoint = new Point3d(8874.2664, 13089.3333, 0.0000);
AlignmentArc retVal = myAlignment.Entities.AddFixedCurve(previousEntityId, startPoint,
middlePoint, endPoint);
int i = 0;
// iterate through each Entity and check its type
foreach (AlignmentEntity myAe in align.Entities){
i++;
String msg = "";
switch (myAe.EntityType)
{
case AlignmentEntityType.Arc:
AlignmentArc myArc = myAe as AlignmentArc;
msg = String.Format("Entity{0} is an Arc, length: {1}\n", i, myArc.Length);
break;
case AlignmentEntityType.Spiral:
AlignmentSpiral mySpiral = myAe as AlignmentSpiral;
msg = String.Format("Entity{0} is a Spiral, length: {1}\n", i, mySpir
al.Length);
break;
// we could detect other entity types as well, such as
// Tangent, SpiralCurve, SpiralSpiral, etc.
default:
msg = String.Format("Entity{0} is not a spiral or arc.\n", i);
break;
}
// write out the Entity information
ed.WriteMessage(msg);
}
}
}
Each entity has an identification number contained in its AlignmentEntity.EntityId property. Each entity
knows the numbers of the entities before and after it in the alignment, and you can access specific entities
by identification number through the AlignmentEntityCollection.EntityAtId() method.
Stations | 101
a speed to be used from that station on until the next specified design speed or the end of the alignment,
the design speed number, and an optional string comment.
// Starting at station 0 + 00.00
DesignSpeed myDesignSpeed = myAlignment.DesignSpeeds.Add(0, 45);
myDesignSpeed.Comment = "Straigtaway";
// Starting at station 4 + 30.00
myDesignSpeed = myAlignment.DesignSpeeds.Add(430, 30);
myDesignSpeed.Comment = "Start of curve";
// Starting at station 14 + 27.131 to the end
myDesignSpeed = myAlignment.DesignSpeeds.Add(1427.131, 35);
myDesignSpeed.Comment = "End of curve";
// make alignment design speed-based:
myAlignment.UseDesignSpeed = true;
Superelevation
Another setting that can be applied to certain stations of an alignment is the superelevation, used to adjust
the angle of roadway section components for corridors based on the alignment. The inside and outside
shoulders and road surfaces can be adjusted for both the left and right sides of the road.
NOTE The Superelevation feature was substantially changed in AutoCAD Civil 3D 2011, and the API has also
changed. The Alignment::SuperelevationData property and Alignment::SuperElevationAtStation() method
have been removed. Existing code should be updated to use the new API, and access superelevation via
Alignment::SuperelevationCurves, Alignment::SuperelevationCriticalStations, and
SuperelevationCriticalStationCollection::GetCriticalStationAt().
The superelevation data for an alignment is divided into discrete curves, called superelevation curves, and
each superelevation curve contains transition regions where superelevation transitions from normal roadway
to full superelevation and back (with separate regions for transition in, and transition out of superelvation).
These regions are defined by “critical stations”, or stations where there is a transition in the roadway
cross-section. The collection of superelevation curves for an alignment is accessed with the
Alignment::SuperelevationCurves property, while all critical stations for all curves is accessed with the
Alignment::SuperelevationCriticalStations property. The SuperelevationCurves collection is empty if
superelevation curves have not been added to the alignment (either manually, or calculated by the
Superelevation Wizard in the user interface). The SuperelevationCriticalStations collection contains
default entites for the start and end stations of the Alignment if no superelevation data has been calculated
for the curves.
An individual SuperelevationCriticalStation can be accessed through the
Alignment::SuperelevationCriticalStations::GetCriticalStationAt() method.
[CommandMethod("GetSECurves")]
public void GetSECurves()
{
doc = CivilApplication.ActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.Transac
tionManager.StartTransaction())
{
// get first alignment:
ObjectId alignID = doc.GetAlignmentIds()[0];
Alignment myAlignment = ts.GetObject(alignID, OpenMode.ForRead) as Alignment;
if (myAlignment.SuperelevationCurves.Count < 1)
{
ed.WriteMessage("You must calculate superelevation data.\n");
return;
}
foreach (SuperelevationCurve sec in myAlignment.SuperelevationCurves)
{
ed.WriteMessage("Name: {0}\n", sec.Name);
ed.WriteMessage(" Start: {0} End: {1}\n", sec.StartStation, sec.EndStation);
foreach (SuperelevationCriticalStation sest in sec.CriticalStations)
{
ed.WriteMessage(" Critical station: {0} {1} {2}\n", sest.TransitionRegionType,
sest.Station, sest.StationType);
// try to get the slope:
foreach (int i in Enum.GetValues(typeof(SuperelevationCrossSegmentType)))
{
try
{
// if this succeeds, we know the segment type:
double slope = sest.GetSlope((SuperelevationCrossSegmentType)i,
false);
ed.WriteMessage(" Slope: {0} Segment type: {1}\n",slope,Enum.Get
Name(typeof(SuperelevationCrossSegmentType),i));
}
// silently fail:
catch (InvalidOperationException e) { }
}
}
}
}
}
Superelevation | 103
Alignment Style
<[Station Value(Uft|FS|P0|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Raw Station(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Northing(Uft|P4|RN|AP|Sn|OF)]>
<[Easting(Uft|P4|RN|AP|Sn|OF)]>
<[Design Speed(P3|RN|AP|Sn|OF)]>
<[Instantaneous Direction(Udeg|FDMSdSp|MB|P4|RN|DSn|CU|AP|OF)]>
<[Perpendicular Direction(Udeg|FDMSdSp|MB|P4|RN|DSn|CU|AP|OF)]>
<[Alignment Name(CP)]>
<[Alignment Description(CP)]>
<[Alignment Length(Uft|P3|RN|AP|Sn|OF)]>
Label styles for minor stations, geometry points, design speeds, and station equations can also use the
following property fields:
Label styles are described in detail in the chapter 2 section Label Styles (page 26).
Sample Programs
AlignmentSample
<installation-directory>\Sample\Civil 3D API\DotNet\VB.NET\AlignmentSample
Some of the sample code from this chapter can be found in context in the AlignmentSample project. This
sample shows how to create an alignment, add entities to an alignment, create an alignment label style set,
get a site, and create an alignment style.
Sprial2 Demo
<installation-directory>\Sample\Civil 3D API\DotNet\CSharp\Spiral2 Demo
Demonstrates how to get simple and complex alignment information.
107
Object Hierarchy
Profiles
This section covers the creation and style of profiles. Profiles are the vertical analogue to alignments. Together,
an alignment and a profile represent a 3D path.
' For all profiles that use this style, line elements
' will be yellow, curve elements will be shades of green,
' and extensions will be dark grey. No arrows will be shown.
With oProfileStyle
.ArrowDisplayStyleProfile.Visible = False
.LineDisplayStyleProfile.Color = 50 ' yellow
.LineDisplayStyleProfile.Visible = True
.LineExtensionDisplayStyleProfile.Color = 251 ' grey
.LineExtensionDisplayStyleProfile.Visible = True
.CurveDisplayStyleProfile.Color = 80 ' green
.CurveDisplayStyleProfile.Visible = True
.ParabolicCurveExtensionDisplayStyleProfile.Color = 251 ' grey
.ParabolicCurveExtensionDisplayStyleProfile.Visible = True
.SymmetricalParabolaDisplayStyleProfile.Color = 81 ' green
.SymmetricalParabolaDisplayStyleProfile.Visible = True
.AsymmetricalParabolaDisplayStyleProfile.Color = 83 ' green
.AsymmetricalParabolaDisplayStyleProfile.Visible = True
End With
' Properties for 3d display should also be set.
Profile Views
This section describes the creation and display of profile views. A profile view is a graph displaying the
elevation of a profile along the length of the related alignment.
Graph Title
The title of the graph is controlled by the AeccGraphStyle.TitleStyle property, an object of type
AeccGraphTitleStyle. The title style object can adjust the position, style, and border of the title. The text
of the title can include any of the following property fields:
<[Parent Alignment(CP)]>
<[Drawing Scale(P4|RN|AP|OF)]>
' Adjust the top axis. Put station information here, with
' the title at the far left.
With oProfileViewStyle.TopAxis
.DisplaySyle2d.Visible = True
' Modify the text to display meters in decimal
' format.
.MajorTickStyle.Text = "<[Station Value(Um|FD|P1)]> m"
.MajorTickStyle.Interval = 164.041995
Dim dPoint(0 To 2) As Double
dPoint(0) = 0.13
dPoint(1) = 0#
.TitleStyle.Offset = dPoint
.TitleStyle.Text = "Meters"
.TitleStyle.Position = aeccStart
End With
Sample Programs
ProfileSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Profile\ProfileSample.dvb
This sample creates a surface from a file and an alignment using entities. It creates a profile based on the
existing surface along the alignment. It then creates a second profile using entities and points of vertical
intersection. A profile view is made displaying both profiles. The style and label style of the profile view are
set with custom styles. Data bands are added to the profile view.
CorridorSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Corridor\CorridorSample.dvb
The CreateCorridor method of the Corridor module shows the creation of a profile using entities.
Profiles
Profiles are the vertical analogue to alignments. Together, an alignment and a profile represent a 3D path.
115
method creates a new profile and derives its elevation information from the specified surface along the path
of the alignment.
// Illustrates creating a new profile from a surface
[CommandMethod("ProfileFromSurface")]
public void ProfileFromSurface()
{
doc = CivilApplication.ActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.Transac
tionManager.StartTransaction())
{
// Ask the user to select an alignment
PromptEntityOptions opt = new PromptEntityOptions("\nSelect an Alignment");
opt.SetRejectMessage("\nObject must be an alignment.\n");
opt.AddAllowedClass(typeof(Alignment), true);
ObjectId alignID = ed.GetEntity(opt).ObjectId;
// get layer id from the alignment
Alignment oAlignment = ts.GetObject(alignID, OpenMode.ForRead) as Alignment;
ObjectId layerId = oAlignment.LayerId;
// get first surface in the document
ObjectId surfaceId = doc.GetSurfaceIds()[0];
// get first style in the document
ObjectId styleId = doc.Styles.ProfileStyles[0];
// get the first label set style in the document
ObjectId labelSetId = doc.Styles.LabelSetStyles.ProfileLabelSetStyles[0];
try
{
ObjectId profileId = Profile.CreateFromSurface("My Profile", alignID, surfaceId,
layerId, styleId, labelSetId);
ts.Commit();
}
catch (Autodesk.AutoCAD.Runtime.Exception e)
{
ed.WriteMessage(e.Message);
}
}
}
[CommandMethod("CreateProfileNoSurface")]
public void CreateProfileNoSurface()
{
doc = CivilApplication.ActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.Transac
tionManager.StartTransaction())
{
// Ask the user to select an alignment
PromptEntityOptions opt = new PromptEntityOptions("\nSelect an Alignment");
opt.SetRejectMessage("\nObject must be an alignment.\n");
opt.AddAllowedClass(typeof(Alignment), false);
ObjectId alignID = ed.GetEntity(opt).ObjectId;
oProfile.Entities.AddFreeSymmetricParabolaByLength(oTangent1.EntityId, oTangent2.En
tityId, VerticalCurveType.Sag, 900.1, true);
ts.Commit();
}
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.Transac
tionManager.StartTransaction())
{
// get first profile of first alignment in document
ObjectId alignID = doc.GetAlignmentIds()[0];
Alignment oAlignment = ts.GetObject(alignID, OpenMode.ForRead) as Alignment;
Profile oProfile = ts.GetObject(oAlignment.GetProfileIds()[0], OpenMode.ForRead) as
Profile;
ts.Commit();
}
}
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.Transac
tionManager.StartTransaction())
{
ObjectId profileStyleId = doc.Styles.ProfileStyles.Add("New Profile Style");
ProfileStyle oProfileStyle = ts.GetObject(profileStyleId, OpenMode.ForRead) as Pro
fileStyle;
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.Arrow).Visible
= true;
// set to yellow:
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.Line).Color =
Color.FromColorIndex(ColorMethod.ByAci, 50);
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.Line).Visible =
true;
// grey
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.LineExtension).Col
or = Color.FromColorIndex(ColorMethod.ByAci, 251);
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.LineExtension).Vis
ible = true;
// green
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.Curve).Color =
Color.FromColorIndex(ColorMethod.ByAci, 80);
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.Curve).Visible
= true;
// grey
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.ParabolicCurveEx
tension).Color = Color.FromColorIndex(ColorMethod.ByAci, 251);
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.ParabolicCurveEx
tension).Visible = true;
// green
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.SymmetricalPara
bola).Color = Color.FromColorIndex(ColorMethod.ByAci, 81);
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.SymmetricalPara
bola).Visible = true;
// green
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.AsymmetricalPara
bola).Color = Color.FromColorIndex(ColorMethod.ByAci, 83);
oProfileStyle.GetDisplayStyleProfile(ProfileDisplayStyleProfileType.AsymmetricalPara
bola).Visible = true;
<[Parent Alignment(CP)]>
<[Drawing Scale(P4|RN|AP|OF)]>
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.Database.Transac
tionManager.StartTransaction())
{
// Get the first style in the document's collection of styles
// Adjust the top axis. Put station information here, with the title
// at the far left.
oProfileViewStyle.GetDisplayStylePlan(ProfileViewDisplayStyleType.TopAxis).Visible
= true;
oProfileViewStyle.TopAxis.MajorTickStyle.LabelText = "<[Station Value(Um|FD|P1)]>
m";
oProfileViewStyle.TopAxis.MajorTickStyle.Interval = 164.041995;
oProfileViewStyle.TopAxis.TitleStyle.OffsetX = 0.13;
oProfileViewStyle.TopAxis.TitleStyle.OffsetY = 0.0;
oProfileViewStyle.TopAxis.TitleStyle.Text = "Meters";
oProfileViewStyle.TopAxis.TitleStyle.Location = Autodesk.Civil.DatabaseSer
vices.Styles.AxisTitleLocationType.TopOrLeft;
ts.Commit();
}
}
Sample Programs
Profile Sample
This sample is located in <install directory>\Sample\Civil 3D API\DotNet\VB.NET\ProfileSample\. It illustrates:
125
Sample Lines
This section covers the creation and use of sample lines. Sample lines are line segments placed at regular
intervals across an alignment. They can be used to define the location and orientation of surface cross
sections that can be studied through section views.
' Create a sample line group using the above styles and drawn
' to layer "0".
Dim sLayerName as String
sLayerName = "0"
Dim oSampleLineGroup As AeccSampleLineGroup
Set oSampleLineGroup = oSampleLineGroups.Add( _
"Example Sample Line Group", _
sLayerName, _
oGroupPlotStyle, _
oSampleLineStyle, _
oSampleLineLabelStyle)
This sample demonstrates how to add a single surface to a sample line group and how to add all surfaces in
the drawing to a sample line group:
' Get the section style we need for our sampled surface
' object. We use the default style of the document.
Dim oSectionStyle As AeccSectionStyle
Set oSectionStyle = oDocument.SectionStyles.Item(0)
oSampledSurface.UpdateMode = aeccSectionStateDynamic
' We need to set the Sample property of the
' SampledSurface object. Otherwise the sampled surface
' will not be used in creating sections.
oSampledSurface.Sample = True
At this point you can define sample lines. Sample lines are held in the AeccSampleLineGroup.SampleLines
collection. There are three methods to add sample lines to the collection: AeccSampleLines.AddByPolyline,
AeccSampleLines.AddByStation, and AeccSampleLines.AddByStationRange.
The AeccSampledSurfaces collection can contain objects other than surfaces to be sampled in section views,
such as pipe networks or corridors. These objects can be added from the AutoCAD Civil 3D user interface.
(Currently you can only add surfaces to the AeccSampledSurfaces collection via the API.)
Call oSampleLineGroup.SampleLines.AddByStation( _
"Sample Line 02", _
dStation, _
dSwathWidthLeft, _
dSwathWidthRight)
NOTE The AeccStationRange.SampleLineStyle property must be set to a valid object or the AddByStationRange
method will fail.
The AeccStationRange object is then passed to the AddByStationRange method along with a flag describing
how to deal with duplicates. The sample lines are then generated and added to the
AeccSampleLineGroup.SampleLines collection. This method has no return value.
oSampleLineGroup.SampleLines.AddByStationRange _
"Sample Line 03", _
aeccSampleLineDuplicateActionOverwrite, _
oStationRange
' This style just changes the display of the sample line.
oSampleLineStyle.LineDisplayStyleSection.color = 140 ' slate
Section Styles
The AeccSectionStyle style controls how surface cross sections are displayed in the section view graphs.
The collection of all AeccSectionStyle styles is contained in the AeccDocument.SectionStyles property.
Dim oSectionStyle As AeccSectionStyle
Set oSectionStyle = oDocument.SectionStyles _
.Add("Example cross section style")
Label styles are described in detail in the Chapter 1 section Label Styles (page 19).
Sections
This section covers the creation and use of sections. A section is a cross section of one or more surfaces along
a sample line. A series of sections can be used to analyze the changes in a surface along a path.
Creating Sections
A section is a cross section of one or more surfaces taken along a sample line. You can either create sections
one at a time using the AeccSampleLineGroup.CreateSectionsAtSampleLine method, or all at once using
the AeccSampleLineGroup.CreateSectionsAtSampleLines method. These methods will cause an error if the
sample line group does not reference any surfaces, or if the surface is not located under the sample lines
specified.
' Create a section at the first sample line in the sample
' line group.
' oSampleLineGroup is of type AeccSampleLineGroup
Using Sections
Each sample line contains a collection of sections that were based on that sample line. Each section is
represented by object of type AeccSection and contains methods for retrieving statistics of the surface along
the section. While sections initially have styles based on the AeccSectionStyle style passed to the
' For each sample line, go through all the sections that
' were created based on it.
Dim i As Integer
Dim j As Integer
For i = 0 To oSampleLines.Count - 1
Dim oSections As AeccSections
Set oSections = oSampleLines.Item(i).Sections
' For each section, print its highest elevation and set
' some of its properties.
Dim oSection as AeccSection
For Each oSection in oSections
Debug.Print "Max Elevation of "; oSection.Name;
Debug.Print " is: "; oSection.ElevationMax
oSection.DataType = aeccSectionDataTIN
oSection.StaticDynamic = aeccSectionStateDynamic
Next
Next i
Section Views
This section describes the creation and display of section views. A section view is a graph of a single section.
Usually a series of section views are displayed to demonstrate a range of cross sections.
' Now loop through all the sample lines in the current
' sample line group. For each sample line, we add a
' section view at a unique location with a style and
' a data band that we defined earlier.
Dim dOffsetRight As Double
dOffsetRight = 0
For j = 0 To oSampleLines.Count - 1
Dim oSectionView As AeccSectionView
dOffsetRight = j * 300
Dim dOriginPt(0 To 2) As Double
' To the right of the surface and the previous
' section views.
dOriginPt(0) = dX + 200 + dOffsetRight
dOriginPt(1) = dY
Set oSectionView=oSampleLines.Item(j).SectionViews.Add( _
"Section View" & CStr(j), _
"0", _
dOriginPt, _
oSectionViewStyle, _
Nothing) ' "Nothing" means do not display a data band
Next j
Next i
NOTE While most style properties use drawing units, the Interval property uses surface units.
The AeccTickStyle object also sets what text is displayed at each tick, including any of the following property
fields:
Graph Title
The title of the graph is controlled by the AeccGraphStyle.TitleStyle property, an object of type
AeccGraphTitleStyle. The title style object can adjust the position, style, and border of the title. The text
of the title can include any of the following property fields:
<[Parent Alignment(CP)]>
<[Left Width(Uft|P3|RN|AP|Sn|OF)]>
<[Right Width(Uft|P3|RN|AP|Sn|OF)]>
<[Drawing Scale(P3|RN|AP|OF)]>
'''''''''''''''''''''''''''''''''''''
' Adjust the top axis.
With oSectionViewStyle.TopAxis.MajorTickStyle
.AnnotationDisplayStylePlan.color = 23 ' light brown
.Height = 0.004 ' text height
.AnnotationDisplayStylePlan.Visible = True ' show text
.Interval = 15 ' Major ticks 15 ground units apart
' Each major tick is marked with distance from the
' centerline in meters.
.Text = "<[Section View Point Offset(Um|P1|RN|Sn|AP|OF)]>m"
.DisplayStylePlan.Visible = True ' show ticks
End With
With oSectionViewStyle.TopAxis.TitleStyle
.DisplayStylePlan.color = 23 ' light brown
.Height = 0.008 ' text height
.Text = "Meters"
' Position the title slightly higher.
dOffset(0) = 0#
dOffset(1) = 0.02
.Offset = dOffset
.DisplayStylePlan.Visible = True ' show title
End With
'''''''''''''''''''''''''''''''''''''
' Adjust the graph and graph title.
With oSectionViewStyle.GraphStyle
.VerticalExaggeration = 4.1
' The lowest grid with any part of the section
' line in it will have one empty grid between
' it and the bottom axis.
.GridStyle.GridsBelowDatum = 1
' Increase the empty space above the section
' line to make room for any section line labels.
.GridStyle.GridsAboveMaxElevation = 2
Sample Program
SectionSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Section\SectionSample.dvb
This sample program creates a surface from a file and an alignment from a polyline. Sample lines (using
group sample lines, individual sample lines, and sample lines based on polyline entities) are created across
the alignment. Sections are created from each sample line, and section views of each surface cross section
are drawn. Styles and label styles for sample lines and section views are created, as are data bands for the
section view graphs.
141
Data Band Concepts
Data bands are a way to display more information with profile views and section views, including differences
between sections, profile geometry, and superelevation along an alignment. Data bands consist of one or
more strips at the top or bottom of each graph with tick marks, graphics, and labels describing particular
features of the subject of the graph.
Each collection has an Add method for creating new band styles.
The location of information displayed in the band depends on which band style objects are visible. Each
data location (for example, at profile stations or at horizontal geometry points) consists of multiple style
elements (text labels, tick marks, lines, or blocks). Different band styles have different locations where
information can be displayed, and will display information with different graphical effects.
■ The visual style of the text label (properties ending with “LabelDisplayStylePlan“, objects of type
AeccDisplayStyle).
■ The contents and nature of the text , tick marks, lines, and blocks (properties ending with “LabelStyle“,
objects of type AeccBandLabelStyle).
■ The visual style of the tick mark (properties ending with “TickDisplayStylePlan“, objects of type
AeccDisplayStyle).
The display styles have priority over the label style when setting the color or linetype.
NOTE If either the display style or the label style element is not set to be visible, then the data element is not
visible.
A title can be displayed on the left side of each band. The style of the text and box around the text are
controlled by the AeccBandStyle.TitleBoxTextDisplayStylePlan and
AeccBandStyle.TitleBoxDisplayStylePlan properties, both object of type AeccDisplayStyle. The text of
the title and its location are controlled through the AeccBandStyle.TitleStyle property, an object of type
AeccBandTitleStyle. The AeccBandTitleStyle.Text property contains the actual string to be displayed,
which may include property fields from the following list:
<[Parent Alignment(CP)]>
<[Section1 Name(CP)]>
<[Section1 Type(CP)]>
<[Section2 Name(CP)]>
<[Section2 Type(CP)]>
<[Profile1 Name(CP)]>
<[Profile2 Name(CP)]>
<[Station Value(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Raw Station(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Profile1 Elevation(Uft|P2|RN|AP|Sn|OF)]>
<[Profile2 Elevation(Uft|P3|RN|AP|Sn|OF)]>
With oBandProfileDataStyle
' Add ticks and labels to each horizontal
' geography location.
.HGPLabelDisplayStylePlan.Visible = True
.HGPTickDisplayStylePlan.Color = 10 ' red
.HGPTickDisplayStylePlan.Visible = True
.HGPLabelStyle.TextComponents.Item(0).Contents = _
"<[Station Value(Uft|FS|P0|RN|AP|Sn|TP|B2|EN|W0|OF)]>"
.HGPLabelStyle.TextComponents.Item(0).Color = 11 ' red
.HGPLabelStyle.TextComponents.Item(0).Visibility = True
<[Length(Uft|P2|RN|Sn|OF|AP)]>
<[Tangent Direction(Udeg|FDMSdSp|MB|P6|RN|DSn|CU|AP|OF)]>
<[Start Station(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Start Easting(Uft|P4|RN|AP|Sn|OF)]>
<[Start Northing(Uft|P4|RN|AP|Sn|OF)]>
<[End Station(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[End Easting(Uft|P4|RN|AP|Sn|OF)]>
<[End Northing(Uft|P4|RN|AP|Sn|OF)]>
With oBandHorizontalGeometryStyle
' Add displays and labels for alignment tangents.
.TangentGeometryDisplayStylePlan.Visible = True
.TangentGeometryDisplayStylePlan.Color = 160 ' blue
.TangentLabelDisplayStylePlan.Visible = True
.TangentLabelStyle.TextComponents.Item(0).Contents = _
"Length = <[Length(Uft|P2|RN|Sn|OF|AP)]>"
.TangentLabelStyle.TextComponents.Item(0).Color = 120
.TangentLabelStyle.TextComponents.Item(0). _
Visibility = True
<[Tangent Grade(FP|P2|RN|AP|Sn|OF)]>
With oBandVerticalGeometryStyle
' Add graphical marks that show the uphill or downhill
' directions and the lengths of the vertical segments
' of the profile. On uphill sections the label of the
' length of the segment will be in white, on downhill
' it will be pale yellow. The graphical element that
' shows direction will be pink.
.DownhillTangentLabelStyle.TextComponents.Item(0).
Contents = "<[Tangent Horizontal Length(Uft|P2)]>"
.DownhillTangentLabelStyle.TextComponents.Item(0). _
Color = 51 ' pale yellow
.DownhillTangentLabelStyle.TextComponents.Item(0). _
Visibility = True
.UphillTangentLabelStyle.TextComponents.Item(0).
Contents = "<[Tangent Horizontal Length(Uft|P2)]>"
.UphillTangentLabelStyle.TextComponents.Item(0). _
Color = 255 ' white
.UphillTangentLabelStyle.TextComponents.Item(0). _
Visibility = True
.TangentGeometryDisplayStylePlan.Color = 220 ' pink
.TangentGeometryDisplayStylePlan.Visible = True
.TangentLabelDisplayStylePlan.Visible = True
.TangentGeometryDisplayStylePlan.Visible = True
You can also display a reference line through the center of the data band to help users interpret the element
lines.
The data band can also display tick marks and text labels at points of change in the superelevation of the
alignment. The following can be marked on the data band:
■ Full superelevation
■ Level crown
■ Normal crown
■ Reverse crown
■ Transition segment
The label styles for text labels can use any of the following property fields:
<[Station Value(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
With oBandSuperElevationStyle
' Add graphical display of the slope of the left and right
' outside shoulders. If the line is above the centerline,
' then the slope is positive.
.LeftOutsideShoulderLineDisplayStylePlan.Visible = True
.LeftOutsideShoulderLineDisplayStylePlan.color = 151
' Color 151 = pale blue
.RightOutsideShoulderLineDisplayStylePlan.Visible = True
.RightOutsideShoulderLineDisplayStylePlan.color = 51
' Color 51 = pale yellow
' Add a reference line through the center of the data band.
.ReferenceLineDisplayStylePlan.Visible = True
.ReferenceLineDisplayStylePlan.color = 252 ' gray
<[Section1 Elevation(Uft|P3|RN|AP|Sn|OF)]>
<[Section2 Elevation(Uft|P3|RN|AP|Sn|OF)]>
' Display at every major grid line a tick mark and a label
' that shows the section elevation at that point.
With oBandSectionDataStyle
.MajorOffsetLabelDisplayStylePlan.Color = 255 ' white
.MajorOffsetLabelDisplayStylePlan.Visible = True
.MajorOffsetTickDisplayStylePlan.Color = 255 ' white
.MajorOffsetTickDisplayStylePlan.Visible = True
End With
With oBandSectionDataStyle.MajorIncrementLabelStyle. _
TextComponents.Item(0)
.Contents = "<[Section1 Elevation(Um|P3|RN|AP|Sn|OF)]>m"
.Color = 255 ' white
.Visibility = True
' Shift the label to the high side of the band.
.YOffset = 0.015
End With
' Display a red tick mark and a red label showing section
' elevation at each vertex endpoint in the sample line.
' Make the tick mark large, and only at the top of the
' band.
With oBandSectionDataStyle
.SampleLineVertexLabelDisplayStylePlan.Color = 20 ' red
.SampleLineVertexLabelDisplayStylePlan.Visible = True
.SampleLineVertexTickDisplayStylePlan.Color = 20 ' red
.SampleLineVertexTickDisplayStylePlan.Visible = True
End With
With oBandSectionDataStyle.SampleLineVerticesLabelStyle. _
TextComponents.Item(0)
.Contents = "<[Section1 Elevation(Um|P3|RN|AP|Sn|OF)]>m"
.Color = 20 ' red
.Visibility = True
.YOffset = 0.08
End With
With oBandSectionDataStyle.SampleLineVerticesLabelStyle. _
TickStyle
.IncrementSmallTicksAtTop = True
.IncrementSmallTicksAtMiddle = False
.IncrementSmallTicksAtBottom = False
.SmallTicksAtTopSize = 0.015
End With
Data band sets are used when profile views are first created. The following sample code is taken from the
topic Creating a Profile View (page 112), but this time a data band set is passed in the last parameter.
Set oProfileView = oAlignment.ProfileViews.Add( _
"Profile Style 01", _
"0", _
dOriginPt, _
oProfileViewStyle, _
oProfileViewBandStyleSet)
Data band sets are used when section views are first created. The following sample code is taken from the
Creating Section Views (page 133) section of the Sections (page 125) chapter, but this time a data band set is
passed in the last parameter:
Set oSectionView=oSampleLines.Item(j).SectionViews.Add( _
"Section View" & CStr(j), _
"0", _
dOriginPt, _
oSectionViewStyle, _
oSectionViewBandStyleSet)
TIP If you only want to display information from a single profile in the band, pass the same profile object to both
parameters.
The order of bands in the band set is also the order in which the bands are displayed.
AeccProfileViewBandSet.Add places the new band at the bottom of the list while
AeccProfileViewBandSet.Insert places the new band at the specified index.
TIP You can swap the location of two bands with the AeccProfileViewBandSet.Swap method.
TIP If you only want to display a single section in the band, pass the same section object to both parameters.
The order of bands in the band set is also the order in which the bands are displayed.
AeccSectionViewBandSet.Add places the new band at the bottom of the list while
AeccSectionViewBandSet.Insert places the new band at the specified index.
TIP You can swap the location of two bands with the AeccSectionViewBandSet.Swap method.
This sample adds a data band to a section view that describes the single section “oSection”:
Dim oSectionViewBandSetItem As AeccSectionViewBandSetItem
Set oSectionViewBandSetItem = oSectionView.BandSet.Add( _
oBandSectionDataStyle, _
oSection, _
oSection)
Sample Programs
Profiles.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Profile\ProfileSample.dvb
See the ProfileViewStyle module for an example of the creation of a data band style, the definition of a
data band style set, and the use of that data band set with a profile view.
Sections.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Section\SectionSample.dvb
See the SectionViewStyle module for an example of the creation of a data band style, the definition of a
data band style set, and the use of that data band set with a section view.
Object Hierarchy
159
Base Objects
This section explains how to get the base objects required for using the pipe network API classes.
' Set the default units used for pipes in this document.
With oSettings.PipeSettings.AmbientSettings
.AngleSettings.Unit = aeccAngleUnitRadian
.CoordinateSettings.Unit = aeccCoordinateUnitFoot
.DistanceSettings.Unit = aeccCoordinateUnitFoot
End With
To create your own dynamic properties, you first create a custom parameter describing the type and name
of the property. You do this by using the pipe network catalog definitions object AeccPipeNetworkCatDef,
which you access through the ambient property AeccPipeSettingsRoot.PipeNetworkCatDef. The
AeccPipeNetworkCatDef object creates new parameters using the
AeccPipeNetworkCatDef.DeclareNewParameter method. DeclareNewParameter takes some strings describing
the parameter data type:
■ a global context (the identification string used to access the parameter type)
■ a context description
Once a parameter has been created, it can be made into a property available for use in parts through the
AeccPipeNetworkCatDef.DeclarePartProperty method.
This sample demonstrates declaring a parameter and making a property based on that parameter available
to any pipe objects:
Dim oSettings As AeccPipeSettingsRoot
Dim oPipeNetworkCatDef As AeccPipeNetworkCatDef
oPipeNetworkCatDef.DeclarePartProperty
"Global Context 01", aeccDomPipe, 10
You can now choose from among those properties available to the part’s domain and create a data field.
' Make a data field based on the "Global Context 01"
' property and add it to a pipe object "oPipe". Set
' the value of the data field to "6.5".
Dim oPartDataField As AeccPartDataField
Set oPartDataField = oPipe.PartDataRecord.Append
("Global Context 01", 0)
oPartDataField.Tag = 6.5
Debug.Print: Debug.Print
Debug.Print "PART LIST - "; oPartList.Name
Debug.Print "-------------------------------------------"
' From the part list, looking at only those part families
' that are pipes, print all the individual parts.
Debug.Print " Pipes"
Debug.Print " ====="
For Each oPartFamily In oPartList
' Look for only pipe families.
If (oPartFamily.Domain = aeccDomPipe) Then
sPipeGuid = oPartFamily.guid
Debug.Print " Family: "; oPartFamily.Name
' Go through each part in this family.
For Each oPipeFilter In oPartFamily.SizeFilters
Debug.Print " Part: "; oPipeFilter.Name
Next
End If
Next
' From the part list, looking at only those part families
' that are structures, print all the individual parts.
Debug.Print
Debug.Print " Structures"
Debug.Print " =========="
For Each oPartFamily In oPartList
' Look for only structure families.
If (oPartFamily.Domain = aeccDomStructure) Then
sStructureGuid = oPartFamily.guid
Debug.Print " Family: "; oPartFamily.Name
' Go through each part in this family.
For Each oPipeFilter In oPartFamily.SizeFilters
Debug.Print " Part: "; oPipeFilter.Name
Next
End If
Next
Next
Pipes
This section explains the creation and use of pipes. Pipes represent the conduits within a pipe network.
Creating Pipes
Pipe objects represent the conduits of the pipe network. Pipes are created using the pipe network’s
AeccPipeNetwork.Pipes collection. This collection has methods for creating either straight or curved pipes.
Both methods require you to specify a particular part family (using the GUID of a family) and a particular
part size filter object as well as the starting and ending points of the pipe. The order of the start and end
points may have meaning in describing flow direction.
' Go through the list of part types and select the first
' pipe found.
Set oSettings = oPipeDocument.Settings
' Get all the parts list in the drawing.
Set oPartLists = oSettings.PartLists
' Get the first part list found.
Set oPartList = oPartLists.Item(0)
For Each oPartFamily In oPartList
' Look for a pipe family.
If (oPartFamily.Domain = aeccDomPipe) Then
sPipeGuid = oPartFamily.guid
' Get the first size filter list from the family.
Set oPipeFilter = oPartFamily.SizeFilters.Item(0)
Exit For
End If
Next
Using Pipes
To make a new pipe a meaningful part of a pipe network, it must be connected to structures or other pipes
using the AeccPipe.ConnectToStructure or AeccPipe.ConnectToPipe methods, or structures must be
connected to it using the AeccStructure.ConnectToPipe method. Connecting pipes together directly creates
a new virtual AeccStructure object to serve as the joint. If a pipe end is connected to a structure, it must be
disconnected before attempting to connect it to a different structure. After a pipe has been connected to a
network, you can determine the structures at either end by using the StartStructure and EndStructure
properties or by using the Connections property, which is a read-only collection of network parts. There are
' Modify the colors of pipes using this style when shown in
' plan view.
oPipeStyle.DisplayStylePlan(aeccDispCompPipeOutsideWalls) _
.Color = 40 ' orange
oPipeStyle.DisplayStylePlan(aeccDispCompPlanInsideWalls) _
.Color = 255 ' white
oPipeStyle.DisplayStylePlan(aeccDispCompPipeEndLine) _
.color = 255 ' white
NOTE The label style of a particular pipe cannot be set using the API.
Pipe label styles can use the following property fields in the contents of any text component.
<[Wall Thickness(Uin|P3|RN|AP|Sn|OF)]>
<[Material(CP)]>
<[Manning Coefficient(P3|RN|AP|Sn|OF)]>
<[Name(CP)]>
<[Description(CP)]>
<[Network Name(CP)]>
<[Start Offset(Uft|P3|RN|AP|Sn|OF)]>
<[End Offset(CP)]>
<[Pipe Slope(FP|P2|RN|AP|Sn|OF)]>
<[Pipe Bearing(Udeg|FDMSdSp|MB|P6|RN|DSn|CU|AP|OF)]>
<[Pipe Radius(Uft|P3|RN|AP|Sn|OF)]>
<[Minimum Cover(Uft|P3|RN|AP|Sn|OF)]>
<[Maximum Cover(Uft|P3|RN|AP|Sn|OF)]>
Structures
This section describes the creation and use of structures. Structures are the connectors within a pipe network.
Creating Structures
Structures represent physical objects such as manholes, catch basins, and headwalls. Logically, structures
are used as connections between pipes at pipe endpoints. In cases where two pipes connect directly, an
AeccStructure object not representing any physical object is still created to serve as the joint. Any number
of pipes can connect with a structure. Structures are represented by objects of type AeccStructure, which
are created by using the Add method of the Surfaces collection of AeccPipeNetwork.
Structures | 169
This sample uses the first structure family and size filter it can find in the part list and creates a new structure
based on that part type.
Dim oStructure as AeccStructure
Dim oSettings As AeccPipeSettingsRoot
Dim oPartLists As AeccPartLists
Dim oPartList As AeccPartList
Dim sStructureGuid As String
Dim oStructureFilter As AeccPartSizeFilter
' Go through the list of part types and select the first
' structure found.
Set oSettings = oPipeDocument.Settings
' Get all the parts list in the drawing.
Set oPartLists = oSettings.PartLists
' Get the first part list found.
Set oPartList = oPartLists.Item(0)
For Each oPartFamily In oPartList
' Look for a structure family that is not named
' "Null Structure".
If (oPartFamily.Domain = aeccDomStructure) And _
(oPartFamily.Name = "Null Structure") Then
sStructureGuid = oPartFamily.guid
' Get the first size filter list from the family.
Set oStructureFilter = oPartFamily.SizeFilters.Item(0)
Exit For
End If
Next
Using Structures
To make the new structure a meaningful part of a pipe network, it must be connected to pipes in the network
using the AeccStructure.ConnectToPipe method or pipes must be connected to it using the
AeccPipe.ConnectToStructure method. After a structure has been connected to a network, you can determine
the pipes connected to it by using the Connections property, which is a read-only collection of network
parts. There are also methods and properties for setting and determining all types of physical measurements
oStructureStyle.DisplayStylePlan(aeccDispCompStructure).color = 30
oStructureStyle.PlanOption.MaskConnectedObjects = True
NOTE The label style of a particular structure cannot be set using the API.
<[Name(CP)]>
<[Description(CP)]>
<[Network Name(CP)]>
<[Structure Station(Uft|FS|P2|RN|AP|Sn|TP|B2|EN|W0|OF)]>
<[Structure Offset(Uft|P3|RN|AP|Sn|OF)]>
<[Connected Pipes(Sn)]>
<[Structure Northing(Uft|P4|RN|AP|Sn|OF)]>
<[Structure Easting(Uft|P4|RN|AP|Sn|OF)]>
<[Sump Elevation(Uft|P3|RN|AP|Sn|OF)]>
<[Sump Depth(P3|RN|AP|Sn|OF)]>
<[Structure Shape(CP)]>
<[Wall Thickness(Uin|P3|RN|AP|Sn|OF)]>
<[Floor Thickness(Uin|P3|RN|AP|Sn|OF)]>
<[Material(CP)]>
<[Frame(CP)]>
<[Grate(CP)]>
<[Cover(CP)]>
<[Frame Height(Uin|P3|RN|AP|Sn|OF)]>
<[Frame Diameter(Uin|P3|RN|AP|Sn|OF)]>
<[Frame Length(Uin|P3|RN|AP|Sn|OF)]>
<[Frame Width(Uin|P3|RN|AP|Sn|OF)]>
<[Barrel Height(Uft|P3|RN|AP|Sn|OF)]>
<[Cone Height(Uin|P3|RN|AP|Sn|OF)]>
<[Slab Thickness(Uin|P3|RN|AP|Sn|OF)]>
Interference Checks
This section explains how to generate and examine an interference check. An interference check is used to
determine when pipe network parts are either intersecting or are too close together.
If (oInterferenceCheck.Count = 0) Then
MsgBox "There are no interferences in the network."
End If
There are three different styles of interference displays you can chose from. First, you can display a 3D model
of the intersection region. This is done by setting the ModelOptions style property to
aeccTrueSolidInterference. The ModelSolidDisplayStyle2D property, an object of type AeccDisplayStyle,
controls the visible appearance of the model such as color and line types. Make sure the
ModelSolidDisplayStyle2D.Visible property is set to True.
Another possibility is to draw a 3D sphere at the location of intersection. This is done by setting the
ModelOptions style property to aeccSphereInterference. If the InterferenceSizeType property is set to
aeccSolidExtents, then the sphere is automatically sized to just circumscribe the region of intersection
(that is, it is the smallest sphere that still fits the model of the intersection region). You can set the size of
the sphere by setting the InterferenceSizeType property to aeccUserDefined, setting the ModelSizeOptions
property to use either absolute units or drawing units, and setting the corresponding AbsoluteModelSize or
DrawingScaleModelSize property to the desired value. Again, the ModelSolidDisplayStyle2D property
controls the visual features such as color and line type. Make sure the ModelSolidDisplayStyle2D.Visible
property is set to True.
This sample creates a new interference style object that displays an X symbol with a superimposed circle at
points of intersection:
' Create a new interference style object.
Dim oInterferenceStyle As AeccInterferenceStyle
Set oInterferenceStyle = oPipeDocument.InterferenceStyles _
.Add("Interference style 01")
Sample Program
PipeSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Pipe\PipeSample.dvb
The sample code from this chapter can be found in context in the PipeSample.dvb project. This sample
creates a simple pipe network, creates and applies a new style, and performs an interference check.
Base Objects
This section explains how to get the base objects required for using the pipe network API classes.
179
the name of the default styles for pipe and structure objects as well as the default label placement, units,
and naming conventions for pipe networks as a whole.
public void ShowPipeRules()
{
CivilDocument doc = CivilApplication.ActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
SettingsPipeNetwork oSettingsPipeNetwork = doc.Settings.GetSettings<SettingsPipeNetwork>()
as SettingsPipeNetwork;
ed.WriteMessage("Using pipe rules: {0}\n", oSettingsPipeNetwork.Rules.Pipe.Value);
// Set the default units used for pipes in this document.
oSettingsPipeNetwork.Angle.Unit.Value = Autodesk.Civil.AngleUnitType.Radian;
oSettingsPipeNetwork.Coordinate.Unit.Value = Autodesk.Civil.LinearUnitType.Foot;
oSettingsPipeNetwork.Distance.Unit.Value = Autodesk.Civil.LinearUnitType.Foot;
}
Dynamic properties created with the NetworkCatalogDef class are not yet supported by the .NET API.
Pipes
This section explains the creation and use of pipes. Pipes represent the conduits within a pipe network.
Using Pipes
To make a new pipe a meaningful part of a pipe network, it must be connected to structures or other pipes
using the Pipe.ConnectToStructure() or Pipe.ConnectToPipe() methods, or structures must be connected
to it using the Structure.ConnectToPipe() method. Connecting pipes together directly creates a new virtual
Structure object to serve as the joint. If a pipe end is connected to a structure, it must be disconnected
before attempting to connect it to a different structure. After a pipe has been connected to a network, you
can determine the structures at either end by using the StartStructureId and EndStructureId properties.
There are methods and properties for setting and determining the flow direction, getting all types of physical
measurements, and for accessing collections of user-defined properties for custom descriptions of the pipe.
NOTE The label style of a particular pipe cannot be set using the .NET API.
Structures
This section describes the creation and use of structures. Structures are the connectors within a pipe network.
Creating Structures
Structures represent physical objects such as manholes, catch basins, and headwalls. Logically, structures
are used as connections between pipes at pipe endpoints. In cases where two pipes connect directly, an
Structure object not representing any physical object is still created to serve as the joint. Any number of
pipes can connect with a structure. Structures are represented by objects of type Structure, which are created
by using the AddStructure() method of Network.
See the code sample in Creating a Pipe Network (page 183) for an example of how to call this method.
Using Structures
To make the new structure a meaningful part of a pipe network, it must be connected to pipes in the network
using the Structure.ConnectToPipe() method or pipes must be connected to it using the
Pipe.ConnectToStructure() method. After a structure has been connected to a network, you can determine
the pipes connected to it by using the ConnectedPipe property, which is a read-only collection of network
parts. There are also methods and properties for setting and determining all types of physical measurements
for the structure and for accessing collections of user-defined properties for custom descriptions of the
structure.
NOTE The label style of a particular structure cannot be set using the .NET API.
Sample Program
PipeSample
<installation-directory>\Sample\Civil 3D API\DotNet\VB.NET\PipeSample
Some of the sample code from this chapter can be found in context in the PipeSample project. This sample
creates a simple pipe network, creates pipe, structure and interference styles, creates a parts list, and prints
a hierarchy of part types available in a document, separated into pipe and structure domains.
Subassembly Changes
The “target mapping’ feature in AutoCAD Civil 3D 2011 has changed, which affects how custom subassemblies
are written. This feature now allows a subassembly to target object types in addition to alignments and
profiles associated with the corridor that it requires to define its geometry. For more information about this
feature, see Setting Targets in the AutoCAD Civil 3D User’s Guide.
There are four changes to the way you write a custom subassembly:
193
New parameter types in ParamLogicalNameType
A subassembly can now target an offset target and elevation target (instead of an alignment and a profile),
which are represented by new parameter types in ParamLogicalNameType. If you want to support the new
target types in your subassemblies, you need to replace:
■ ParamLogicalNameType.Alignment with
■ ParamLogicalNameType.OffsetTarget — offset targets that are alignments, feature lines, survey figures
and AutoCAD polylines OR
■ ParamLogicalNameType.Profile with
■ ParamLogicalNameType.ElevationTarget — elevation targets that are profiles, feature lines, survey
figures and AutoCAD 3D polylines OR
Changes to CalcAlignmentOffsetToThisAlignment()
The CalcAlignmentOffsetToThisAlignment() utility method now calculate the offset from this alignment
to the offset target. This method no longer returns the station value; it now returns the XY coordinate of
the offset target at the point perpendicular to the alignment’s station.
■ Use a combination of upper and lower case letters, with uppercase letters reserved for the first character
of each word.
■ Group subassemblies by making the type of component the first word. For example, in the AutoCAD
Civil 3D Corridor Modeling catalogs all lane subassembly names begin with “Lane”, all shoulders with
“Shoulder”, and so on.
■ Medians. Medians tend to be inserted in both the left and right directions simultaneously about a
centerline (which is not necessarily the corridor baseline alignment). Furthermore, the attachment point
may not be a point on the median surface links. For example, the attachment point for a depressed
median subassembly may be above the median ditch at the elevation of the inside edges-of-traveled-way.
■ Components Joining Two Roadways. When modeling separated roadways in a single corridor model, it
is often necessary to insert intersection fill slopes, or to connect from one edge-of-roadway to another.
Typically, you assemble the components for as much of the first roadway as possible, switch baselines
and assemble the components for the second roadway, then use special subassemblies to connect between
the two roadways. In this case, two attachment points are needed. Do this by creating a subassembly
with a normal attachment point on one side, and which attaches to a previously defined marked point
on the other.
■ Rehabilitation and Overlay. Typically, subassemblies that are used to strip pavement, level, and overlay
existing roads are placed based on calculations involving the shape of the existing roadway section,
rather than using a design centerline alignment and profile. For example, a pavement overlay subassembly
may require a minimum vertical distance from the existing pavement for a given design slope. A
Ratio Slopes Cut slopes, fill slopes, ditch side slopes, median slopes, and
many other roadway components are commonly expressed
Point, Link, and Shape In most cases, point, link, and shape codes should be hard-
Codes coded to ensure that consistent codes are assigned across the
entire assembly. The primary exception is with generic link
subassemblies that allow users to add links to the assembly as
needed. These might be used for paved or unpaved finish
grade, structural components, pavement subsurfaces, and
many other unanticipated components. In these scenarios, the
end-user assigns point, link, and shape codes that coordinate
with the overall assembly.
■ Pivot point and PGL are at the inside edge-of-traveled-way on a divided road.
■ Pivot point is at the edge-of-traveled-way on the inside of the curve, while the PGL is at the centerline
of the road.
■ On a divided road with crowned roadways, the PGL is at the crown points, while the pivot point is at
the inside edge-of-traveled-ways.
■ On a divided road with uncrowned roadways, the PGL and pivot point is above the median at the
centerline.
Whatever the situation, the subassemblies must be designed so that they can be placed with the correct
behavior.
Sometimes the roadway components have special behavior in superelevated sections. Some examples of
special superelevation behavior:
■ Broken Back Subbase. Some agencies put a break point in the subbase layer on the high side of
superelevation. The subbase parallels the finish grade up to a certain point, then extends at a downward
slope until it intersects the shoulder or clear zone link.
■ Curbs-and-Gutters. Some agencies require that gutters on the high side of a superelevated road tip
downward toward the low side, while others leave the gutters at their normal slope.
NOTE When writing your custom subassembly, avoid writing code that makes AutoCAD calls and interrupts
AutoCAD Civil 3D subassembly operations during runtime. For example, avoid building selection sets.
■ From a Tool Palette. Right-click a subassembly in a tool palette, then click Help.
■ From a Tool Catalog. Right-click a subassembly in a tool catalog, then click Help.
■ From the Subassembly Properties dialog box Parameters tab. Right-click a subassembly in the Prospector
tree, then click Properties ➤ Parameters tab ➤ Subassembly Help.
When creating custom subassemblies, you should also create a custom Help file to accompany the
subassembly. You can use just about any type of document file (.dwf, .doc, .pdf, .txt, .chm, .hlp) to create the
subassembly Help file. For more information, see Creating Customized Help in the AutoCAD Developer
Help.
The Help file content and style should be similar to that in the AutoCAD Civil 3D Subassembly Reference
Help. The table below describes the sections that should be included, as a minimum, in subassembly Help
files. This information is required so that users understand the subassembly behavior and intended use.
Section Description
Descriptions A brief description of the subassembly that includes the type of compon-
ent the subassembly creates (for example, a lane, median, or shoulder),
special features, and situations it is designed to cover.
Attachment Describes where the attachment point is located relative to the sub-
assembly links.
Input Para- Describes each of the user-definable input parameters that can be spe-
meters cified when using the subassembly. These should precisely match the
parameter names and order seen by the user when using the assembly
layout tool, and should describe the effect of each parameter. These
are best presented in a table that includes a description of each para-
meter, the type of input expected, and default values for metric or im-
perial unit projects. For input parameters for slope values, note that
there are two common ways of specifying slopes: as a percent value
like -2%, or as a run-to-rise ratio like 4 : 1. Any slope parameter should
clearly specify which type is expected. In the subassemblies included in
the AutoCAD Civil 3D Corridor Modeling catalog, the convention is to
precede the word “Slope” with the “%” character in the parameter
name if a percent slope is expected. Otherwise a ratio value is required.
Note the practice of using positive numeric values for both cut and fill
slopes. If a slope parameter is known to be used only in a fill condition,
it should not be necessary for the user to have to specify a negative
slope value. However, in a more generic situation, for example with the
LinkWidthAndSlope subassembly, a signed value may be necessary.
Target Para- Describes the parameters in the subassembly that can be mapped to
meters one or more target objects.
Input parameters are defined when building an assembly in layout
mode. Target parameters are substitutions that can be made for input
parameters when applying the assembly to a corridor model. Typically,
subassembly parameters that can use a target object to define a width
or an offset can use the following types of objects to define that width
or offset: alignments, AutoCAD polylines, feature lines, or survey figures.
Similarly, subassembly parameters that can use a target object to define
an elevation can use the following types of objects to define that eleva-
tion: profiles, AutoCAD 3D polylines, feature lines, or survey figures.
Subassemblies that can use a target object to define a surface can only
use a surface object to define that surface. A few subassemblies allow
you to use pipe network objects as targets, such as the TrenchPipe
subassemblies.
A typical scenario is a travel lane where the width is a numeric input
parameter, which can use an alignment as a target parameter to replace
the numeric width. The given numeric width is used when displaying
the lane in layout mode. If an alignment is given, the width is calculated
at each station during corridor modeling to tie to the offset of the
alignment. For more information, see Setting Targets in the AutoCAD
Civil 3D User's Guide Help.
Layout Mode During the process of creating an assembly from subassemblies, also
Operation known as the assembly layout mode, specific information such as
Layout Mode A diagram illustrating layout mode behavior and visual representation
Diagram is useful if layout mode behavior and/or visual representation of the
subassembly differs significantly between layout mode when the as-
sembly and its associated subassemblies are applied to a corridor.
Point, Link, Describes the items that are hard-coded into the subassembly, including
and Shape dimensions, point codes, link codes, and shape codes. Common practice
Codes is to reference the point, link, and shape codes to labels on the coding
diagram.
Coding Dia- The coding diagram has a twofold purpose. First, it labels the point,
gram link, and shape numbers referred to in the previous section. Secondly,
it provides the subassembly programmer with a numbering scheme for
points, links, and shapes. These should correspond to the array indices
used in the script for points, links, and shapes. This is to make it easier
to later modify or add to the subassembly.
After creating the custom Help files for custom subassemblies, you must reference the Help files in the tool
catalog .atc file associated with the subassemblies. For more information, see Sample Tool Catalog ATC Files
(page 213).
The following table lists all the functions within the Utility class:
The CodesSpecific.vb and Utilities.vb files are located in the <AutoCAD Civil 3D Install Directory>\Sample\Civil 3D
API\C3DStockSubAssemblies directory.
Overview
An Autodesk tool catalog organizes groups of customized subassemblies and makes them available to AutoCAD
Civil 3D users. Autodesk tool catalogs are defined using xml-formatted files with an .atc (Autodesk Tool
Catalog) extension. You also need to create a catalog registry file as catalogs must be registered in the Windows
registry. Some items within the .atc and registry files must contain unique identifiers known as GUIDs (Global
Unique Identifiers). New GUIDs can be created using the GuidGen.exe utility that is included with many
Microsoft development products and is freely available for download from the Microsoft web site.
1 Using Notepad or any other appropriate editor, create a plain ASCII text file named <Name>Tools
Catalog.atc, where <Name> is the name of this new tool catalog. For information about the contents of
the file, see Creating a Tool Catalog ATC File (page 213).
NOTE XML tags in ATC files are case-sensitive. Be sure that your tags match the case of the tags described
in this chapter.
2 Save the .atc file to the location where your tool catalogs are stored. The default location is C:\Documents
and Settings\All Users\Application Data\Autodesk\C3D2010\enu\Tool Catalogs\Road CatalogC:\Documents
and Settings\All Users\Application Data\Autodesk\Civil2010\enu\Tool Catalogs\Road Catalog.
3 Create any optional files, such as images for icons displayed in the catalog and help files for
subassemblies, and place these files in appropriate locations for reference.
4 Using Notepad or any other text editor, create a registry file for the tool catalog with the extension .reg.
For more information, see Creating a Tool Catalog Registry File (page 222).
5 Register the tool catalog by double-clicking on the .reg file. Once registered, the subassembly tool catalog
will be displayed in the AutoCAD Civil 3D Content Browser.
NOTE XML tags in ATC files are case-sensitive. Make sure the tags in your files match the case of the tags defined
in this chapter.
1-40 The <Catalog> section contains the entire contents of the catalog
file.
2 This <ItemID> defines the GUID for the catalog. The same GUID
must be used in the registry file to identify this catalog.
5-7 <Images> defines the image file for the icon that appears for the
catalog in the catalog browser. Images used for catalogs and sub-
assemblies should be a 64-by-64 pixel image. Valid image file types
include .bmp, .gif, .jpg, and .png.
10 <Time> defines the time and date the catalog was created in the
universal date/time format. This information is required, but not
used. Any date or time may be given.
21-33 Definition of the “Getting Started“ category. This block has been
designed to load all category information from a separate file. Cat-
egory information can also be placed within this file if you only
want one .atc file by using a <Category> section as described in the
Tool File Example (page 216)
22 <ItemID> defines the unique GUID for this category. It must be the
same GUID as in the separate category .atc file.
2 <ItemID> defines the unique GUID for this category. It must be the
same GUID as in the parent catalog .atc file.
31 <Time> defines the time and date the catalog was created in the
universal date/time format. This information is required, but not
used. Any date or time may be given.
38 <DotNetClass> is a new tag that lists the .NET assembly and class
which contains the subassembly. The VBA equivalent is the <Macro>
tag. Note that all paths specified in the ATC file must be relative
paths to the ATC file itself.
39 The .dll containing the resource strings and images used by the
subassembly tool.
3-9 These statements create a Group for the Autodesk Content Browser.
The group id name is “Roads Group”. Each group must have a
unique GUID for the “ItemID”. The Roads Group is already registered
by the AutoCAD Civil 3D installation. If you are adding a catalog
to this group, you should use the GUID shown in the example.
15 “ItemId” must be a unique GUID for this catalog. This must match
the GUID for the Catalog ItemID value in the catalog .atc file.
16 “Image” must be a unique GUID for this catalog. This must match
the GUID for the Catalog ItemID value in the catalog .atc file.
21 “ToolTip” – the text that displays for the tooltip when the cursor is
hovered over the tool catalog in the Catalog Browser.
22 “GroupType” – the GUID that defines which the tool catalog be-
longs to in the Catalog Browser. This GUID must match the one
used for the “ItemID” in the group definition.
NOTE It’s simpler to create a subassembly package file to distribute to users than to install custom subassemblies
manually. See Exporting Custom Subassemblies Using a Package File (page 224).
1 Copy the compiled AutoCAD Civil 3D subassembly .dll library to its destination directory. By default,
libraries are located in <AutoCAD Civil 3D Install Directory>\Sample\Civil 3D API\C3DstockSubAssemblies.
2 Copy the tool catalog .atc files to its destination directory. The tool catalog files are normally located
in the C:\Documents and Settings\All Users\Application Data\Autodesk\C3D2010\enu\Tool Catalogs\Road
CatalogC:\Documents and Settings\All Users\Application Data\Autodesk\Civil2010\enu\Tool Catalogs\Road
Catalog directory. For information about creating these, see Creating a Tool Catalog ATC File (page 213).
3 Copy optional files such as the image file representing the subassemblies or the help file to their
destination directory. Images are normally located in C:\Documents and Settings\All Users\Application
Data\Autodesk\C3D2010\enu\Tool Catalogs\ImagesC:\Documents and Settings\All Users\Application
Data\Autodesk\Civil2010\enu\Tool Catalogs\Images, and help files are normally located in C:\Documents
and Settings\All Users\Application Data\Autodesk\C3D2010\enu\Tool Catalogs\HelpC:\Documents and
Settings\All Users\Application Data\Autodesk\Civil2010\enu\Tool Catalogs\Help, although these can be
any directory as long as the .atc file has the correct relative path information. For information about
creating help files, see Creating Subassembly Help Files (page 198)
4 Copy the catalog cover page .html file to its destination. Usually this is the same location as the .atc
file, although it can be any directory as long as the .atc file has the correct relative path information.
For information about creating cover pages, see Creating a Tool Catalog Cover Page (page 221).
NOTE Subassemblies created from polylines cannot be included in a package file. Package files are intended for
sharing custom subassemblies that have been created using .NET or VBA.
File Description
.atc file(s) A valid .atc file that defines the shape and behavior of the subassembly or sub-
assemblies is required. You can have one or more .atc files included in the
package file. For example, you can have one .atc file that defines one or more
subassemblies, or you can have multiple .atc files, each of which defines one
or more subassemblies. If the package file contains multiple .atc files, each .atc
file must have a unique name. All the paths referenced in .atc file must be relative
paths, if they point to files in the same .pkt file.
.dll or .dvb file(s) A .dll file is required for subassemblies that are defined using .NET. A .dvb file
is required for subassemblies that are defined using VBA. A package file can
contain both .dll and .dvb files.
Help file(s) A Help file is not required in order for a subassembly to function properly.
However, the Help file is needed for others to understand how to use the sub-
assembly. Therefore, it is recommended that you always include a Help file with
each subassembly. The Help file for each subassembly is specified in the .atc
file, and can be any of the following formats: .dwf, .doc, .pdf, .txt, .chm, .hlp.
For more information, see Creating Subassembly Help Files (page 198).
Image file(s) An image file for each is displayed on the tool palette and is used to provide a
conceptual graphical representation of the subassembly shape.
1 Copy all of the required subassembly files into a folder. Make sure that folder contains only the files
required for the subassembly or subassemblies you plan to export.
The package (.pkt) file is created and can be shared with other users.
Root Objects
This section explains how to get the base objects required for using the roadway API classes.
227
Object Hierarchy
Ambient Settings
Ambient settings allow you to get and set the unit and default property settings of roadway objects. Ambient
settings for a corridor document are held in the AeccRoadwayDocument.Settings property, an object of type
AeccRoadwaySettingsRoot. AeccRoadwaySettingsRoot inheirits all the properties of the AeccSettingsRoot
class from which it is derived.
The roadway-specific properies of AeccRoadwaySettingsRoot let you adjust the settings for corridors,
assemblies, subassemblies, and quantity takeoffs:
<[Next Counter(CP)]>
<[Corridor Name(CP)]>
...for AeccSettingsCorridor.ProfileFromFeatureLineNameTemplate
<[Next Counter(CP)]>
<[Corridor Name(CP)]>
<[Next Counter(CP)]>
<[Profile Type]>
' Set the template so that new corridors are named "Corridor"
' followed by a unique number followed by the name of the
' corridor's first assembly in parenthesis.
oRoadwaySettings.CorridorSettings.NameTemplate = _
"Corridor <[Next Counter(CP)]>(<[Corridor First Assembly(CP)]>)"
Default styles are set through the AeccSettingsCorridor.StyleSettings property. The styles for corridor
alignments, alignment labels, code sets, surfaces, feature lines, profiles, profile labels, and slope pattern are
accessed through a series of string properties.
This sample sets the style of alignments in a corridor to the first alignment style in the document’s collection
of styles:
' Get a reference to the corridor settings object.
Dim oSettingsCorridor As AeccSettingsCorridor
Set oSettingsCorridor = oRoadwayDocument.Settings.CorridorSettings
' Get the name of the first alignment style in the collection.
Dim sName As String
sName = oRoadwayDocument.AlignmentStyles.Item(0).Name
<[Next Counter(CP)]>
<[Corridor Name(CP)]>
...for AeccSettingsAssembly.GroupNameTemplate
<[Next Counter(CP)]>
Default styles are set through the AeccSettingsCorridor.StyleSettings property. The styles for assemblies
and code sets are accessed through string properties.
<[Next Counter(CP)]>
<[Subassembly Side]>
<[Next Counter(CP)]>
<[Subassembly Side]>
The name of the default code style set is accessed through the AeccSettingsSubassembly.CodeSetStyle
string property.
Each of these settings properties also contain a standard AmbientSettings property of type
AeccSettingsAmbient for setting the default units of measurement.
Corridors
Corridor Concepts
A corridor represents a path, such as a road, trail, railroad, or airport runway. The geometry of a corridor is
defined by a horizontal alignment and a profile. Together, these form the baseline - the centerline of the
3D path of the corridor. Along the length of the baselines are a series of assemblies which define the
cross-sectional shape of the alignment. Common points in each assembly are connected to form feature
lines. Together the assemblies and feature lines form the 3D shape of a corridor. A corridor also has one or
more surfaces which can be compared against an existing ground surface to determine the amount of cut
or fill required.
Listing Corridors
The collection of all corridors in a document are held in the AeccRoadwayDocument.Corridors property.
Corridors | 231
The following sample displays the name and the largest possible triangle side of every corridor in a document:
Dim oCorridors As AeccCorridors
Set oCorridors = oRoadwayDocument.Corridors
Creating Corridors
The corridors collection includes a AeccCorridors.Add method for creating new corridors. This method
creates the corridor based on an existing alignment, profile, and assembly.
NOTE The station distance between assemblies cannot be set through the API, and needs to be set through the
property page dialog box before the AeccCorridors.Add method is called.
Baselines
A baseline represents the centerline of the path of a corridor. It is based on an alignment (the horizontal
component of the path) and a profile (the vertical component of the path). A corridor can contain more
than one baseline if the corridor is modeling a complicated shape, such as an intersection. A baseline is
made up of one or more baseline regions. Each region has its own assembly (its own cross section), so a
corridor can have different shapes at different locations along its length.
NOTE The station distance between assemblies cannot be set through the API, and needs to be set through the
property page dialog box before this method is called.
The following sample adds a baseline using an existing alignment, profile, and assembly:
Set oBaseline = oCorridor.AddBaseline _
(oAlignment.Name, oProfile.Name, oAssembly.Name)
New stations can be added to baselines and baseline regions using the AddStation method. Existing stations
can be deleted using the DeleteStation method. DeleteStation includes an optional tolerance parameter,
letting you specify a station within a range. You can list all of the stations added to a baseline region with
the AeccBaselineRegion.GetAdditionalStation method. AeccBaselineRegion.ClearAdditionalStations
removes all added stations within a baseline region and leaves only the original stations created at regular
intervals.
' Add an assembly to the baseline at station 12+34.5
oBaseline.AddStation 1234.5, "Station description"
' Remove the station located within 0.1 units around 5+67.5
oBaseline.DeleteStation 567.5, 0.1
NOTE The AutoCAD Civil 3D API does not include methods for creating new offset baselines or hardcoded offset
baselines.
' Report the offset of the baseline at its start and end.
vOE = oOffsetBaseline. _
GetOffsetElevationFromMainBaselineStation(dMainStart)
Debug.Print " is offset by: " & _
vOE(0) & " horizontal and: " & vOE(1) & _
" vertical at start"
vOE = oOffsetBaseline. _
GetOffsetElevationFromMainBaselineStation(dMainEnd)
Debug.Print " is offset by: " & vOE(0) & _
" horizontal and: " & vOE(1) & " vertical at end"
Case aeccCorridorHardcodedOffsetBaseline
Dim oHardcodedOffsetBaseline As AeccHardcodedOffsetBaseline
Set oHardcodedOffsetBaseline = oBaseBaseline
NOTE The AutoCAD Civil 3D API does not include methods for creating or modifying assemblies.
Object Hierarchy
An AeccAppliedAssembly object does not contain its baseline station position. Instead, each calculated point
contains a method for determining its position with a baseline station, offset, and elevation called
AeccCalculatedPoint.GetStationOffsetElevationToBaseline. Each calculated shape contains a collection
of all links that form the shape, and each calculated link contains a collection of all points that define the
link. Finally, each shape, link, and point contain an array of all corridor codes that apply to that element.
This sample retrieves all calculated point in an applied assembly and prints their locations:
Dim oPoint As AeccCalculatedPoint
For Each oPoint In oAppliedAssembly.GetPoints()
Dim vPos As Variant
vPos = oPoint.GetStationOffsetElevationToBaseline()
Debug.Print "Position: Station = " & vPos(0) & _
" Offset = " & vPos(1) & " Elevation = " & vPos(2)
Next
Applied subassemblies also contain a reference to the archetype subassembly (of type AeccSubassembly) in
the subassembly database.
' Get information about the subassembly template.
Dim oSubassembly As AeccSubassembly
Set oSubassembly = oAppliedSubassembly.SubassemblyDbEntity
Debug.Print "Subassembly name: " & oSubassembly.Name
NOTE You can create feature lines from polylines using the IAeccLandFeatureLine:: AddFromPolyline()
method.
Object Hierarchy
' [...]
' This section is the same as the previous topic.
Each offset baseline and hardcoded offset baseline also has direct access to the feature lines related to itself.
The AeccBaselineFeatureLines collection is accessed through the RelatedOffsetBaselineFeatureLines
property in both types of offset baselines.
Corridor Surfaces
Corridor surfaces can represent the base upon which the corridor is constructed, the top of the finished
roadway, or other aspects of the corridor. Such surfaces are represented by the AeccSurface class and by the
unrelated AeccCorridorSurface class. AeccCorridorSurface objects contain corridor-specific information
about the surfaces, such as which feature line, point, and link codes were used to create it.
Object Hierarchy
NOTE The AutoCAD Civil 3D API does not include methods for creating new corridor surfaces or modifying
existing corridor surfaces.
This sample lists all the corridor surfaces within a corridor and specifies which point codes were used:
Dim oCorridorSurface As AeccCorridorSurface
For Each oCorridorSurface In oCorridor.CorridorSurfaces
Debug.Print "Surface name: "; oCorridorSurface.Name
NOTE The AutoCAD Civil 3D API does not include methods for creating or modifying corridor boundaries or
masks.
Styles
These style objects control the visual appearance of applied assemblies.
Assembly Style
The collection of all assembly style objects are found in the AeccRoadwayDocument.AssemblyStyles property.
The assembly style object contains properties for adjusting the marker types for the assembly attachment
Styles | 243
points, each of the standard AeccMarkerType property. While you can create new styles and edit existing
styles, you cannot assign a style to an existing assembly using the AutoCAD Civil 3D API.
' Create a new assembly style and change it so that the
' place where the assembly attaches to the main baseline
' is marked with a red X.
Dim oAssemblyStyle As AeccAssemblyStyle
Set oAssemblyStyle = oRoadwayDocument.AssemblyStyles.Add("Style1")
With oAssemblyStyle.MarkerStyleAtMainBaseline
.CustomMarkerStyle = aeccCustomMarkerX
.MarkerDisplayStylePlan.Color = 10 ' red
.MarkerDisplayStylePlan.Visible = True
End With
Link Style
The collection of all link style objects are found in the AeccRoadwayDocument.LinkStyles property. This
style object contains properties for adjusting the visual display of assembly and subassembly links.
NOTE Link style objects are not used directly with link objects, but are instead used with roadway style sets.
Shape Style
The collection of all shape style objects are found in the AeccRoadwayDocument.ShapeStyles property. This
style object contains properties for adjusting the visual display of assembly and subassembly shapes, including
the outline and the inside area.
NOTE Shape style objects are not used directly with shape objects, but are instead used with roadway style sets.
' Create a new style set using our previously created styles.
Dim oStyleSet As AeccRoadwayStyleSet
Set oStyleSet = oRoadwayDocument.StyleSets.Add("Style Set 01")
Call oStyleSet.Add( _
aeccLinkType, _
"TOP", _
g_oRoadwayDocument.LinkStyles.Item("Style2"))
Call oStyleSet.Add( _
aeccShapeType, _
"BASE", _
oRoadwayDocument.ShapeStyles.Item("Style3"))
' Assign our new style set as the style set in current use.
oStyleSet.InitAsCurrent
Sample Program
CorridorSample.dvb
<installation-directory>\Sample\Civil 3D API\Vba\Corridor\CorridorSample.dvb
The CreateCorridorExample subroutine demonstrates the creation of a simple corridor using the
AeccCorridors.Add method. Before calling this subroutine, be sure the current document contains at least
one assembly. A suitable drawing is the file Corridor-2b.dwg located in the <installation-directory>\Help\Civil 3D
Tutorials\Drawings directory.
The GetCorridorInformationExample subroutine extracts information of all existing corridors, baselines,
feature lines, surfaces, assemblies, and subassemblies within the current document and displays the data in
an instance of Word. A suitable drawing is the file Corridor-4b.dwg located in the <installation-directory>\Help\Civil
Tutorials\Drawings directory.
Root Objects
Ambient Settings
Ambient settings allow you to get and set the unit and default property settings of roadway objects. Ambient
settings for a corridor are accessed with the SettingsCorridor object returned by
CivilDocument.Settings.GetFeatureSettings() method.
247
Valid property fields for SettingsCorridor.SettingsNameFormat.Corridor
<[Next Counter(CP)]>
<[Corridor Name(CP)]>
...for SettingsCorridor.SettingsNameformat.ProfileFromFeatureLine
<[Next Counter(CP)]>
<[Corridor Name(CP)]>
<[Next Counter(CP)]>
<[Profile Type]>
Default styles are set through the SettingsCorridor.StyleSettings property. The styles for corridor
alignments, alignment labels, code sets, surfaces, feature lines, profiles, profile labels, and slope pattern are
accessed through a series of string properties.
This sample sets the style of alignments in a corridor to the first alignment style in the document’s collection
of styles:
using (Transaction ts = Application.DocumentManager.MdiActiveDocument.
Database.TransactionManager.StartTransaction())
{
// Get the name of the first alignment style in the collection.
ObjectId alignId = doc.Styles.AlignmentStyles[0];
Alignment oAlignment = ts.GetObject(alignId, OpenMode.ForRead) as Alignment;
// Assign the name to alignment style property.
oCorridorSettings.Styles.Alignment.Value = oAlignment.Name;
}
<[Next Counter(CP)]>
<[Corridor Name(CP)]>
...for SettingsAssembly.NameFormat.Group
<[Next Counter(CP)]>
<[Next Counter(CP)]>
<[Subassembly Side]>
<[Next Counter(CP)]>
<[Subassembly Side]>
NOTE The name of the default code style set cannot be set with the .NET API.
Corridors
Corridor Concepts
A corridor represents a path, such as a road, trail, railroad, or airport runway. The geometry of a corridor is
defined by a horizontal alignment and a profile. Together, these form the baseline - the centerline of the
3D path of the corridor. Along the length of the baselines are a series of assemblies which define the
Corridors | 249
cross-sectional shape of the alignment. Common points in each assembly are connected to form feature
lines. Together the assemblies and feature lines form the 3D shape of a corridor. A corridor also has one or
more surfaces which can be compared against an existing ground surface to determine the amount of cut
or fill required.
Listing Corridors
The collection of all corridors in a document are held in the CivilDocument.CorridorCollection property.
The following sample displays the name and the largest possible triangle side of every corridor in a document:
public static void ListCorridors()
{
CivilDocument doc = CivilApplication.ActiveDocument;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
Creating Corridors
You cannot add new Corridors to a document using the .NET API.
Baselines
A baseline represents the centerline of the path of a corridor. It is based on an alignment (the horizontal
component of the path) and a profile (the vertical component of the path). A corridor can contain more
than one baseline if the corridor is modeling a complicated shape, such as an intersection. A baseline is
made up of one or more baseline regions. Each region has its own assembly (its own cross section), so a
corridor can have different shapes at different locations along its length.
New stations can be added to baseline regions using the AddStation() method. Existing stations can be
deleted using the DeleteStation method. DeleteStation includes an optional tolerance parameter, letting
NOTE The AutoCAD Civil 3D .NET API does not include methods for creating new offset baselines or hardcoded
offset baselines.
break;
case CorridorBaselineType.HardcodedOffsetBaseline:
HardcodedOffsetBaseline hob = (HardcodedOffsetBaseline)ob;
ed.WriteMessage("Hardcoded offset baseline {0} \n",
hob.Name);
ed.WriteMessage(" is offset by: {0} horizontal and {1} vertical\n",
hob.OffsetElevationFromMainBaseline.X,
hob.OffsetElevationFromMainBaseline.Y);
break;
default:
break;
}
}
NOTE The AutoCAD Civil 3D .NET API does not include methods for creating or modifying assemblies.
The following sample displays information about the construction of an assembly for every assembly in a
baseline region:
// List the applied assemblies in the baseline region
foreach (AppliedAssembly oAppliedAssembly in oBaselineRegion.AppliedAssemblies)
{
ed.WriteMessage("Applied Assembly, num shapes: {0}, num links: {1}, num points: {2}\n",
oAppliedAssembly.Shapes.Count, oAppliedAssembly.Links.Count, oApplie
dAssembly.Points.Count);
An AppliedAssembly object does not contain its baseline station position. Instead, each calculated point
contains a property for determining its position with a baseline station, offset, and elevation called
CalculatedPoint.StationOffsetElevationToBaseline. Each calculated shape contains a collection of all
links that form the shape, and each calculated link contains a collection of all points that define the link.
Finally, each shape, link, and point contain an array of all corridor codes that apply to that element.
This sample retrieves all calculated points in an applied assembly and prints their locations:
foreach (CalculatedPoint oPoint in oAppliedAssembly.Points)
{
ed.WriteMessage("Point position: Station: {0}, Offset: {1}, Elevation: {2}\n",
oPoint.StationOffsetElevationToBaseline.X,
oPoint.StationOffsetElevationToBaseline.Y,
oPoint.StationOffsetElevationToBaseline.Z);
Applied subassemblies also contain an ObjectId reference to the archetype subassembly (of type Subassembly)
in the subassembly database.
// Get information about the subassembly template:
ObjectId oID = oAppliedSubassembly.SubassemblyId;
Subassembly oSubassembly = ts.GetObject(oID, OpenMode.ForRead) as Subassembly;
ed.WriteMessage("Subassembly name: {0}\n", oSubassembly.Name);
NOTE Creating feature lines from polylines is not supported in the .NET API. However, you can use the COM API
IAeccLandFeatureLine:: AddFromPolyline() method.
}
}
Each offset baseline and hardcoded offset baseline also has direct access to the feature lines related to itself.
The BaselineFeatureLines collection is accessed through the RelatedOffsetBaselineFeatureLines property
in both types of offset baselines.
Corridor Surfaces
Corridor surfaces can represent the base upon which the corridor is constructed, the top of the finished
roadway, or other aspects of the corridor. Such surfaces are represented by the Surface class and by the
unrelated CorridorSurface class. CorridorSurface objects contain corridor-specific information about the
surfaces, such as which feature line, point, and link codes were used to create it.
NOTE The AutoCAD Civil 3D .NET API does not include methods for creating new corridor surfaces or modifying
existing corridor surfaces.
NOTE The AutoCAD Civil 3D .NET API does not include methods for creating or modifying corridor boundaries
or masks.
ed.WriteMessage(oCorridorSurfaceBoundary.Name);
Styles
These style objects control the visual appearance of applied assemblies.
Assembly Style
The collection of all assembly style objects are found in the CivilDocument.Styles.AssemblyStyles property.
The assembly style object contains properties for adjusting the marker types for the assembly attachment
ts.Commit();
}
Link Style
The collection of all link style objects are found in the CivilDocument.Styles.LinkStyles property. This
style object contains properties for adjusting the visual display of assembly and subassembly links.
NOTE Link style objects are not used directly with link objects, but are instead used with roadway style sets.
ts.Commit();
Shape Style
The collection of all shape style objects are found in the CivilDocument.ShapeStyles property. This style
object contains properties for adjusting the visual display of assembly and subassembly shapes, including
the outline and the inside area.
NOTE Shape style objects are not used directly with shape objects, but are instead used with roadway style sets.
ts.Commit();
NOTE You cannot set the CodeSetStyle to be the currently used style with the .NET API. However, you can get
the ObjectId for the currently used style by calling CodeSetStyle.GetCurrentStyleSetId().
ts.Commit();
261
262 | Appendix A Object Hierarchy
AutoCAD Civil 3D | 263
264 | Appendix A Object Hierarchy
Legend
Graphic Meaning
Procedure
This section describes the steps required to convert a VBA subassembly to VB.NET. Although this procedure
only describes converting the subassembly to VB.NET, you can use a similar approach to convert the
subassembly to another .NET language, such as C#.
Where applicable, a regular expression is suggested to automate some of the changes required. In most cases,
using regular expressions can reduce the time required to port a custom subassembly. See the MSDN help
topic on Regular Expressions and Replace in Files for more information.
■ acdbmgd.dll
■ acmgd.dll
■ AecBaseMgd.dll
■ AeccDbMgd.dll
267
Add the following framework to the Visual Basic subassembly class module:
Public Class UserDefinedSA
Inherits SATemplate
' Member Variables.
Protected Overrides Sub GetLogicalNamesImplement(ByVal corridorState As
Autodesk.Civil.Runtime.CorridorState)
' Todo
End Sub
Protected Overrides Sub GetInputParametersImplement(ByVal corridorState As CorridorState)
' Todo
End Sub
Protected Overrides Sub GetOutputParametersImplement(ByVal corridorState As CorridorState)
' Todo
End Sub
Protected Overrides Sub DrawImplement(ByVal corridorState As CorridorState)
' Todo
End Sub
End Class
Note that:
■ You must override the DrawImplement() method, otherwise the subassembly will do nothing.
■ The other overridden methods may be removed if they are not used.
■ You can add your own functions and subroutines within the class's scope.
From To
UserdefinedSA_GetLogicalNames() GetLogicalnamesImplement()
UserdefinedSA() DrawImplement()
■ Autodesk.Civil
■ Autodesk.Civil.ApplicationServices
■ Autodesk.Civil.DatabaseServices
■ Autodesk.Civil.Land
■ Autodesk.Civil.Land.DatabaseServices
■ Autodesk.Civil.Land.Settings
■ Autodesk.Civil.Roadway
■ Autodesk.Civil.Roadway.DatabaseServices
■ Autodesk.Civil.Roadway.Settings
■ Autodesk.Civil.Runtime
■ Autodesk.Civil.Settings
Regular expression:
■ Find: On Error{.*}
■ Leave the Replace field blank if you want to delete these statements. Use ' On Error\1 if you only want
to comment them out.
Remove all the Exit Sub and Error Handler: statements at the end of each subroutine. In VBA, you may
see following code at the end of each subroutine - remove it, or move it into the appropriate Catch statement
when converting error handling logic in step 14.
Exit Sub
ErrorHandler:
RecordError Err.Number, Err.Description, Err.Source
Regular expression:
■ Find: Exit Sub{ *}\n{ *}\n{ *}ErrorHandler\:{ *}\n{ *}RecordError.+{ *}\n{ *}{End Sub}
■ Replace: \8
The corridorState object is already passed in by the argument of the subroutine, so it is not necessary to
get it yourself.
Regular expression:
Regular expression:
■ Find: oRwyState
■ Replace: corridorState
Regular expression:
Regular expression:
■ Find: {Record}{Warning|Error}{\(}{aecc}{RoadwayError}
■ Replace: Utilities.Record\2\3roadwayState,RoadwayError.
From To
g_sSide Utilities.Side
g_iLeft Utilities.Left
g_iRight Utilities.Right
g_iTrue Utilities.ITrue
Rounding_Option.NoneType Utilities.RoundingOption.None-
Type
CutSituation Utilities.FillOrCut.FillSitu-
ation
SubbaseType Utilities.ShoulderSubbase-
Type.Subbase
As a rule, the corresponding .NET enumerations are named by removing the "aecc" prefix and making the
detail category a child member. For example, aeccParamLogicalNameTypeAlignment becomes
ParamLogicalNameType.Alignment.
The following table lists some commonly used COM enumerations and their corresponding .NET
enumerations.
From To
aeccParamLogicalNameTypeAlign- ParamLogicalNameType.Alignment
ment
aeccRoadwayModeLayout CorridorMode.Layout
aeccParamAccessOutput ParamAccessType.Output
From To
IAeccParamsDouble ParamDoubleCollection
IAeccRoadwayLinks LinkCollection
IAeccParam Param
AeccRoadwayLink Link
AeccParamLong ParamLong
Regular expressions:
■ Replace: \1Param\2Collection\3
■ Replace: \1\2Collection\3
■ Replace: \1\2\3
■ Replace: \1Param\2\3
These four regular expressions do not cover all the required changes, so you will have to make additional
changes manually.
From To
g_AllCodes.g_sHinge_Cut.sCode Codes.HingeCut.Code
g_AllCodes.g_sDaylight.sCode Codes.Daylight.Code
g_AllCodes.g_sDaylight_Cut.sCode Codes.DaylightCut.Code
Regular expression:
■ Find: g_All{Codes\.}g_s{.+\.}s{.+}
■ Replace: \1\2\3
If this array is passed as an argument to a method, you will need to do more work. In this case, the array is
most likely used from index “0”. You need to modify all the code that uses this array to take into account
the change in index numbering.
Then, to use the database object's instance, you have to use TransactionManager.GetObject() to open the
database object.
' VBA:
Dim oCurrentAlignment As AeccAlignment
GetAlignmentAndOrigin(oRwyState, oCurrentAlignment, oOrigin)
In .NET:
' .NET:
Dim currentAlignmentId As ObjectId
Dim currentAlignment As Alignment
Utilities.GetAlignmentAndOrigin(corridorState, currentAlignmentId, origin)
' ...
Dim db As Database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase
Dim tm As Autodesk.AutoCAD.DatabaseServices.TransactionManager = db.TransactionManager
currentAlignment = tm.GetObject(currentAlignmentId, OpenMode.ForRead, false, false)
The .atc file format for .NET subassemblies is largely the same as for VBA subassemblies except that two new
tags are used:
<GeometryGenerateMode>UseDotNet</GeometryGenerateMode> <GeometryGenerateMode> tells Civil 3D that
you are using a .NET subassembly. It is placed within the <Tool> tag.<DotNetClass
Assembly="%AECCCONTENT_DIR%\C3DStockSubassemblies.dll">Subassembly.NewCurb</DotNetClass> <DotNetClass>
is used instead of <Macro> tag when using .NET subassemblies
Samples
All of the following are located in the <installation-directory>\Sample\Civil 3D API\COM directory.
Managed C++
.\VC++\Managed C++\C3DManagedExample.vcproj
Using COM interops, launches AutoCAD Civil 3D and creates a dialog box that displays some information
about the current drawing or adds sample lines into the alignments of any selected sites.
277
C++ Using Custom UI
.\VC++\CustomEvent\Sample\C3DCustomUI.vcproj
Demonstrates UI customization. This project adds a button to the Properties Property sheet that opens a
custom dialog for TIN surfaces. It requires the Autodesk ObjectARX libraries.
C#
.\CSharp\CSharpClient\CSharpClientSample.csproj
Creates a dialog box that lets you launch AutoCAD Civil 3D and determine simple information about the
current drawing.
279 | Index
horizontal geometry styles 146 parcel segments 80–81
profile styles 144 styles 83
styles 153 pipe documents 160, 179
superelevation styles 150 ambient settings 160, 179
vertical geometry styles 148 interference check 174–175
section views styles 176, 191
adding to a view 158 pipe network
creating 156 creating 164, 183
database object 17 PipeNetworkCommandsSettings 161
directions 37 pipes
document object 16 creating 164, 185
dynamic part properties 161, 180
parts list 162, 180
E styles 166, 186
entities using 165, 185
alignment 90, 99 point groups
profiles 109, 116 creating 53
PVIs 110, 118 QueryBuilder 54
Event Viewer 17 TIN surfaces 55
events using 55
adding 17 points
exportTo description keys 52
method 22, 29 export to file 48
extended properties 36 import from file 48
point groups 53
points collection 47
F style 50
profile views
feature lines 238, 255 creating 112, 120
offset baselines 239, 255 data bands 144
styles 112, 120
I axis style 112, 121
axis tick marks 113, 121
interference check 174–175 graph style 113, 121
styles 176, 191 graph title 113, 122
profiles
creating from surface 109, 115
L creating using entities 109, 116
label styles 19, 26 PVIs 110, 118
creating 20, 27 styles 111, 118
defining 20, 27 PVI (points of vertical intersection) 110, 118
property fields 21, 28
S
N sample lines 126
non-control points 39 adding sample lines
at a station 129
by range 129
P from a polyline 128
setup 126
package file creating 126
custom subassemblies 224 creating sections 132
package files sample line groups 126, 132
creating 225 styles 130
parcel segments 80–81 section views
parcel loops 82 creating 133
styles 83 styles 134
parcels axis style 135
creating 80 axis tick marks 135
parcel loops 82
280 | Index
graph style 136 from LandXML file 58
graph title 136 using AddGridSurface 60
sections using AddTinSurface 59
creating 132 volume surfaces 60
section views 133 cut and fill 242
using 132 elevation analysis 71
setups 38 extracting contours 69
sharing custom subassemblies 224 masks 241, 257
sites snapshots 63
creating 80 styles 70
station equations 91, 101 TIN surfaces
stations 91, 101 breaklines 65
station sets 92, 101 contours 68
structures point files 64
creating 169, 189 point groups 65
dynamic part properties 161, 180 watershed analysis 72
parts list 162, 180 survey
styles 171, 189 ambient settings 33
using 170, 189 equipment database 34
styles figures
exporting 22, 29 adding arcs 42
subassemblies 235, 253 adding lines 41
attachment 195 adding to drawing 42
CorridorState 201 creating 41
example 203 effect on sites and parcels 42
Help files 198 effect on surfaces 43
installing 223 prefix database 43
naming 195 styles 43
parameters 196 network
superelevation 197 adding to drawing 40
support files 201 control points 37
template program 200 creating 37
tool catalog 213 directions 37
cover page 221 non-control points 39
creating 213 setups 38
data types 220 traverses 40
example 214 project
registry file 222 creating 35
superelevation 93, 102, 197 settings 36
data bands 150 root objects 32
surface analysis user settings 33
elevation analysis 71
watershed analysis 72
surfaces T
boundaries 61, 241, 257 ThisObject 15
collection 57
corridor surfaces 240–241, 256
creating V
from .tin file 59
from DEM file 59, 63 VBA commands 5
Index | 281
282