Date post: | 25-Dec-2015 |
Category: |
Documents |
Upload: | theodora-copeland |
View: | 228 times |
Download: | 1 times |
© 2011 Autodesk
Navigating Through the Corridor using AutoCAD® Civil 3D® .NET APIAugusto GoncalvesSenior Developer Consultant at Autodesk
© 2011 Autodesk
Class Summary
Corridor is one of the most complex objects in the AutoCAD Civil 3D family of objects.
Working on a corridor object requires a clear understanding of its constituent components and their behavior.
This class will give you an overview of corridor and associated objects and highlight how to access and extract useful details using the AutoCAD Civil 3D .NET API.
© 2011 Autodesk
Learning Objectives
At the end of this class, you will be able to:
Understand the data model of corridors on Civil 3D®
Be able to create a new .NET project to read Civil 3D® corridor information
Generate a simple Excel®-based Corridor report using the API
© 2011 Autodesk
Agenda
1Overview
Corridor overview on Civil 3D
2Data model
Which API objects hold the information we want
3How create a .NET plug-in
Create a plug-in using the .NET API
4Generate a Excel report
An applicable sample exporting data to Excel
5Further reading
Extra topics to keep learning
© 2011 Autodesk
Corridor Building BlocksOverview
© 2011 Autodesk
CorridorOverview
The 3D path of a Corridor is a baseline defined by a Alignment and a Profile.
Along the length of the baselines are a series of Assembly objects which define the cross-sectional shape of the Alignment.
Common points in each Assembly are connected to form feature line.
Together the assemblies and feature lines form the 3D shape of a corridor.
© 2011 Autodesk
CorridorPath Horizontal Perspective: Aligment
Creating and defining the horizontal alignment is one of the first steps for Corridor design
Can represent centerlines, lanes, shoulders, right-of-ways, or construction baselines.
© 2011 Autodesk
CorridorPath Vertical Perspective: Profile
Used to visualize the terrain along a route of interest.
Can record the elevation of the surface along an alignment.
Represents a record of elevation against distance along a horizontal Alignment or other line.
© 2011 Autodesk
CorridorShape Definition: Assembly
Is the pattern for the cross section of a corridor at a particular station.
Consists of a connected set of subassemblies.
The Corridor can contain a series of applied assemblies (which points to the Assembly)
© 2011 Autodesk
CorridorShape Defintion: Subassembly
The basic building block of a corridor shape design.
Consists of a series of shapes, links, and points.
The applied assemblies of a corridor can contain a series of applied subassemblies (which points to the Subassembly)
© 2011 Autodesk
Corridor Data Model
© 2011 Autodesk
Data Model Objects
Corridor
Baseline
BaselineRegion
AppliedAssembly
AppliedSubassembly
Assembly
Subassembly
Alignment
Profile
© 2011 Autodesk
Pseudo-code sample
Sub ListAll() Dim corridor As Corridor For Each baseline In corridor.Baselines For Each baselineRegion In baseline.BaselineRegions For Each appliedAssembly In baselineRegion.AppliedAssemblies For Each appliedSA In appliedAssembly.GetAppliedSubassemblies
Next Next Next NextEnd Sub
© 2011 Autodesk
Exploring the Model with Snoop Tool
Download at http://download.autodesk.com/media/adn/SnoopCivil3DTool.zip
Corridor object data model
Subassembly parameters
© 2011 Autodesk
Creating a .NET Code
© 2011 Autodesk
Start with AutoCAD .NET API
As Civil 3D is based on AutoCAD, we need AutoCAD APIs.
Trainings: www.autodesk.com/apitraining
DevTV: www.autodesk.com/developautocad
© 2011 Autodesk
Visual Basic .NET project for Civil 3D plug-in
Create a new project
Plugin for Civil 3Dmust be of typeClass Library
© 2011 Autodesk
Adding reference to Civil 3D
Add references
AutoCAD AcMdg (Interface resources) AcDbMgd (Database resources)
Civil 3D AecBaseMgd (AEC base) AeccDbMgd (Civil3D specific)
IMPORTANT:Set Copy Local as FALSE
© 2011 Autodesk
'show the number of corridors ed.WriteMessage("Document contains {0} corridors", _ civilDoc.Corridors.Count)
Imports Autodesk.AutoCAD.RuntimeImports Autodesk.AutoCAD.ApplicationServicesImports Autodesk.AutoCAD.EditorInputImports Autodesk.Civil.ApplicationServices
Basic Civil 3D custom command
1. Regular VB routine
2. AutoCAD & Civil 3D Imports
3. Mark the routine as command
4. Access editor and civil document
5. Show the number of corridors
Now just compile, load inside Civil3D with NETLOAD and call
countCorridors
Public Class Class1
End Class
Public Sub countCorridors()
End Sub
<CommandMethod(“countCorridors")> _
'access AutoCAD Editor Dim ed As Editor = Application.DocumentManager. _ MdiActiveDocument.Editor 'access Civil Document Dim civilDoc As CivilDocument = CivilApplication. _ ActiveDocument
© 2011 Autodesk
Applicable Sample
© 2011 Autodesk
Creating a Excel®-based Corridor Report
List all subassemblies
Order by station and by offset (left, center, right)
Export to Microsoft® Excel®
© 2011 Autodesk
Further Reading
© 2011 Autodesk
Other classes
CP4321: Understanding the Alignments and Profiles API in AutoCAD® Civil 3D®
© 2011 Autodesk
Additional Resources (Civil 3D®)
Civilized Development blog http://civilizeddevelopment.typepad.com Discussion Groups http://forums.autodesk.com/t5/AutoCAD-Civil-3D-Customization/bd-p/190
Civil 3D Developer Center http://www.autodesk.com/developcivil
© 2011 Autodesk
Additional Resources (AutoCAD)
Through the Interface blog http://through-the-interface.typepad.com AutoCAD.NET Developer’s Guide http://www.autodesk.com/autocad-net-developers-guide
Discussion Groups http://discussion.autodesk.com/forums/category.jspa?categoryID=8
Autodesk Developer Network http://www.autodesk.com/joinadn
© 2011 Autodesk
Autodesk, AutoCAD* [*if/when mentioned in the pertinent material, followed by an alphabetical list of all other trademarks mentioned in the material] are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and/or other countries. All other brand names, product names, or trademarks belong to their respective holders. Autodesk reserves the right to alter product and services offerings, and specifications and pricing at any time without notice, and is not responsible for typographical or graphical errors that may appear in this document. © 2011 Autodesk, Inc. All rights reserved.