Hello,
I am trying to update a massive packet of drawing and view reps all need to be updated. Does anyone have a piece of code that will go through a drawing and flip on the "Associate" option and hit "OK" on every view on the current open idw?
It would save so much time for me rather than doing it manually
thank you
Solved! Go to Solution.
Hello,
I am trying to update a massive packet of drawing and view reps all need to be updated. Does anyone have a piece of code that will go through a drawing and flip on the "Associate" option and hit "OK" on every view on the current open idw?
It would save so much time for me rather than doing it manually
thank you
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
Hi @NikelARH4K2. Give this iLogic rule a try for that task.
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Return
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheets As Inventor.Sheets = oDDoc.Sheets
For Each oSheet As Inventor.Sheet In oSheets
Dim oViews As DrawingViews = oSheet.DrawingViews
If oViews.Count = 0 Then Continue For
For Each oView As DrawingView In oViews
If oView.DesignViewAssociative = False Then
Try
oView.SetDesignViewRepresentation(oView.DesignViewRepresentation, True)
Catch
Logger.Error("Error setting DVR as Associative in view named: " & oView.Name)
End Try
End If
Next 'oView
oSheet.Update
Next 'oSheet
oDDoc.Update
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
Hi @NikelARH4K2. Give this iLogic rule a try for that task.
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Return
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheets As Inventor.Sheets = oDDoc.Sheets
For Each oSheet As Inventor.Sheet In oSheets
Dim oViews As DrawingViews = oSheet.DrawingViews
If oViews.Count = 0 Then Continue For
For Each oView As DrawingView In oViews
If oView.DesignViewAssociative = False Then
Try
oView.SetDesignViewRepresentation(oView.DesignViewRepresentation, True)
Catch
Logger.Error("Error setting DVR as Associative in view named: " & oView.Name)
End Try
End If
Next 'oView
oSheet.Update
Next 'oSheet
oDDoc.Update
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield
(Not an Autodesk Employee)
That works beautifully thank you! i am going to tweak it to update all sheet before running the sub because if you dont Inventor crashes on my end
but once i update all the sheets it does exactly what i needed
thank you!
That works beautifully thank you! i am going to tweak it to update all sheet before running the sub because if you dont Inventor crashes on my end
but once i update all the sheets it does exactly what i needed
thank you!
Can't find what you're looking for? Ask the community or share your knowledge.