© 2011 autodesk navigating through the corridor using autocad® civil 3d®.net api augusto...

27
© 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D® .NET API Augusto Goncalves Senior Developer Consultant at Autodesk

Upload: theodora-copeland

Post on 25-Dec-2015

235 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Navigating Through the Corridor using AutoCAD® Civil 3D® .NET APIAugusto GoncalvesSenior Developer Consultant at Autodesk

Page 2: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior 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.

Page 3: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 4: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 5: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Corridor Building BlocksOverview

Page 6: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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.

Page 7: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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.

Page 8: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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.

Page 9: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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)

Page 10: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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)

Page 11: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Corridor Data Model

Page 12: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Data Model Objects

Corridor

Baseline

BaselineRegion

AppliedAssembly

AppliedSubassembly

Assembly

Subassembly

Alignment

Profile

Page 13: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 14: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Exploring the Model with Snoop Tool

Download at http://download.autodesk.com/media/adn/SnoopCivil3DTool.zip

Corridor object data model

Subassembly parameters

Page 15: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Creating a .NET Code

Page 16: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 17: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Visual Basic .NET project for Civil 3D plug-in

Create a new project

Plugin for Civil 3Dmust be of typeClass Library

Page 18: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 19: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 20: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Applicable Sample

Page 21: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Creating a Excel®-based Corridor Report

List all subassemblies

Order by station and by offset (left, center, right)

Export to Microsoft® Excel®

Page 22: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Further Reading

Page 23: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Other classes

CP4321: Understanding the Alignments and Profiles API in AutoCAD® Civil 3D®

Page 24: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 25: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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

Page 26: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 2011 Autodesk

Thank you!

[email protected]

Page 27: © 2011 Autodesk Navigating Through the Corridor using AutoCAD® Civil 3D®.NET API Augusto Goncalves Senior Developer Consultant at Autodesk

© 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.