Download presentation
Presentation is loading. Please wait.
Published byBranden Fox Modified over 9 years ago
1
© 2011 Autodesk Autodesk Inventor®: Client Graphics API exposed Philippe Leefsma Developer Consultant - Autodesk Developer Network
2
© 2011 Autodesk Class Summary In this class we will explore the Inventor® Client Graphics API, a functionality that provides the ability to dynamically display custom graphics in the Inventor® modeling window. It will benefit developers who want to enhance their plug-in commands by integrating visual feedback, as well as those migrating their existing solutions from systems that rely on OpenGL-based graphics.
3
© 2011 Autodesk Learning Objectives At the end of this class, you will be able to: Describe the ClientGraphics Object model, how the API is structured and how to use it Leverage your commands by creating professional level visual feedback Master advanced features of ClientGraphics API We assume you are already skilled in: C# or VB.NET programming The basics of Inventor API Inventor product usage
4
© 2011 Autodesk Philippe Leefsma Developer Technical Services EMEA Philippe has a master's degree in Computer Sciences. He studied in Paris at I.S.E.P and at Colorado School of Mines in the USA. He joined Autodesk 5 years ago where he works as developer consultant for the Autodesk Developer Network. He supports various product APIs including AutoCAD®, AutoCAD Mechanical®, and Autodesk® Inventor®. He enjoys traveling and meeting developers from around the world to work with them on CAD and manufacturing related application development. About the Presenter
5
© 2011 Autodesk Agenda I - The ClientGraphics API ClientGraphics Object Model GraphicsData Object Model Methodology II - Graphic Primitives Exposed Common properties Primitive types Using Primitives and Graphics Data III - Advanced use of Client Graphics Use of GraphicsManager Interaction Graphics Storing Graphics Other functionalities
6
© 2011 Autodesk I - ClientGraphics API
7
© 2011 Autodesk What are ClientGraphics and Why do you need them? Ability to draw custom graphics alongside Inventor native graphics Insulate from the underlying graphics platform Enhance your plug-in commands by integrating visual feedback Migrate solutions based on OpenGL graphics
8
© 2011 Autodesk The applications of ClientGraphics Client Graphics are widely used in native Inventor commands and add-ins: Represent custom and transient objects Create interactive previews during commands Display the results of various analyses Creating custom manipulators within a command Enhance user experience
9
© 2011 Autodesk The applications of ClientGraphics
10
© 2011 Autodesk ClientGraphics Object Model
11
© 2011 Autodesk ClientGraphics Types Regular ClientGraphics: Associated with a document Transient unless owned by a ClientFeature Can be obtained from different sources : PartComponentDefinition AssemblyComponentDefinition FlatPattern DrawingView, Sheet ClientFeatureDefinition Interaction ClientGraphics: Only available when InteractionEvents is running Display preview graphics or manipulators while running a command Automatically deleted when InteractionEvents terminates
12
© 2011 Autodesk GraphicsNode basic properties GraphicsNode object has some properties to control default behavior of all primitives it contains. Here are the most important: Render Style Visibility Visible | VisibleInViews | VisibleInActiveEditObject Selectable Transformation
13
© 2011 Autodesk GraphicsData Object Model
14
© 2011 Autodesk General Procedure to draw ClientGraphics Creation of ClientGraphics follows the general procedure below: Graphic Source Document (ipt, iam) DrawingView / Sheet Flat Pattern ClientFeature Interaction Event ClientGraphics Collection ClientGraphics GraphicsNode Surface Graphics Coords Set Color Set Graphic Source GraphicsDataSets Collection GraphicsDataSets Line Graphics Triangle Graphics
15
© 2011 Autodesk Our first Client Graphics program
16
© 2011 Autodesk II - Graphic Primitives Exposed
17
© 2011 Autodesk GraphicsPrimitives - Common Properties GraphicsPrimitive objects represent the graphics you can see in Inventor graphic window. Here are some properties and methods common to all of them: BurnThrough DepthPriority SetViewSpaceAnchor SetTransformBehavior
18
© 2011 Autodesk GraphicsPrimitive Types
19
© 2011 Autodesk Primitives and GraphicsData GraphicsDataSets allow to create data input for primitives that need it They are also used to customize primitives with colors, textures or images Specific GraphicDataSet objects are created from the GraphicsDataSets collection
20
© 2011 Autodesk Reusing native model data CurveGraphics Can use geometry of edges from model: Edge.Geometry or curves generated by TransientGeometry SurfaceGraphics Can use SurfaceBody from model or solids generated by TransientBRep ComponentGraphics Can use any loaded ComponentDefinition from Part or Assembly
21
© 2011 Autodesk III - Advanced use of Client Graphics
22
© 2011 Autodesk ClientGraphics Manager - Sample void BasicDemoWithGraphicMng() { Inventor.Application InvApp = AdnInventorUtilities.InvApplication; double[] startPoint = new double[] {0.0, 0.0, 0.0}; double[] endPoint = new double[] {1.0, 1.0, 1.0}; // Create instance of AdnClientGraphicsManager AdnClientGraphicsManager clientGraphicsMng = new AdnClientGraphicsManager(InvApp, AdnInventorUtilities.AddInGuid); // Set active document as current graphics source clientGraphicsMng.SetGraphicsSource(InvApp.ActiveDocument); // Create LineGraphics primitive LineGraphics lineGraph = clientGraphicsMng.DrawLine(startPoint, endPoint); lineGraph.LineWeight = 5.0; // Update view to see results clientGraphicsMng.UpdateView(); }
23
© 2011 Autodesk Interaction Graphics InteractionGraphics behave in a similar way than regular ClientGraphics Only relevant in InteractionEvents context > terminates with it Well suited for dynamic feedback / preview during a command
24
© 2011 Autodesk Overlay vs Preview Graphics InteractionGraphics can use Preview or Overlay graphics: Preview graphics = equivalent to regular ClientGraphics (non-transacting) Overlay graphics = draw independently in a special «overlay» plane Use: Overlay graphics can be much faster when Inventor model view is stationary and only graphics need to be updated. Example: Result preview in sketch environment
25
© 2011 Autodesk Command Manipulators Various InteractionEvents sub-events can be used to handle manipulators within your command GraphicsPrimitive.SetTransformBehavior Can be used to generate constant size and/or front facing graphics SetTransformBehavior( Point Anchor, DisplayTransformBehaviorEnum BehaviorType, double PixelScale)
26
© 2011 Autodesk Storing Graphics ClientGraphics are transient by nature The only way to persist them across sessions are: Recreate them with your application logic when document is open Host the graphics inside a ClientFeature
27
© 2011 Autodesk Transacting vs Non-Transacting Graphics New non-transacting graphics functionality added in 2012 Non-transacting graphics are now available outside of InteractionEvents Graphics that do not require undo/redo can be drawn much faster if not transacting
28
© 2011 Autodesk Miscellaneous functionalities Slicing Texture Mapping
29
© 2011 Autodesk Wrap up During this class: We have seen the basic workflow and fundamentals objects to create Graphics We analyzed the various primitive types and their utility We exposed advanced functionalities of the ClientGraphics you can use to enhance your commands
30
© 2011 Autodesk Material Presentation AU11_CP3320_Client_Graphics_API_Exposed.pptx Hands Out AU11_CP3320_Client_Graphics_API_Exposed.pdf Code Samples ClientGraphicsDemoAU Add-in – C# ClientGraphics Add-in – VB.Net ClientGraphics.ivb – VBA
31
© 2011 Autodesk Resources for Inventor developers Online Help, Developer's Guide and SDK Samples Inventor Developer Center http://www.autodesk.com/developinventor Webcasts and Trainings on Inventor Programming and News http://www.adskconsulting.com/adn/cs/api_course_sched.php Discussion Group http://discussion.autodesk.comhttp://discussion.autodesk.com > Inventor API Training Classes http://www.autodesk.com/apitraining ADN, The Autodesk Developer Network http://www.autodesk.com/joinadn DevHelp Online for ADN members http://adn.autodesk.com
32
© 2011 Autodesk Autodesk Developer Network Access to almost all Autodesk software and SDK’s Includes early access to beta software Members-only website with thousands of technical articles Unlimited technical support Product direction through conferences Marketing benefits Exposure on autodesk.com Promotional opportunities Up to three free API training classes Based on user level www.autodesk.com/joinadn
33
© 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.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.