Changing Bill of Material "Base Unit"

Changing Bill of Material "Base Unit"

Bgoffard
Contributor Contributor
1,682 Views
6 Replies
Message 1 of 7

Changing Bill of Material "Base Unit"

Bgoffard
Contributor
Contributor

I cannot seem to find the proper nomenclature to use to change the Base Unit (Document Settings, Bill of Materials Tab) 

I am calling a named parameter, I need the parameter to remain as inches but I would like to change the Base Unit to feet. We use the value in inches in a cut list but the value as feet for the bill of material. 

Is there a way to change this using iLogic, without having to manually change it in the dialog box?

0 Likes
Accepted solutions (1)
1,683 Views
6 Replies
Replies (6)
Message 2 of 7

JelteDeJong
Mentor
Mentor

have a look at this post:

https://adndevblog.typepad.com/manufacturing/2014/10/inventor-virtual-component-assign-base-quantity... 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 7

Bgoffard
Contributor
Contributor

I have the customization to change the Base Quantity, was hoping to add a line to change the Base Units from "in" to "ft"

0 Likes
Message 4 of 7

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Bgoffard 

In order to do this you need to have base quantity set to a parameter. This example code sets the base quantity to a parameter named "Length" in the document, then sets the base unit to "ft".

 

Hope this helps!

 

Dim doc As Document = ThisDoc.Document

doc.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kParameterBOMQuantity, Parameter.Param("Length"))
doc.ComponentDefinition.BOMQuantity.BaseUnits = "ft"
Message 5 of 7

Bgoffard
Contributor
Contributor

This did it!

Thank you for your help.

Message 6 of 7

b_ruijter
Advocate
Advocate

How can I set them back to "Eatch", standard?

0 Likes
Message 7 of 7

WCrihfield
Mentor
Mentor

Hi @b_ruijter.  Maybe you are looking for something like this?

 

Dim oDoc As Inventor.Document = ThisDoc.Document
If (Not TypeOf oDoc Is AssemblyDocument) AndAlso (Not TypeOf oDoc Is PartDocument) Then Return
Dim oBOMQty As BOMQuantity = oDoc.ComponentDefinition.BOMQuantity
Dim eQtyType As BOMQuantityTypeEnum
Dim oQty As Object = Nothing
oBOMQty.GetBaseQuantity(eQtyType, oQty)
If eQtyType = BOMQuantityTypeEnum.kParameterBOMQuantity Then
	Try
		oBOMQty.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity)
		oBOMQty.BaseUnits = "Each"
	Catch ex As Exception
		Logger.Error("Error setting BOM Base Quantity to 'Each'!" _
		& vbCrLf & ex.Message)
	End Try
End If

 

Otherwise, could you please explain in more detail what you need?

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes