Change bom-structure with a custom parameter

Change bom-structure with a custom parameter

stefan.godfroid
Participant Participant
815 Views
4 Replies
Message 1 of 5

Change bom-structure with a custom parameter

stefan.godfroid
Participant
Participant

Hello

 

I want to change the bom-structur with a custom parameter (TEKENINGCODE).

 

The bom-structure must be Purchased when TEKENINGCODE= B, LB, LK, T, D, DS or K

The bom-structure must be Inseperable when TEKENINGCODE= L

The bom-structure must be Phantom when TEKENINGCODE= x

in other cases (other letters, or nothing entered), then the bom-structure must be normal.

 

How can i do that with I-logic?

 

Thanks

0 Likes
Accepted solutions (1)
816 Views
4 Replies
Replies (4)
Message 2 of 5

Sergio.D.Suárez
Mentor
Mentor

in part, you can use an ilogic like this, changing the multiple value will change the BOM reference

 

Dim oDoc As Document = ThisApplication.ActiveDocument
'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.

' TEKENINGCODE is user parameter in part
If TEKENINGCODE ="L"
oDoc.ComponentDefinition.BOMStructure = BOMStructureEnum.kInseparableBOMStructure
Else
	If TEKENINGCODE ="x"
	oDoc.ComponentDefinition.BOMStructure = BOMStructureEnum.kPhantomBOMStructure
	Else
	oDoc.ComponentDefinition.BOMStructure = BOMStructureEnum.kNormalBOMStructure
	End If
End If
InventorVb.DocumentUpdate()

 

parameter.jpg

 

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 5

stefan.godfroid
Participant
Participant

But TEKENCODE is a Custom iproperties.  Sorry for the wrong info.

And the purchased bomstructure?

 

When the Custom ipropertie TEKENCODE= B, LB, LK, T, D, DS or K,  then the bomstructure must be set to Purchased.

When the Custom ipropertie TEKENCODE= L, then he bomstructure must be set to inseperable

When the Custom ipropertie TEKENCODE= x, then he bomstructure must be set to phantom

In other cases (other letters, or nothing entered), then the bom-structure must be normal.

 

How can it be done with ilogic?

0 Likes
Message 4 of 5

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hello, you can try the following code, I think it should work. 

 

Dim oDoc As Document = ThisApplication.ActiveDocument
oDoc.ComponentDefinition.BOMStructure = 51970
On Error Resume Next

Dim oProp As String = iProperties.Value("Custom", "TEKENINGCODE") 

If oProp = "L" Then oDoc.ComponentDefinition.BOMStructure =  51974
If oProp = "x" Then oDoc.ComponentDefinition.BOMStructure =  51971

If oProp = "B" Or oProp = "LB" Or oProp = "LK" Or _
	oProp = "T" Or oProp = "D" Or oProp = "DS" Or oProp = "K" Then
	oDoc.ComponentDefinition.BOMStructure = 51973
End If

InventorVb.DocumentUpdate()

'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. Regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 5 of 5

stefan.godfroid
Participant
Participant

It seems to be working!

 

Thanks!

0 Likes