Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Hi! 

 

I recommend to not use LevelOfDetailRepresentations anymore, since the level of details are removed from Inventor, we only have Model States and View Representations

 

you can use following code to activate a view representation or add one:

Try
	oDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Item("Default").Activate
Catch
	oDoc.ComponentDefinition.RepresentationsManager.DesignViewRepresentations.Add("Default")
End Try

 

and following to activate a model state or add one

Try
	oDoc.ComponentDefinition.ModelStates.ActiveModelState = "Default"
Catch
	oDoc.ComponentDefinition.ModelStates.Add("Default")
End Try

 

just replacing "LevelOfDetailRepresentation" with "DesignViewRepresentations" should also be enough to fix your code

 

Happy coding!