Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic LOD BOM question

9 REPLIES 9
Reply
Message 1 of 10
HermJan.Otterman
1382 Views, 9 Replies

iLogic LOD BOM question

Why do I have to save every time when a LOD (iLogic) is active to get the BOM? even if only the position of one part changes a bit.

You can see this by: open a new Assembly, create a new part, (draw a block) create a new LOD (f.e. iLogic)

when you are in the master LOD you can alway get the BOM.

when the iLogic LOD is active, you first have to save to get the BOM. when you move the part only a tiny bit, you will have to save the assembly first to get the BOM... WHY??? nothing changed in regarding to the BOM? or is there something I don't see?

I ask this question because our Assembly that we want to configurate through iLogic is very big, so it take some time evrey save. And even at one point we could not open the BOM because we had to save it first, and after the save the BOM still did not work because it prompted to save the assembly first.

what can be done about this? is there maybe a different workflow?

 

thanks

Henk

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


9 REPLIES 9
Message 2 of 10

I am new in iLogic. I have this problem too.

 

Error message comes up when I press the “Bill of Materials” button on the ribbon bar:

“the assembly must be saved before performing the bill of Materials operation.”

Same error even after saving. Don't know why. May some sub-assembies or parts are in library which are needed to be saved.

 

Sometimes switching it to Master LOD followed by Save All command, and swift back to custom LOD, it will allow me to access to BOM (custom LOD). Or close the assembly and reload it again without doing any change.

 

Our company uses a Macro to export BOM into our ERP data base. And we are looking into using iLogic in one project for the first. Now the model works fine with iLogic for different configerations. But this BOM problem stops the Macro to access the BOM. Unless I can find a way to resovle this issue, iLogic will be unusable for what we are doing.

 

Can anyone suggest a iLogic Snippet or VBA code to resovle this issue?

 

Thanks.

J

Tags (2)
Message 3 of 10

I feel your pain about LOD!!  When this feature first came out (2010 I think) I, like many others thought "Great!  We now have Configurations, like Solidworks - yaay!"  

But alas, no - its just a trick on us.  Not only is LOD NOT useable for configurations, it is rife with bugs, and no one at Autodesk is taking it seriously it seems.  LOD it turns out is supposed to be for memory management of large assemblies, and nothing more.

But you will constantly have issues with saving and or getting the BOM if you have a custom LOD anywhere in your assembly tree. (Especially if you are doing anything programmatically)  This means that you cannot supress parts in an assembly, or you get hosed!

 

The workflow I suggest is this:  Delete out all custom LODs from your assemblies, and never use them again.  This is the only workaround that is solid.

However, you can accomplish a similar result by using View Reps to turn off visibility of components, and at the same time setting the BOM status of invisible parts to Reference.  The BOM can be filtered to match the View Rep (as long as you dont have any Virtual components) and in this way "Configurations" can be sort of "fudged" in Inventor, and iLogic can handle this too.

 

I know its not good news, but hope it helps 🙂

James

Message 4 of 10

I found a snippet at this forum. It seams to iterate through the BOM. I hope it will it will only work on first level BOM, not anything under. If I have this snippet in every sub-assemblies that I had LOD, this should do the same job. I will have a go.

 

' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
'set BOM as default if the component is visible
If Component.Visible(oOccurrence.Name) = True Then
Component.InventorComponent(oOccurrence.Name).BOMStructure = _
BOMStructureEnum.kDefaultBOMStructure
'set BOM as reference if the component is not visible
ElseIf Component.Visible(oOccurrence.Name) = False Then
Component.InventorComponent(oOccurrence.Name).BOMStructure = _
BOMStructureEnum.kReferenceBOMStructure
End If
Else
End If
Next

 

Message 5 of 10
jianbinlin
in reply to: jianbinlin

Do I need to creat Design View for sub-assemblies? Or just leave them Master?

Message 6 of 10
jianbinlin
in reply to: jianbinlin

Subassemblies neeed to use ThisDoc.Document rather than ThisApplication.ActiveDocument

oAsmCompDef = ThisDoc.Document.ComponentDefinition

Otherwise, when I run ilogic rule from top level assembly, rule from sub-assemblies will look for BOM ComponentOccurrence from top top level assembly and have errors.

 

And I am using Ilogic to control visibility of parts in a subassembly of my top level assembly. The BOM is correct. But the visibility looks incorrect from the top level Assembly and subassemblies. Only when I run rule inside of the subassembly, it display correctly.

 

I think I do need to create View Rep at subassemblies and link them to top level assembly. I guess I need to get some codes to turn View Rep to All Visible before execute Component.Visible and set BOM to reference. Just in case I hide any part or assemblies by mistake. Then the BOM will miss the part.

 

I wrote the following codes below. Works fine for me.

 

Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisDoc.Document.ComponentDefinition
Dim oViewRep As DesignViewRepresentation
RepName = "iLogic"
Try		' Try activate DesignViewRepresentations
	oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item(RepName)
	oViewRep.activate
Catch	'create iLogic view rep
	oViewRep = oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add(RepName)
	oViewRep.Activate
End Try
oViewRep.ShowAll

'Hide PART_A for example
Component.Visible("PART_A:1") = False

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
	'set BOM as default if the component is visible
	If Component.Visible(oOccurrence.Name) = True Then
	Component.InventorComponent(oOccurrence.Name).BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	'set BOM as reference if the component is not visible
	ElseIf Component.Visible(oOccurrence.Name) = False Then
	Component.InventorComponent(oOccurrence.Name).BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	End If
End If
Next

 

 

Message 7 of 10
jianbinlin
in reply to: jianbinlin

Just realised I don't need to use Component.Visible("PART_A:1") = True to enable part.

Because oViewRep.ShowAll has already done the job.

This is actually quicker to enable all the parts I wanted. In LOD, I have to use Component.IsActive("PARTS:1") = True for every part.

Message 8 of 10
jianbinlin
in reply to: jianbinlin

A new sulution often brings new problems. And here it is:

 

oViewRep.ShowAll disable my View Rep associated to certain subassemblies.

I have to use code below to keep view rep to be associative

 

Component.InventorComponent("Asembly_A:1").SetDesignViewRepresentation("iLogic",,True)

 

And I doing right?

Message 9 of 10
jianbinlin
in reply to: jianbinlin

New question:

 

I have Assembly_A:1, maybe Assembly_A:2 and Assembly_A::3 as well, which are in a Pattern depends on configaration.

 

Component.InventorComponent("Assembly_A:1").SetDesignViewRepresentation("iLogic",,True)

 The above code can only set Assembly_A:1. How can I tell ilogic to set them all if they exist? Thank you very much.

Message 10 of 10
jianbinlin
in reply to: jianbinlin

Seems not many people is interesed at helping. Any way, glad I know a little VB. I ended up using:

For i = 1 to Pattern_QTY

Next

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums