Inventor iLogic: Auto-Retrieving 3D Annotations from Part Templates into Assembly Drawing Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I am currently working on an iLogic rule in Autodesk Inventor that aims to automatically retrieve and display 3D annotations (specifically dimensions) from part templates when these parts are used within an assembly. These annotations should automatically appear in the drawing views of that assembly.
The goal is to pre-add dimensions in template parts, and when creating a detailed drawing of a model state containing multiple parts, these dimensions should appear automatically.
Here is the scenario:
- I have template part files with 3D annotations.
- These parts are placed into an assembly.
- I create a drawing of this assembly.
- I want an iLogic rule that, when run, retrieves the 3D annotations from the parts and shows them in the assembly drawing view.
I have tried several iterations of code, but have been facing various challenges related to the API methods I'm trying to use. Here's a snippet of the latest version:
Sub Main
Dim oView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a view")
If oView Is Nothing Then Exit Sub
Dim refDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument
If refDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Dim oPartDoc As PartDocument = refDoc
RetrieveDimensionsFromPart(oPartDoc, oView)
End If
End Sub
Sub RetrieveDimensionsFromPart(oPartDoc As PartDocument, oView As DrawingView)
Dim dimCollection As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
For Each oAnnotation As ModelAnnotation In oPartDoc.ComponentDefinition.ModelAnnotations
If TypeOf oAnnotation Is ModelDimension Then
dimCollection.Add(oAnnotation)
End If
Next
' Retrieve the dimensions into the drawing view
oView.Parent.DrawingDimensions.GeneralDimensions.Retrieve(oView, dimCollection)
End Sub
Errors and issues encountered:
- Initially, there were type-related errors, such as 'Annotations' not being defined.
- Following that, I ran into challenges with members like 'DrawingDimensions' and 'ModelDimensions' not being found.
- Lastly, the rule runs without errors, but no annotations are retrieved/displayed in the drawing view.
I would greatly appreciate any insights, suggestions, or corrections from anyone familiar with this process or who has tackled similar challenges. I'm sure I'm missing something fundamental, or perhaps there's an entirely different approach I should consider.
Thank you in advance for your time and expertise!