- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The issue to begin with is likely using LOD's for things other than memory management. It's not a supported workflow by autodesk and you are bound to run into more headaches than it's worth. Additionally, not very many people actually understand what it does, so they may mistakenly think that it removes the suppressed files from the BOM (it doesn't), or that it's a good method for hiding things in drawings (it isn't - that's what view reps were made for).
I tested things out.
If I put the rule into an assembly (TestLODAsm), and add the "after open" trigger to it, opening and closing that FILE itself runs the rule just file.
If I then put TestLODAsm into an assembly as a child, as soon as I start trying to switch the LOD in the top level assembly, it throws errors.
I believe the issue is because of the fact it's opening up multiple DOCUMENTS that belong to the same file name or improperly closing them, and it therefore gets confused and errors out.
The code below "KIND-OF" works, but only in the sense that on initial open of the document (ie; while its the active edit document), does it work.
Dim doc as AssemblyDocument = ThisDoc.Document
If Not doc.Equals(ThisApplication.ActiveEditDocument)
Exit Sub
End If
Dim oAsmCompDef As ComponentDefinition = doc.ComponentDefinition
Try
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic")
Catch
Try
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("iLogic")
Catch
Exit Sub
End Try
End Try
Try
oLOD.Activate
Catch
MsgBox("Error ACTIVATING LOD")
Exit Sub
End Try
InventorVb.DocumentUpdate()
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization
iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread
Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects
Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help
Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type