Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic: set pattern parts to BOM reference & default

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
2229 Views, 12 Replies

Ilogic: set pattern parts to BOM reference & default

Hi,

 

I made a flanged connection using I logic. Very simple Tube + Flange + Gasket + Blind flange + Bolting.

 

Then I tried to write some ilogic rule to have Blind flange on / off when needed, hence the Gasket & Bolting also need to be off. Like in these images:

 

Bolting.png

 

That works fine visually, but I also want the BOM to be set accordingly. For the Blind flange & Gasket my BOM is OK. But for my bolting the BOM is not OK.

 

I tried to set the BOM structure the same way as the visibility but that failed. It only subtracted 1 bolt from my list (see code)

 

If Blindflange_status = 0 Then 'Bolting off
	Component.InventorComponent("Bolting:1").BOMStructure = BOMStructureEnum.kReferenceBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Bolting:1") = False
Else 'Bolting on
	Component.InventorComponent("Bolting:1").BOMStructure = BOMStructureEnum.kDefaultBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Bolting:1") = True
End If

 

Is there a way to set all parts within a pattern BOM structure?

I made my bolting  by adding 1 bolt, 1 washer & 1 nut and then pattern them using feature pattern select.

12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Anonymous

Nobody knows how to do this?

Message 3 of 13
yannicknielsen
in reply to: Anonymous

It's the same parts, so I don't see why it should only remove one. I'm no iLogic wizard, but why don't you just add a supression for the pattern in that code as well?

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 4 of 13
Anonymous
in reply to: yannicknielsen

Because the rule is based on the browser name:

 

In a pattern i have Bolt:1 - 8 times - this will make

 

Bolt:1

Bolt:2

...

 

This makes my rule only good for Bolt:1 

 

Adding surppression would make a LOD and that is what i'm trying to avoid.

Message 5 of 13
yannicknielsen
in reply to: Anonymous

If Blindflange_status = 0 Then 'Bolting off
	Component.InventorComponent("Bolting:1").BOMStructure = BOMStructureEnum.kReferenceBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.InventorComponent("Bolting:2").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.InventorComponent("Bolting:3").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.InventorComponent("Bolting:4").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.InventorComponent("Bolting:5").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.InventorComponent("Bolting:6").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.InventorComponent("Bolting:7").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.InventorComponent("Bolting:8").BOMStructure = BOMStructureEnum.kReferenceBOMStructure
	Component.Visible("Bolting:1") = False
	Component.Visible("Bolting:2") = False
	Component.Visible("Bolting:3") = False
	Component.Visible("Bolting:4") = False
	Component.Visible("Bolting:5") = False
	Component.Visible("Bolting:6") = False
	Component.Visible("Bolting:7") = False
	Component.Visible("Bolting:8") = False
Else 'Bolting on
	Component.InventorComponent("Bolting:1").BOMStructure = BOMStructureEnum.kDefaultBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.InventorComponent("Bolting:2").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.InventorComponent("Bolting:3").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.InventorComponent("Bolting:4").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.InventorComponent("Bolting:5").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.InventorComponent("Bolting:6").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.InventorComponent("Bolting:7").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.InventorComponent("Bolting:8").BOMStructure = BOMStructureEnum.kDefaultBOMStructure
	Component.Visible("Bolting:1") = True
	Component.Visible("Bolting:2") = True
	Component.Visible("Bolting:3") = True
	Component.Visible("Bolting:4") = True
	Component.Visible("Bolting:5") = True
	Component.Visible("Bolting:6") = True
	Component.Visible("Bolting:7") = True
	Component.Visible("Bolting:8") = True
End If

 

Maybe there's an easier way - But I tested with my assembly, and I could get it to set it all to reference or normal depending on if it was active or not

 

If Bolting:1 is your pattern (which consists of single parts), then you need to mark the first instances of the parts and demote them to an assembly

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 6 of 13
Anonymous
in reply to: yannicknielsen

Yes. This works, I know that.

 

Problem is (as you may know) there are a lot of different flange sizes all with different no. of bolting,

 

which would make my rule not so "smart" if I code it that way.

 

I'm looking for a "smart" rule that checks the pattern feature and removes items from BOM accordingly.

Visibility is not a problem that I can do for the entire pattern.

 

 

My alternative is add the entire flange tabel in a rule with the No. of bolting. Then set the No. of bolting to 1 when there is no blindflange needed. This would remove my BOM issue.

 

But it will also create a new problem. (if i edit the flange(s) to a size thats new. I would also have to edit the rule)

Message 7 of 13
yannicknielsen
in reply to: Anonymous

If Blindflange_status = 0 Then 'Bolting off
For InstanceNumber = 1 To d3
	Component.InventorComponent("Solid1_1:" & InstanceNumber).BOMStructure = BOMStructureEnum.kReferenceBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Solid1_1:" & InstanceNumber) = False
	Next
Else 'Bolting on
For InstanceNumber = 1 To d3
	Component.InventorComponent("Solid1_1:" & InstanceNumber).BOMStructure = BOMStructureEnum.kDefaultBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Solid1_1:" & InstanceNumber) = True
	Next
	
End If

 For InstanceNumber = 1 to d3 <--- This would be the parameter name of your pattern number.
For it to work, that parameter has to have the same name in all your assemblies.

 

 

 Component.InventorComponent("Solid1_1: <--- Remember the :, and put in your own instance name

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 8 of 13
Anonymous
in reply to: yannicknielsen

Ok,

 

But i did this when i placed my pattern i choose feature pattern select. because the qty is always correct this way. No error margin.

 

How do i get youre "d3" then?

 

Bolting 4.png

 

Thanks for the help already. didn't know about the "For InstanceNumber" code.

Message 9 of 13
yannicknielsen
in reply to: Anonymous

Ilogic

 

 

As you can see on the red boxes - When you click the parameters, it will show to the right. find the right parameter, and you'll be able to double click.

or simply figure out what the name is from the parameters menu, and then write that. It becomes blue when it refers to a parameter in your assembly

 

And just to avoid confusion - The part only shows two parameters because I made a box to show you an example. The proper part is at my work place

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 10 of 13
mrattray
in reply to: yannicknielsen

Because he's reusing the pattern, he doesn't have a parameter exposed in the assembly that he can use. It could be possible to extract the pattern form the part whose pattern you're reusing if it doesn't change on you.
However there may be a better way: You should be able to drill directly into the pattern's collection object and run a for each loop on all of the component patterns elements. The only catch here would be that your pattern would always need to have the same name(or some other constant identifier).
If you could post an example file it would make it much easier for me to write something up for you.
Mike (not Matt) Rattray

Message 11 of 13
yannicknielsen
in reply to: mrattray

'Get the part and dimension that controls the pattern amount
CircularPattern =Parameter("Part1:1", "d0")

If Blindflange_status = 0 Then 'Bolting off
For InstanceNumber = 1 To CircularPattern
	Component.InventorComponent("Solid1_1:" & InstanceNumber).BOMStructure = BOMStructureEnum.kReferenceBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Solid1_1:" & InstanceNumber) = False
	Next
Else 'Bolting on
For InstanceNumber = 1 To d3
	Component.InventorComponent("Solid1_1:" & InstanceNumber).BOMStructure = BOMStructureEnum.kDefaultBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Solid1_1:" & InstanceNumber) = True
	Next
	
End If

 Try this. In the first line to bring in a parameter from a part in the assembly. The code then uses that parameter.
For this to work, the circular pattern dimension must have the same name in all of your assemblies

---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021
Message 12 of 13
mrattray
in reply to: yannicknielsen

You forgot to change d3 to CircularPattern in the second for-next loop.
Mike (not Matt) Rattray

Message 13 of 13
yannicknielsen
in reply to: mrattray

'Get the part and dimension that controls the pattern amount
CircularPattern =Parameter("Part1:1", "d0")

If Blindflange_status = 0 Then 'Bolting off
For InstanceNumber = 1 To CircularPattern
	Component.InventorComponent("Solid1_1:" & InstanceNumber).BOMStructure = BOMStructureEnum.kReferenceBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Solid1_1:" & InstanceNumber) = False
	Next
Else 'Bolting on
For InstanceNumber = 1 To CircularPattern
	Component.InventorComponent("Solid1_1:" & InstanceNumber).BOMStructure = BOMStructureEnum.kDefaultBOMStructure  'Sets BOM Structure to Reference (Remove from BOM)
	Component.Visible("Solid1_1:" & InstanceNumber) = True
	Next
	
End I

 Right you are!

 
---------------------------------------------------------------------------------------------------------------------
Product Design Suite Ultimate 2021

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

Post to forums  

Autodesk Design & Make Report