Inventor 2021 was released worldwide in March 2020. Autodesk Inventor is committed to improvements on every release. Having said that, Inventor 2021 API release consists of many improvements and enhancements. This blog post will cover the 4 major areas considered for improvements. We also have a video is you prefer to watch, instead of read: https://www.youtube.com/watch?v=dtWpkKAAnzM
1. General API
• SaveOptions.SaveFilesInLibraryFolders property - When users are dealing with commonly used components like iPart factory or Standard parts. It requires to save these files in library folders. Enabling this option allows to save files in library folders implicitly. Please note that after saving files in library folder,files are not allowed to modify via Inventor API.
• ModelingSettings.AutoFindErrorsAfterManualRepair property – On enabling AutoFindErrorsAfterManualRepair property, it finds errors automatically even after manual repair.
• 7 DefaultToSaveForxxx properties and 7 PromptSaveForxxx properties in SaveOptions object - While saving files in library folders, there are 7 different prompts and 7 default conditions considered. To control all 7 prompts and 7 default conditions, respective 7 DefaultToSaveForxxx properties and 7 PromptSaveForxxx properties are introduced in Inventor 2021 depicted in below UI image.
• GeneralOptions.ShowHomeBaseOnStartup property - ShowHomeBaseOnStartup API allows to show “My home” tab on start up.
• ExpressionList.AllowCustomValues property – It allows to get and set whether to allow the custom values for parameter. On enabling this property, custom values or numbers with multiple units can be added into multi value parameter.
Sub Test_AllowCustomValues()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oUserParam As UserParameter
Set oUserParam = oDef.Parameters.UserParameters.Item(1)
oUserParam.ExpressionList.AllowCustomValues = False
End Sub
• MeasureTools.GetAnglePrecision, SetAnglePrecision, GetLengthPrecision and SetLengthPrecision methods - It was a request from a customer who wants to set AnglePrecision and LengthPrecision in Measure tools and is now implemented in Inventor 2021. Along with setting precision, AnglePrecision and LengthPrecision can be retrieved as well.
• TransientBrep.GetIdenticalBodies - Another new method called GetIdenticalBodies is introduced to identify the identical bodies using TransientBrep object.
• ThemeManager object - In ThemeManager Object, there are 2 new Improvements. One is to get active theme and another one to set theme to either (Light or Dark)
• ViewFrame object - New ViewFrame object is introduced in Inventor 2021 API which allows to specify the size and location of view frame.
• ImportedRVTComponent object - ImportedRVTComponent object allows to import Revit component into Inventor data.
• Export method for iAssemblyFactory, iPartFactory, ParameterTable, PositionalRepresentations and iFeatureTable - Export method is extended to extract tables from iAssemblyFactory, iPartFactory, ParameterTable, PositionalRepresentation and iFeatureTable into external file like Excel, text file etc.,
• Removed FileFormatEnum: kdBASEIIIFormat, kdBASEIVFormat and kMicrosoftAccessFormat
• Date properties return only Date instead of Time - In earlier Inventor versions, dates were returning with time (like “2019/06/07 6:42:43 PM”). Now, it is simplified to return only date in YYYY/MM/DD format (Like “2019/06/07”).
2. Part Document API
• SilhouetteCurves.Add method with SilhouetteCurve.Body, ExcludedFaces, ExcludeInternalFaces, ExcludeStraightFaces properties - Exposed SilhouetteCurves.AddSilhouette method, SilhouetteCurve.Body, ExcludedFaces, ExcludeInternalFaces, ExcludeStraightFaces properties and Remove the SilhouetteCurves.Add method and FacesOrBody, IncludeCoincidentSilhouettes properties to make silhouette curve APIs consistent with UI calculation algorithm.
Sub Test_AddSilhouette()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oBody As SurfaceBody
Set oBody = oDef.SurfaceBodies.Item(1)
Dim oSketch As Sketch3D
Set oSketch = oDef.Sketches3D.Add
Dim oDirection As Face
Set oDirection = ThisApplication.CommandManager.Pick(kPartFacePlanarFilter, "Select a face")
Call oSketch.SilhouetteCurves.AddSilhouette(oBody, oDirection)
End Sub
• HoleFeatures.CreateClearanceInfo and HoleClearanceInfo.SetClearanceInfo methods - Another request from a customer to implement methods to create hole clearance info and setting clearance info for a hole feature. New HoleFeatures.CreateClearanceInfo and HoleClearanceInfo.SetClearanceInfo methods to better support to set clearance info for hole feature.
• FlangeFeatures.CreateFlangeDefinition with FlangeDefinition.FlangeAngleReferencePlane property - exposed FlangeDefinition.FlangeAngleReference property to specify flange angle using a face or workplane while creating flange definition.
• SurfaceBody.OrientedMinimumRangeBox property - OrientedMinimumRangebox in SurfaceBody object which gives overall size of the surface body.
• SheetMetalComponentDefinition.SetBodySheetMetalStyle2 property – It is an additional method is introduced to set surfacebody sheet metal style even though computation errors exist.
• UnwrapResultAlignmentEnum.kXZPlaneAlignment and kYZPlaneAlignment enumerator - Additionally, kXZPlanealignment and kYZPlanealignment enums are added to UnwrapResultAlignmentEnum.
3. Assembly Document API
• ComponentOccurrence.Replace2 method - Replace2 function is enhanced to save edits and keep adaptivity after replacing the components.
4. Drawing Document API
• DrawingView.DesignViewAssociative, DesignViewRepresentation and hide the DrawingView.ActiveDesignViewRepresentation properties - Two new properties are added to DrawingView object. One is to get associativity of drawing view (True/False) and another one is to get associated view of drawing view. In earlier version, ActiveDesignViewRepresentation property is removed from DrawingView object.
• SheetFormat.FitViewsToSheet property - New SheetFormat.FitViewsToSheet property and SheetFormats.AddWithOptions method allows to specify whether the drawing views should fit the sheet when they are created from sheet format.
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
Call oOptions.Add("FitViewsToSheet", True)
Dim oSheetFormat As SheetFormat
Set oSheetFormat = oDoc.SheetFormats.AddWithOptions(oSheet, "Custom sheet", oOptions)
• DimensionTypeEnum.kParallelDiametricDimensionType enumerator - New DimensionTypeEnum.kParallelDiametricDimensionType enumerator is added to support parallel diameter dimension.
• GeneralDimensions.AddLinear2 method - GeneralDimensions.AddLinear2 method is introduced to support new dimension type kAlignedToCurveDimensionType and kNormalToCurveDimensionType which allow to specify alignment geometry to rotate the dimension alignment.
• DrawingStylesManager.ReplaceStyles method - This is also request from a one of the customers. DrawingStylesManager.ReplaceStyles method allows to replace the drawing styles.
• SketchBlockDefinition.Description property - SketchBlockDefinition.Description property allows to get and set the description for a sketch block definition.
• SketchHatchRegion object – For the first time, object is introduced to add Sketch Hatch through Inventor API (2021).
Sub Test_SketchHatchRegion()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oSketch As DrawingSketch
Set oSketch = oDoc.ActiveSheet.Sketches.Item(1)
Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid(True)
Dim oRegion As SketchHatchRegion
Set oRegion = oSketch.SketchHatchRegions.Add(oProfile, , 15, 0.5)
End Sub
• HoleTableColumn.UnitsFormatting object - New HoleTableColumn.UnitsFormatting object allows to query and edit the units formatting for hole table column.
By the way, Inventor 2021 engine is also available in Design Automation for Inventor. If you are interested in transferring Inventor plugin into cloud application, here is opportunity to do. To explore more about this, go through below video link.