Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Understanding the Alignments and Profiles API in AutoCAD® Civil 3D®"— Presentation transcript:

1 Understanding the Alignments and Profiles API in AutoCAD® Civil 3D®
Isaac Rodriguez Sr. Software Engineer

2 Autodesk University Session Feedback
Your feedback is very important to Autodesk Attendees can complete session survey on their mobile device, PC or at a survey station Each session survey completed will be entered for a daily drawing for a free AU 2012 pass. You can help make AU 2012 better! Complete the AU Conference Survey at a survey station and receive an AU 2011 T-Shirt

3 About the Presenter Isaac is a senior software engineer at Autodesk, and current software development lead of the AutoCAD® Civil 3D® API. Isaac has been with Autodesk for almost eleven years working in different products and technologies like AutoCAD Raster Design and AutoCAD Civil 3D. He has 20 years of software development experience including six years with Microsoft® .NET technologies. Contact me through Follow me on Read my blog:

4 About the Audience Tell me a little bit about you.
Software Development implementing Civil 3D applications Civil Engineer writing automation scripts and internal tools Are you using .NET? Which .NET language you prefer?

5 Class Summary This class covers the basics of the Alignments and Profiles .NET API in Civil 3D. It also dives into the structural components of Alignment and Profile objects and their composition. Finally, the class demonstrates how Alignments and Profiles can be manipulated by changing parameters in their components.

6 Learning Objectives At the end of this class, you will be able to:
Understand the structure of the Alignment and Profile objects Access to Alignment and Profile entities through the API Working with Alignment and Profile Entities according to their type Working with Alignment and Profile Entities and their constraints Complete the C3D API Challenge!!!

7 Structure of Alignment and Profile Objects

8 Alignments and Profiles
Two dimensional, linear objects Composed of other two dimensional, linear objects (Entities) Alignments represent different model features Profiles represent elevation points along an Alignment Structures are similar but representations are different

9 Alignment Entity Sub-Entity Alignment Structure
Alignments contain Entities Entities contain Sub-Entities Sub-Entities different from Entities Alignment Entity Sub-Entity

10 Alignment Entities Entities have a type
Type identified by EntityType property (AlignmentEntityType enumeration) Object class does not identify entity type Basic Entities contain 1 Sub-Entity Composite Entities contain 2 or more Sub-Entities Entities have constrains

11 Basic Alignment Entities
Contain a single Sub-Entity Lines (Tangents), Arcs (Curves), and Spirals Entity Entity Class Entity Type Line (Tangent) AlignmentLine Line Arc (Curve) AlignmentArc Curve Spiral AlignmentSpiral

12 Composite Alignment Entities
Entity Entity Class Entity Type Spiral-Curve-Spiral AlignmentSCS SpiralCurveSpiral Spiral-Line-Spiral AlignmentSTS SpiralLineSpiral Spiral-Line SpiralLine Line-Spiral LineSpiral Spiral-Curve SpiralCurve Curve-Spiral CurveSpiral Spiral-Spiral-Curve-Spiral-Spiral AlignmentSSCSS SpiralSpiralCurveSpiralSpiral Spiral-Curve-Spiral-Curve-Spiral AlignmentSCSCS SpiralCurveSpiralCurveSpiral Spiral-Curve-Spiral-Spiral-Curve-Spiral AlignmentSCSSCS SpiralCurveSpiralSpiralCurveSpiral Spiral-Spiral (*) AlignmentSCS or AlignmentSTS SpiralSpiral Spiral-Spiral-Curve SpiralSpiralCurve Curve-Spiral-Spiral CurveSpiralSpiral Curve-Line-Curve AlignmentCTC CurveLineCurve Curve-Reverse Curve AlignmentCRC CurveReverseCurve Curve-Curve-Reverse Curve AlignmentCCRC CurveCurveReverseCurve Entity type MultipleSegments not used nor supported (*) AlignmentSCS used if entity between two lines and AlignmentSTS used if entity between two curves

13 Profile Structure Profiles contain Entities
Profile Entities are Simpler Lines (Tangents) Arcs (Circles) Parabolas Symmetric Asymmetric Entities have constrains Entity Entity Class Entity Type Tangent ProfileTangent Circular ProfileCircular Parabola Symmetric ProfileParabolaSymmetric ParabolaSymmetric Parabola Asymmetric ProfileParabolaAsymmetric ParabolaAsymmetric

14 Accessing Alignment and Profile Entities

15 Entities Collection < IEnumerable >
Accessed through Entities property Interface to access entities Implements IEnumerable for AlignmentEntity Entities enumerated by ID ID depends on alignment creation Time for some Code

16 Entities Collection < EntityAtId() >
FirstEntity and LastEntity provided by collection EntityBefore and EntityAfter provided by AlignmentEntity EntityAtId() retrieves entity Suitable for sequential and direct access Some More Code

17 Alignment Entities Collection < GetEntityByOrder() >
Zero-based index Less-than Count property value Raises exception with unconnected entities Not suitable for enumeration Use for direct access And More Code

18 Working with Entities based on Type

19 Alignment and Profile Entities by Type
Entities have a type Leads to complex logical code Prefer abstractions and polymorphism

20 Entity Abstractions Create you own entity wrappers
Separate wrapper creation from processing Provide interface related to requirements Use virtual functions for specialized functionality (polymorphism)

21 Function Objects (Functors)
Objects that work like functions Flexible and highly customizable Represent application processes

22 Implementing ‘ExportAlignment’ Command
Function Object to export information Customizable order Customizable output target Entity wrappers responsible for own information Logic to identify entity in Factory class Let’s look at some code

23 Working with Entities Constraints

24 Constraint Types Tangency Constraints Entity Definition Constraints
Relation between entity and surrounding entities Common to all entities Entity Definition Constraints Specific to an entity Represent how entity was defined (during creation)

25 Tangency Constraints Relation between entity and surrounding entities
Common to all entities Free / Fixed / Float on Previous / Float on Next Only editable in Alignments feature Not editable through the API They may affect the entire Alignment/Profile object

26 Definition Level Constraints
Specific to an entity type Represent entity definition Indicate which parameters can be modified

27 Recommendations Working with Constraints
Separate logical code from process Use “Strategy Pattern” for processing algorithms Evaluate constraints to decide strategy

28 Strategy Pattern Let’s Look at some code Behavior defines interface
Context provide point for customization Concrete implementations of interface Decide who customizes behavior Let’s Look at some code

29 Summary Alignment and Profiles
Linear objects composed by entities Different interfaces to access entities Provide your own entity abstractions (wrappers) Implement process as Functors (Function Objects) Separate logical code from processing code Centralize logic (Decision methods / Factory methods) Provide customization of behavior (Strategy Pattern)

30 Questions?

31 C3D API Challenge Reinforce the topics of this class
Have fun with them Featured in Civilized Development Details in materials handout Submit entries prior December 31st 2011

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


Download ppt "Understanding the Alignments and Profiles API in AutoCAD® Civil 3D®"

Similar presentations


Ads by Google