Can anyone help by providing a VBA script to to change the Level of display for an assembly AND ALL its sub-asseemblies automatically to an LOD that I called ilogic when opening the file.
I am running Inventor 2011 and I need this as it is creating some problems with the ilogic rules when they run....
Thanks for your help
Here is some .NET code. You will have to convert it to VBA. LOD works kind of funny from what I can tell. You must first set the LOD of the top assy and all sub-assy's and save the model. All my attempts to set the individual sub-assy's LOD result in an Inventor application crash.
Dim oMyDoc As Inventor.AssemblyDocument oMyDoc = invApp.ActiveDocument ' Set the Level Of Detail... Dim oRepMgr As Inventor.RepresentationsManager oRepMgr = oMyDoc.ComponentDefinition.RepresentationsManager Dim oMasterLOD As Inventor.LevelOfDetailRepresentation oMasterLOD = oRepMgr.LevelOfDetailRepresentations.Item('iLogic"
Also, here is an iLogic rule that I place in the sub assemblies that require component suppression
Sub SetLOD(ByVal myLOD As String) ThisApplication = InventorVb.Application oMyDoc = ThisDoc.ModelDocument ' Set the LOD to Master --------------------------------------------------
---------------------------- Dim oRepMgr As RepresentationsManager oRepMgr = oMyDoc.ComponentDefinition.RepresentationsManager Dim oMasterLOD As LevelOfDetailRepresentation oMasterLOD = oRepMgr.LevelOfDetailRepresentations.Item(myLOD) oMasterLOD.Activate() RuleParametersOutput() ' use this before DocumentUpdate InventorVb.DocumentUpdate() ' Update now End Sub
For iLogic Code to change the LoD I use the following (which is of course still VB , but it runs inside of an ilogic rule!)
'''We need to make sure the LOD is set correctly :
'''Public Enum LevelOfDetailEnum
''' kMasterLevelOfDetail = 56065
'''kAllComponentsSuppressedLevelOfDetail = 56066
'''kAllPartsSuppressedLevelOfDetail = 56067
'''kAllContentSuppressedLevelOfDetail = 56068
'''kSandboxLevelOfDetail = 56069
'''kTransientLevelOfDetail = 56070
'''kSubstituteLevelOfDetail = 56071
'''kCustomLevelOfDetail = 56072
'''kLastActiveLevelOfDetail = 56073
Dim doc as AssemblyDocument = ThisDoc.Document
If doc.ComponentDefinition.RepresentationsManager.ActiveLevelOfDetailRepresentation.LevelOfDetail <> 56072 'LevelOfDetailEnum.kMasterLevelOfDetail Then
Dim oLOD As LevelOfDetailRepresentation
Dim oAsmCompDef As ComponentDefinition
oAsmCompDef = doc.ComponentDefinition
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("ilogic")
That will change the main level of detail, but I'm sure you could throw it into the rules of your subassemblies and get similar results (maybe ). Use triggers to make it run on document open!
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.