- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Automatic 2D drawing for family table of ipart
Dear all,
I am looking for an ilogic code to do the following:
I have a 2D-drawing of a component which has a lot of variants. This component is the first member in the family table of an ipart.
Is there a possibility to copy this 2D-drawing, change its name to the part number of the following drawing in the family table, then replace all the views in the drawing by the views of the next drawing in the family table and save the drawing again? Is there a possibility to put this in a loop so that the ilogic code performs this action for all the members in the family table of my ipart?
Thank you very much for your insights!
Kind regards,
Cor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @cgoethalsFU8PY . See the solution from @JhoelForshav at this link. If you have any problems, don't hesitate, we will be happy to help.
Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor
LinkedIn | My free Inventor Addin | My Repositories
Did you find this reply helpful ? If so please use the Accept as Solution/Like.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Andrii_Humeniuk ,
I tried adapting the code so this would work for an idw-file but I am not succeeding in this. Could you help me out with this?
I used the code below.
Kind regards,
Cor
Sub main() Dim oDrawing As DrawingDocument oDrawing = ThisApplication.ActiveDocument Dim oPath As String oPath = "O:\Product Development\Inventor\Workspace\TEST_ILOGIC" 'Folder to save the drawings Dim oView As DrawingView Dim oDoc As Document Dim oFactory As iPartFactory For Each oView In oDrawing.ActiveSheet.DrawingViews oDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument On Error GoTo trynext oFactory = oDoc.ComponentDefinition.iPartMember.ParentFactory Exit For trynext: Next If oFactory Is Nothing = False Then Dim oRow As iPartTableRow For Each oRow In oFactory.TableRows For Each oView In oDrawing.ActiveSheet.DrawingViews On Error GoTo nextView If oView.ActiveMemberName <> oRow.MemberName Then oView.ActiveMemberName = oRow.MemberName Call oDrawing.Update Do While oView.IsUpdateComplete = False Call ThisApplication.UserInterfaceManager.DoEvents Loop nextView: Next Call oDrawing.SaveAs(oPath & "\" & oRow.MemberName & ".idw", True) Next End If End Sub