Tot Volume Tot weight

Tot Volume Tot weight

bespel
Advocate Advocate
519 Views
3 Replies
Message 1 of 4

Tot Volume Tot weight

bespel
Advocate
Advocate

Hi,

 

hope you can help me.

 

Is it possibile with a rule, in an assembly,  to write as parameters or custom iprop(at assembly level)  the total weight and total volume summed for every parts?

 

Ex. in an assembly I have 10 parts called "PartA", 1 kg and 1 dm^3 each.

The rule should write(in the assembly)  (as parameters or custom iprop)

 

Tot_Vol 10

Tot_Weight 10

I really hope that it's possible...

 

Thanks!

 

0 Likes
520 Views
3 Replies
Replies (3)
Message 2 of 4

bradeneuropeArthur
Mentor
Mentor

For my understanding:

 

Assembly X

>>Part A - 1 kg each- 10 times = total weight = 10 kg

>>Part B - 2 kg each- 20 times = total weight = 40 kg

 

What should the property be called in the Assembly X for each part?

"Part A total Weight" with value 10 kg

"Part B total Weight" with value 40 kg

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 4

Sergio.D.Suárez
Mentor
Mentor

Hi, Try this rule from the assembly.
This rule will look at the BOM parts only, take the quantity and multiply it by the volume and with this value it will create a property called "TotalVolume" in each part. It will also create another custom property called "TotalMass".
I hope this is what you are looking for or that at least it will help you to achieve it. regards

 

Dim doc As AssemblyDocument = ThisDoc.Document
Dim oAssyDef As AssemblyComponentDefinition = doc.ComponentDefinition
Dim oBOM As BOM = oAssyDef.BOM

oBOM.PartsOnlyViewEnabled = True

Dim oBOMView As BOMView = oBOM.BOMViews.Item(3)'BOM parts only 

Dim oBOMRow As BOMRow

For Each oBOMRow In oBOMView.BOMRows

	Dim Qty As Double = oBOMRow.TotalQuantity
	Dim rDoc As Document = oBOMRow.ComponentDefinitions.Item(1).Document
	Dim oVoltotal As Double = rDoc.ComponentDefinition.MassProperties.Volume * Qty 
	Dim oMassTotal As Double = rDoc.ComponentDefinition.MassProperties.Mass * Qty
	
	Try
	rDoc.PropertySets.Item("Inventor User Defined Properties").Item("TotalVolume").Value = Round(oVoltotal, 0) & " cm^3"
	Catch
	rDoc.PropertySets.Item("Inventor User Defined Properties").Add(Round(oVoltotal,0) & " cm^3", "TotalVolume")		
	End Try
	
	Try
	rDoc.PropertySets.Item("Inventor User Defined Properties").Item("TotalMass").Value = Round(oMassTotal,3) & " Kg"
	Catch
	rDoc.PropertySets.Item("Inventor User Defined Properties").Add(Round(oMassTotal,3) & " Kg", "TotalMass")		
	End Try

Next

 


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

0 Likes
Message 4 of 4

bespel
Advocate
Advocate

You are very kind my friend.

 

I will test these.

 

Thanks!

0 Likes