Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello very one,
With the help of @JhoelForshav i got this Macro that creates drawings for all instances of a iPart from a reference drawing. My issue is that the Logic used in the model seems to not update in the drawings as shown in the pictures.
I attached the model and the drawing with the Macro shown in the screenshots.
Sub iPartDWG() Dim oDrawing As DrawingDocument Set oDrawing = ThisApplication.ActiveDocument Dim oPath As String oPath = "C:\Users\hfljf\Desktop\TestFolder" 'Folder to save the drawings Dim oView As DrawingView Dim oDoc As Document Dim oFactory As iPartFactory For Each oView In oDrawing.ActiveSheet.DrawingViews Set oDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument On Error GoTo trynext Set oFactory = oDoc.ComponentDefinition.iPartMember.ParentFactory Exit For trynext: Next If oFactory Is Nothing = False Then Dim oRow As iPartTableRow On Error GoTo nextView For Each oRow In oFactory.TableRows For Each oView In oDrawing.ActiveSheet.DrawingViews 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 & ".dwg", True) Next End If End Sub
Solved! Go to Solution.