Hello,
ist there a way to check if a assembly is open alone or in an other assembly?
I need to switch the level of detail after opening the assembly. But these assemblys can be i another assembly which is also switching the level of detail.
And then Inventor shows up an error message.
The Code is:
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
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
I think you should be able to compare the document you got back from ThisDoc.Document to the Application.ActiveDocument. Even if another document has been in-place activated within an assembly, the top-level assembly remains the active document. You can compare them using the Is statement like:
If ThisDoc.Document Is ThisApplication.ActiveDocument Then MsgBox("Top-Level assembly is being edited.") Else MsgBox("A component in the assembly is being edited") End If
I'll try it!
But in the meantime i had the idea to suppress the rule in the subassembly from the Top-Level Assembly.
Is this possible?
It should also solve my problem!