Hello Community,
I'm looping through bom rows of an assembly environment. i got output like below.
Level 4 | Level 5 | Level 6 | Level 7 | Level 8 |
Assly 1 | Assly 2 | Assly 3 | Assly 4 | Cylinder 1 |
Assly 1 | Assly 2 | Assly 5 | Cylinder 2 |
i want distance between cylinder 1 and cylinder 2 based on its cg.
or if any other way, support with examples.
Solved! Go to Solution.
Solved by FINET_Laurent. Go to Solution.
Hello @gopinathmY575P,
Knowing that the center of gravity of an occurrence is a point, we can use the distanceTo method to get the distance between the two points. Also, center of gravity of an occurrence is called Center of mass. Here an example that let's you pick two occurrences inside an assembly & calculate the distance between the two (default in cm) :
Dim occ1 As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "")
Dim occ2 As Inventor.ComponentOccurrence = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "")
Dim cg1 As Point = occ1.MassProperties.CenterOfMass
Dim cg2 As Point = occ2.MassProperties.CenterOfMass
Dim distance As Double = cg1.DistanceTo(cg2) 'distance in cm!
MsgBox(distance)
Inventor 2022 Help | IiProperties.CenterOfGravity Property | Autodesk
Your question is not very precise, do you want to use the BOM to calculate ?
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Can't find what you're looking for? Ask the community or share your knowledge.