1 / 54

Introduction to Autodesk® Inventor® API and Assemblies

Introduction to Autodesk® Inventor® API and Assemblies. Wayne Brill API Consultant - Autodesk. Image courtesy of Engineering Center LTD, Russia. About the Presenter. Wayne Brill Developer Technical Services.

edie
Télécharger la présentation

Introduction to Autodesk® Inventor® API and Assemblies

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Autodesk® Inventor® API and Assemblies Wayne Brill API Consultant - Autodesk Image courtesy of Engineering Center LTD, Russia

  2. About the Presenter Wayne Brill Developer Technical Services Wayne has been a member of Autodesk Developer Technical services supporting ADN (Autodesk Developer Network) for nine years. Currently, Wayne provides API support for Autodesk Inventor®, AutoCAD, AutoCAD® Mechanical, AutoCAD OEM, and RealDWG™.

  3. Goals Show you how to get started with the Inventor API (Application Programming Interface) Help you understand how the API can make you and your colleagues more productive with Inventor Help you gain some expertise with the Inventor API for assemblies

  4. Areas of focus Introduction to the Inventor API Utility API objects API for Assemblies Introduction to B-Rep

  5. Introduction to the Inventor API

  6. Visual Basic C++ Other... .Net C# VB.Net Other... Inventor COM API Inventor COM • The API is exposed through a COM Automation interface.

  7. Inventor Applications Add-In Client App Inventor Application Client App Add-In VBA Apprentice Inventor Data

  8. Inventor API Classes/Objects • Functionality is exposed as classes/objects • Object corresponds to something in Inventor • Object may have methods, properties, and events. • Top object in the hierarchy is the Application object.

  9. Get to an object using the hierarchy Application AssemblyDocument AssemblyComponentDefinition ComponentOccurrences WorkPlanes

  10. COM API Utilities • Tools available to help in understanding the object model. • Object Model Chart - http://www.autodesk.com/developinventor • Object Browser • VBA Debugger

  11. Demo Access API using VB.NET Create a VB.NET application, connect to an Inventor Session. Get the name of the active document, run a command, change an assembly setting

  12. Utility API objects

  13. Entity Selection - SelectSet • Contains entities currently selected by the end-user • Object first then action behavior • Useful for debugging and simple macros. • Edit the contents of the select set by adding additional entities, removing specified entities, and clearing the entire select set

  14. Units of Measure • Inventor has internal units • Length: Centimeters • Angle: Radians • Time: Second • Mass: Kilogram • Units in Document Settings are converted to / from internal units • The UnitsOfMeasure object provides similar functionality in API. • Provides functions to help with unit handling

  15. Parameter Objects • Values are stored using internal units • Support for changing the type of the parameter • Create Parameter Groups • DiaabledActionTypes- Prohibit deletion of user parameters

  16. Demo SelectSet, UnitsOfMeasure, Parameters

  17. API for Assemblies

  18. Assembly API Overview • API supports most of the assembly functionality. • Placing & creating components. • Editing components • Patterns • Constraints • Work features • Parameters • iMates • Sketches • Features • Representations • iAssemblies • BOM • AssemblyDocument is the top level object for Assemblies

  19. AssemblyDocument • AssemblyDocument Properties • references to ipt files and iam files • occurrence information • constraints • work features • No geometry (other than assembly features) is in the assembly document, only references to parts and other assemblies

  20. ComponentOccurrences • ComponentOccurrences • Allows iteration over all existing occurrences • Use the Add method to add additional occurrences.

  21. Assembly Occurrences Traversal

  22. Creating Occurrences Through the API • 1. Get the AssemblyDocument • 2. Create a Matrix to used for the location of the occurrence • 3. Call one of the Add methods

  23. Creating Occurrences – AddWithOptions() • NameValueMap (sets Options) • LevelOfDetailRepresentation • DesignViewRepresentation • PositionalRepresentation

  24. DocumentDescriptorsEnumerator • DocumentDescriptorsEnumerator provides access to the documents referenced by the assembly

  25. Bill Of Materials • Query and Export BOM Data • BOM property of ComponentDefinition • BOMRow ComponentDefinitions • Data can be retrieved using PropertySets

  26. Demo Assembly Occurrences Use the API to open an Assembly Use the API to create a new Assembly Add occurrences to an Assembly Create sub assembly using Level of Detail Open assembly using Level of Detail Print out the file paths of referenced components Print BOM data to the immediate window

  27. Transient Geometry • Allows you to create a matrix that controls the location of an occurrence

  28. Vectors • Vectors define a direction and magnitude and used to define a change of location for an occurrence • UnitVector defines a direction. Its magnitude is always 1 CrossProduct – Determines a new vector that is perpendicular to the plane defined by the two input vectors

  29. Matrix • Rectangular array of numbers. • A 3-D matrix is a 4x4 matrix. 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

  30. A Matrix as a Coordinate System • A Matrix can define a coordinate system (this example is the identity matrix. (xAxis = 1,0,0 – yAxis = 0,1,0 – zAxis = 0,0,1) • UnitVectors

  31. A Matrix as a Transformation • Defines change in position and orientation (move and/or rotate) • Reposition an occurrence within an assembly. • Defining the change from one coordinate system to another. • in an assembly transform a point from one part into another part • TransfromBy • Applies the transform defined by one matrix to another matrix

  32. Matrix and Occurrences • When placing an occurrence the matrix defines the position of the part within the assembly. • Transformation property of an occurrence returns the matrix that defines the occurrence’s current position in the assembly. • Setting the Transformation property repositions the occurrence (taking into account any constraints). • SetTransformWithoutConstraints transforms the occurrence ignoring any constraints (until the next recompute of the assembly).

  33. Demo Vector and Matrix for Occurrences • Place a component in an assembly use Vectors and a Matrix to define the position and rotation • Use a Matrix to move all the components

  34. Proxy Objects • A proxy represents an entity as if the entity actually exists in the assembly • Derived from the regular object they represent. • Support methods and properties of the regular object • Methods & properties return information in assembly context • Proxies also have these properties • ContainingOccurrence • NativeObject

  35. Demo Proxy objects • Get a vertex of an occurrence using B-Rep. Print out it’s coordinates. Get the definition of that occurrence and get the same vertex in the PartComponentDefinition. • Use CreateGeometryProxy to create a VertexProxy

  36. Constraints • Constraint creation can take as input work geometry from the assembly or proxies to entities in the attached parts • Query of a constraint returns the associated entities and the parameter controlling the constraint

  37. Demo Assembly Constraints Constrain two vertexes Use Proxy workplanes to constrain faces

  38. Introduction to B-Rep API

  39. B-Rep • The B-Rep or “Boundary Representation” provides a complete geometric description of a solid model. • It is ignorant of the methods used to create the solid. • It provides access to both the topology and the geometry of the solid model.

  40. B-Rep SurfaceBody

  41. B-Rep FaceShell One FaceShell Two FaceShells

  42. B-Rep Face 6 Faces

  43. B-Rep Edge 4 EdgeLoops, 4 Edges Edge shared between faces - unlike an EdgeUse object.

  44. B-Rep EdgeUse A face has its own set of EdgeUse objects, which apply only to that face. Defined in terms of the 2D parameter space of face. Two EdgeUse objects for each Edge Object. Contain information specific to a face, including a conceptual flow direction for the face edges, useful in traversing faces.

  45. B-Rep Vertex

  46. B-Rep Access • Accessing B-Rep entities • Traversing the B-Rep structure. • From existing features. (Faces, EndFaces, StartFaces, SideFaces) • Near a specified point. (LocateUsingPoint) • Intersected by a specified vector. (FindUsingRay) • Selected by the end-user. • Querying based on previously assigned attributes.

  47. Access B-Rep Objects from a Feature • Some features support properties to directly access related B-Rep entities. • All features • Faces, SurfaceBody • ExtrudeFeature, RevolveFeature, SweepFeature, LoftFeature, HoleFeature • EndFaces, StartFaces, SideFaces

  48. Demo Boundary Representation (B-Rep) • B-Rep Traversal • Find UsingRay • Evaluators

  49. Summary Introduction to the Inventor API Utility API objects API for Assemblies Introduction to B-Rep API

  50. Learning More • Programming help • SDK samples • Developer Center • www.autodesk.com/developinventor • DevTV • Discussion Groups • http://discussion.autodesk.com • autodesk.inventor.customization • API Training Classes • www.autodesk.com/apitraining • Autodesk Developer Network • www.autodesk.com/joinadn

More Related