02-28-2024
11:40 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-28-2024
11:40 PM
Model state declaration in inventor 2024
Hi everyone , recently we upgrade inventor from 2020 to 2024 so there was some programs using the below code line , which "ilogic" now is coming under the model state not under representations and that's affecting on the BOM it gives QTY from Primary , can we update the below code.
"
Dim doc As AssemblyDocument = ThisDoc.Document Dim oLOD As LevelOfDetailRepresentation Dim oAsmCompDef As ComponentDefinition oAsmCompDef = doc.ComponentDefinition Try oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic").Activate(True) Catch Dim nLOD As LevelOfDetailRepresentation nLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("iLogic") oLOD = nLOD Finally oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic").Activate(True) End Try
"
02-29-2024
03:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
02-29-2024
03:37 AM
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!