Hi @jniehaus. That is obviously going to be a pretty complicated task to do entirely by code, because there are lots of different types of objects involved, and lots of different types of styles involved, each with its own unique set of properties and methods available to them. Some things also simply can not be easily accessed, because they may be buried under multiple levels, such as within SketchedSymbolDefinitions, TitleBlockDefinitions, BorderDefinitions, and similar, that must be set to an 'edit mode' before you can even access 'a copy of' their sketch, because the original sketch is protected from immediate changes, other than linked properties and prompted entries.
Below is one of the codes I have in my collection that you can try out. But even this long one is still not going to be able to cover every possible entity in an entire drawing document all at once, because not every entity is directly available in these main collections for direct edit. Some are locked away in sub definitions. You may simply need replace all existing 'definitions' with newly created ones, then purge out all the old ones.
This code example primarily tries to change the styles of all immediately accessible entities on all sheets of the drawing to the active standard default styles for those Types of objects. Good for when updating older drawings from a old template resources to a new ones, and have put in the effort to create new/updated styles for them to use.
Sub Main
Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
If oDDoc Is Nothing Then Return
UpdateToDefaultStyles(oDDoc)
oDDoc.Update2(True)
End Sub
Sub UpdateToDefaultStyles(oDDoc As DrawingDocument)
If (oDDoc Is Nothing) OrElse (Not oDDoc.IsModifiable) Then Return
Dim oActiveStd As DrawingStandardStyle = oDDoc.StylesManager.ActiveStandardStyle
Dim oDStyles As ObjectDefaultsStyle = oActiveStd.ActiveObjectDefaults
For Each oSheet As Sheet In oDDoc.Sheets
Dim oDDims As DrawingDimensions = oSheet.DrawingDimensions
For Each oGDim As GeneralDimension In oDDims.GeneralDimensions
If TypeOf oGDim Is LinearGeneralDimension Then
oGDim.Style = oDStyles.LinearDimensionStyle
ElseIf TypeOf oGDim Is AngularGeneralDimension Then
oGDim.Style = oDStyles.AngularDimensionStyle
ElseIf TypeOf oGDim Is DiameterGeneralDimension Then
oGDim.Style = oDStyles.DiameterDimensionStyle
ElseIf TypeOf oGDim Is RadiusGeneralDimension Then
oGDim.Style = oDStyles.RadialDimensionStyle
End If
Next oGDim
For Each oODim As OrdinateDimension In oDDims.OrdinateDimensions
oODim.Style = oDStyles.OrdinateDimensionStyle
Next
For Each oODS As OrdinateDimensionSet In oDDims.OrdinateDimensionSets
oODS.Style = oDStyles.OrdinateSetDimensionStyle
Next
For Each oCDS As ChainDimensionSet In oDDims.ChainDimensionSets
oCDS.Style = oDStyles.ChainDimensionStyle
Next
For Each oBDS As BaselineDimensionSet In oDDims.BaselineDimensionSets
oBDS.Style = oDStyles.BaselineDimensionStyle
Next
Dim oDNotes As DrawingNotes = oSheet.DrawingNotes
For Each oCN As ChamferNote In oDNotes.ChamferNotes
oCN.DimensionStyle = oDStyles.ChamferNoteStyle
Next
For Each oGN As GeneralNote In oDNotes.GeneralNotes
oGN.TextStyle = oDStyles.GeneralNoteStyle
Next
For Each oHTN As HoleThreadNote In oDNotes.HoleThreadNotes
oHTN.Style = oDStyles.HoleNoteStyle
Next
For Each oLN As LeaderNote In oDNotes.LeaderNotes
oLN.DimensionStyle = oDStyles.LeaderTextStyle
Next
For Each oPN As PunchNote In oDNotes.PunchNotes
oPN.DimensionStyle = oDStyles.PunchNoteStyle
Next
oSheet.Update
Next oSheet
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)