iLogic rule for BOM Structure executing wrong Enum

iLogic rule for BOM Structure executing wrong Enum

bhavik4244
Collaborator Collaborator
962 Views
2 Replies
Message 1 of 3

iLogic rule for BOM Structure executing wrong Enum

bhavik4244
Collaborator
Collaborator

Hello,

 

I am struggling with a rule to control BOM structure Default or Reference. Here below the rule is, when insulation is True it needs to be set BOM structure at default (51969) but it showing the 51972 value when it's set to run.

Can someone please help?

 

    If  Insulation = True Then

    Component.Visible("Cladding_1300") = True
	oCompOcc = Component.InventorComponent("Cladding_1300")
	oCompOcc.BOMStructure = 51969
	MessageBox.Show(oCompOcc.BOMStructure)
	
	Else If Insulation = False Then
	
	oCompOcc = Component.InventorComponent("Cladding_1300")
	oCompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.Visible("Cladding_1300")= False

	
    End If 

 

Thanks,

Bhavik


Bhavik Suthar
0 Likes
963 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

I didn't see where oCompOcc was defined, and I noticed you had the same line in two places so I switched a couple things around for you.  Also I assume this is a local iLogic rule, right? And Insulation is a local Parameter within the same document as the rule?  If so, try this.

 

 

Dim oCompOcc As ComponentOccurrence = Component.InventorComponent("Cladding_1300")
If Insulation = True Then
    Component.Visible("Cladding_1300") = True
	oCompOcc.BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	MessageBox.Show(oCompOcc.BOMStructure.ToString)
Else If Insulation = False Then
	oCompOcc.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.Visible("Cladding_1300")= False
End If

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • MessageBox, InputBox, and InputListBox Size & Format Options Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Curtis_Waguespack
Consultant
Consultant

Hi @bhavik4244 

 

As written your code is indeed working to set the BOM struture to default, the occurrence can be default and normal at the same time.

 

Recall that you can have the same component file inserted multiple times in an assembly, and that each component occurrence can be set separately to be either of these :

  • Default (meaning it follows the default BOM structure set in the Document Settings of the file)
  • Reference (meaning it carries a BOM structure override for that one occurrence of the component in the assembly)
 

Here the first instance is set to be Default (which happens to be Normal in the Document Settings of the file)

image.png

 

 

Here we see the Document Settings option at the file level to set the default BOM structure :

 

image.png

 

Returning to the assembly level we can see that I have two occurrences of the same file, but the bottom one has been set to have an occurrence BOM structure of Reference ( an override) , and the other is set to be Default (Normal) 

 

image.png

 

So when we use the code to set the bomstructure enum to Default we are telling the occurrence to just use the file's default structure, which in my example returns Normal, and that is what your message box is returning.

BOMStructureEnums:

Name Value Description
kDefaultBOMStructure 51969 The default structure type.
kInseparableBOMStructure 51974 The inseparable structure type.
kNormalBOMStructure 51970 The normal structure type.
kPhantomBOMStructure 51971 The phantom structure type.
kPurchasedBOMStructure 51973 The purchased structure type.
kReferenceBOMStructure 51972 The reference structure type.
kVariesBOMStructure 51975 The structure type varies amongst references.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature