ebook img

AutoCAD Civil 3D API Developer's Guide PDF

419 Pages·2012·2.02 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview AutoCAD Civil 3D API Developer's Guide

AAutoCAD® Civil 3D® 22013 AAPI Deveelopper’s Guiide April2012 Contents Chapter 1 API Developer's Guide . . . . . . . . . . . . . . . . . . . . . . . 1 About the Developer's Guide . . . . . . . . . . . . . . . . . . . . . . . . 1 Intended Audience . . . . . . . . . . . . . . . . . . . . . . . . . . 1 AutoCAD Civil 3D APIs . . . . . . . . . . . . . . . . . . . . . . . . 1 Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 New Features in the .NET API . . . . . . . . . . . . . . . . . . . . 4 Legal Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Setting up a .NET Project for AutoCAD Civil 3D . . . . . . . . . . . 9 Running Commands from the Toolbox . . . . . . . . . . . . . . 14 Running Commands from the Toolbox . . . . . . . . . . . 15 Migrating COM code to .NET . . . . . . . . . . . . . . . . . . . . 16 Base Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Transactions and ObjectIds . . . . . . . . . . . . . . . . . . 16 Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Limitations and Using Interop . . . . . . . . . . . . . . . . 19 Root Objects and Common Concepts . . . . . . . . . . . . . . . . . . 21 Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Accessing Application and Document Objects . . . . . . . . 22 Using Collections Within the Document Object . . . . . . . 22 Accessing and Using the Database Object . . . . . . . . . . 24 Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 i Accessing Drawing, Feature, and Command Settings . . . . 24 Label Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Creating a Label Style Object . . . . . . . . . . . . . . . . . 27 Defining a Label Style . . . . . . . . . . . . . . . . . . . . . 27 Using Property Fields in Label Style Text . . . . . . . . . . . 29 Sharing Styles Between Drawings . . . . . . . . . . . . . . . 30 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Accessing Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Surface Properties . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Creating Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Creating a TIN Surface from a TIN file . . . . . . . . . . . . 36 Creating a TIN Surface using TinSurface.Create() . . . . . . 37 Creating a Grid Surface from a DEM File . . . . . . . . . . . 39 Creating a GridSurface with GridSurface.Create() . . . . . . 40 Creating a Volume Surface . . . . . . . . . . . . . . . . . . 41 Working with Surfaces . . . . . . . . . . . . . . . . . . . . . . . 42 Adding a Boundary . . . . . . . . . . . . . . . . . . . . . . 42 Adding Data from DEM Files . . . . . . . . . . . . . . . . . 44 Improving Performance by Using Snapshots . . . . . . . . . 44 Working with TIN Surfaces . . . . . . . . . . . . . . . . . . . . . 45 Adding Point Data to a TIN Surface . . . . . . . . . . . . . . 45 Adding Points Using Point Groups . . . . . . . . . . . . . . 48 Smoothing a TIN Surface . . . . . . . . . . . . . . . . . . . 48 Adding A Breakline to a TIN Surface . . . . . . . . . . . . . 50 Adding a Wall Breakline . . . . . . . . . . . . . . . . . . . 53 Importing Breaklines from a File . . . . . . . . . . . . . . . 53 Adding Contours to a TIN Surface . . . . . . . . . . . . . . 54 Extracting Contours . . . . . . . . . . . . . . . . . . . . . . 55 Surface Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Creating and Changing a Style . . . . . . . . . . . . . . . . 57 Assigning a Style to a Surface . . . . . . . . . . . . . . . . . 58 Surface Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Creating an Elevation Analysis . . . . . . . . . . . . . . . . 60 Accessing a Watershed Analysis . . . . . . . . . . . . . . . . 62 Calculating Bounded Volumes . . . . . . . . . . . . . . . . 63 Alignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Basic Alignment Operations . . . . . . . . . . . . . . . . . . . . 65 Creating an Alignment . . . . . . . . . . . . . . . . . . . . 65 Defining an Alignment Path Using Entities . . . . . . . . . 67 Determining Entities Within an Alignment . . . . . . . . . 68 Stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 Modifying Stations with Station Equations . . . . . . . . . 70 Creating Station Sets . . . . . . . . . . . . . . . . . . . . . 70 Specifying Design Speeds . . . . . . . . . . . . . . . . . . . 71 Finding the Location of a Station . . . . . . . . . . . . . . . 72 ii | Contents Superelevation . . . . . . . . . . . . . . . . . . . . . . . . . 72 Alignment Style . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Creating an Alignment Style . . . . . . . . . . . . . . . . . 74 Alignment Label Styles . . . . . . . . . . . . . . . . . . . . 76 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Creating a Profile From a Surface . . . . . . . . . . . . . . . 79 Creating a Profile Using Entities . . . . . . . . . . . . . . . 80 Editing Points of Vertical Intersection . . . . . . . . . . . . 82 Creating a Profile Style . . . . . . . . . . . . . . . . . . . . 83 Profile Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Creating a Profile View . . . . . . . . . . . . . . . . . . . . 85 Creating Profile View Styles . . . . . . . . . . . . . . . . . . 86 Setting Profile View Styles . . . . . . . . . . . . . . . . . . . 86 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Pipe Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Base Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Accessing Pipe Network-Specific Base Objects . . . . . . . . 92 Pipe-Specific Ambient Settings . . . . . . . . . . . . . . . . 92 Listing and Adding Dynamic Part Properties . . . . . . . . . 93 Retrieving the Parts List . . . . . . . . . . . . . . . . . . . . 94 Creating a Pipe Network . . . . . . . . . . . . . . . . . . . 96 Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Creating Pipes . . . . . . . . . . . . . . . . . . . . . . . . . 98 Using Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Creating Pipe Styles . . . . . . . . . . . . . . . . . . . . . 100 Creating Pipe Label Styles . . . . . . . . . . . . . . . . . . 103 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Creating Structures . . . . . . . . . . . . . . . . . . . . . 103 Using Structures . . . . . . . . . . . . . . . . . . . . . . . 103 Creating Structure Styles . . . . . . . . . . . . . . . . . . . 104 Creating Structure Label Styles . . . . . . . . . . . . . . . 105 Interference Checks . . . . . . . . . . . . . . . . . . . . . . . . 106 Performing an Interference Check . . . . . . . . . . . . . 106 Listing the Interferences . . . . . . . . . . . . . . . . . . . 106 Interference Check Styles . . . . . . . . . . . . . . . . . . 106 Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Corridors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Accessing Corridor-Specific Base Objects . . . . . . . . . . 108 Ambient Settings . . . . . . . . . . . . . . . . . . . . . . . 109 Corridors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 Corridor Concepts . . . . . . . . . . . . . . . . . . . . . . 112 Listing Corridors . . . . . . . . . . . . . . . . . . . . . . . 112 Creating Corridors . . . . . . . . . . . . . . . . . . . . . . 113 Contents | iii Baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Listing Baselines in a Corridor . . . . . . . . . . . . . . . . 114 Adding a Baseline to a Corridor . . . . . . . . . . . . . . . 114 Listing Baseline Regions . . . . . . . . . . . . . . . . . . . 114 Accessing and Modifying Baseline Stations . . . . . . . . . 115 Listing Offset Baselines . . . . . . . . . . . . . . . . . . . 116 Assemblies and Subassemblies . . . . . . . . . . . . . . . . . . . 117 Listing Applied Assemblies in a Baseline Region . . . . . . 118 Getting Applied Subassembly Information . . . . . . . . . 119 Feature Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Listing Feature Lines Along a Baseline . . . . . . . . . . . 120 Listing Feature Lines Along Offset Baselines . . . . . . . . 121 Corridor Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Listing Corridor Surfaces . . . . . . . . . . . . . . . . . . . 122 Listing Surface Boundaries . . . . . . . . . . . . . . . . . . 123 Computing Cut and Fill . . . . . . . . . . . . . . . . . . . 125 Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Assembly Style . . . . . . . . . . . . . . . . . . . . . . . . 125 Link Style . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Shape Style . . . . . . . . . . . . . . . . . . . . . . . . . . 126 Roadway Style Sets . . . . . . . . . . . . . . . . . . . . . . 127 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Using the Points Collection . . . . . . . . . . . . . . . . . . . . 128 Using Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Bulk Editing Points . . . . . . . . . . . . . . . . . . . . . 130 Point User-Defined Properties . . . . . . . . . . . . . . . . 131 Point Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Using Point Groups . . . . . . . . . . . . . . . . . . . . . 134 Adding Points to Point Groups with Queries . . . . . . . . 135 Point Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Creating Point Styles . . . . . . . . . . . . . . . . . . . . . 139 Creating Point Label Styles . . . . . . . . . . . . . . . . . 140 Using Point Description Keys . . . . . . . . . . . . . . . . 141 Creating Custom Subassemblies Using .NET . . . . . . . . . . . . . . 143 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Subassembly Changes . . . . . . . . . . . . . . . . . . . . . . . 144 Designing Custom Subassemblies . . . . . . . . . . . . . . . . . 146 Naming Custom Subassemblies . . . . . . . . . . . . . . . 146 Attachment and Insertion Methodology . . . . . . . . . . 146 User-defined vs. Hard-coded Parameters . . . . . . . . . . 147 Input Parameter Types . . . . . . . . . . . . . . . . . . . . 148 Superelevation Behavior and Subassemblies . . . . . . . . 149 Creating Subassembly Help Files . . . . . . . . . . . . . . 152 Structure of Subassembly Programs . . . . . . . . . . . . . . . . 156 The Subassembly Template (SATemplate.vb) . . . . . . . . 156 The Corridor State Object . . . . . . . . . . . . . . . . . . 157 iv | Contents Support Files (CodesSpecific.vb, Utilities.vb) . . . . . . . . 157 Sample VB.NET Subassembly . . . . . . . . . . . . . . . . . . . 160 The Subassembly Tool Catalog . . . . . . . . . . . . . . . . . . 174 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 Creating a Tool Catalog ATC File . . . . . . . . . . . . . . 175 Creating a Tool Catalog Cover Page . . . . . . . . . . . . . 185 Creating a Tool Catalog Registry File . . . . . . . . . . . . 186 Installing Custom Subassemblies . . . . . . . . . . . . . . . . . 188 Exporting Custom Subassemblies Using a Package File . . . . . . 189 Exporting Custom Subassemblies Using a Package File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Converting VBA Subassemblies to .NET . . . . . . . . . . . . . . . . . 191 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Create the Visual Basic.NET Subassembly Module . . . . . 191 Copy Subassembly Code . . . . . . . . . . . . . . . . . . . 193 Port the VBA Code to Visual Basic .NET Code . . . . . . . 193 Final Adjustments . . . . . . . . . . . . . . . . . . . . . . 202 Installing the New Subassembly . . . . . . . . . . . . . . . 202 Replacing the VBA Subassembly . . . . . . . . . . . . . . . 202 Legacy COM API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Using VBA in AutoCAD Civil 3D . . . . . . . . . . . . . . . . . 203 Root Objects and Common Concepts in COM . . . . . . . . . . 204 Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . 204 Ambient Settings . . . . . . . . . . . . . . . . . . . . . . . 208 Label Styles . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Survey in COM . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 216 Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . 217 Survey Network . . . . . . . . . . . . . . . . . . . . . . . 222 Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 233 Points in COM . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 234 Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Point Groups . . . . . . . . . . . . . . . . . . . . . . . . . 243 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 246 Surfaces in COM . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 247 Using the Surfaces Collection . . . . . . . . . . . . . . . . 248 Creating a Surface . . . . . . . . . . . . . . . . . . . . . . 249 Working with Surfaces . . . . . . . . . . . . . . . . . . . . 252 Working with TIN Surfaces . . . . . . . . . . . . . . . . . 258 Surface Style . . . . . . . . . . . . . . . . . . . . . . . . . 264 Performing Surface Analysis . . . . . . . . . . . . . . . . . 266 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . 273 Contents | v Sites and Parcels in COM . . . . . . . . . . . . . . . . . . . . . 275 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 275 Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Parcels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 284 Alignments in COM . . . . . . . . . . . . . . . . . . . . . . . . 284 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 285 Basic Alignment Operations . . . . . . . . . . . . . . . . . 286 Stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Alignment Style . . . . . . . . . . . . . . . . . . . . . . . 293 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 296 Profiles in COM . . . . . . . . . . . . . . . . . . . . . . . . . . 297 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 298 Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 Profile Views . . . . . . . . . . . . . . . . . . . . . . . . . 303 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . 307 Sections in COM . . . . . . . . . . . . . . . . . . . . . . . . . . 308 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 308 Sample Lines . . . . . . . . . . . . . . . . . . . . . . . . . 309 Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 Section Views . . . . . . . . . . . . . . . . . . . . . . . . 318 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 324 Data Bands in COM . . . . . . . . . . . . . . . . . . . . . . . . 326 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 326 Defining a Data Band Style . . . . . . . . . . . . . . . . . 327 Creating a Data Band Set . . . . . . . . . . . . . . . . . . 345 Using Data Bands . . . . . . . . . . . . . . . . . . . . . . 347 Sample Programs . . . . . . . . . . . . . . . . . . . . . . . 349 Pipe Networks in COM . . . . . . . . . . . . . . . . . . . . . . 349 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . 350 Base Objects . . . . . . . . . . . . . . . . . . . . . . . . . 351 Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . 363 Interference Checks . . . . . . . . . . . . . . . . . . . . . 369 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 374 Corridors in COM . . . . . . . . . . . . . . . . . . . . . . . . . 375 Root Objects . . . . . . . . . . . . . . . . . . . . . . . . . 375 Corridors . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 Baselines . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 Assemblies and Subassemblies . . . . . . . . . . . . . . . . 387 Feature Lines . . . . . . . . . . . . . . . . . . . . . . . . . 391 Corridor Surfaces . . . . . . . . . . . . . . . . . . . . . . . 395 Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 Sample Program . . . . . . . . . . . . . . . . . . . . . . . 402 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . 402 AutoCAD Civil 3D . . . . . . . . . . . . . . . . . . . . . 402 vi | Contents Creating Client Applications . . . . . . . . . . . . . . . . . . . 404 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 Contents | vii viii 1 API Developer's Guide About the Developer's Guide Intended Audience The is designed for developers who want to customize 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. AutoCAD Civil 3D APIs There are three APIs available for customizing AutoCAD Civil 3D: ■ .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. ■ COM API — you can create clients that access the COM API from managed (.NET) or unmanaged (C++) code. See Creating Client Applications (page 404). 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. ■ 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. 1

Description:
the Civil 3D user’s Guide. AutoCAD Civil 3D discards all existing elevation regions for the surface and creates a new collection of regions.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.