VBnet mass

VBnet mass

Anonymous
Not applicable
582 Views
6 Replies
Message 1 of 7

VBnet mass

Anonymous
Not applicable

Is there anyway via ilogic or VBnet(Or anything possible) to set the mass of  1 body of multybody part to zero???

0 Likes
583 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

Sure.

Dim oDoc As AssemblyDocument

    oDoc = _InvApplication.ActiveDocument

 

    Dim oAssDef As ComponentDefinition

    oAssDef = oDoc.ComponentDefinition

 

    Dim oMassProperties As MassProperties

    oMassProperties = oAssDef.MassProperties

 

    oMassProperties.Mass ="0"

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 7

JelteDeJong
Mentor
Mentor

I tested the following code. but on further investigation, I discovered that this looks very promising but in fact, it sets the mass property of the complete part...

Dim doc As PartDocument = ThisDoc.Document
Dim def As PartComponentDefinition = doc.ComponentDefinition

Dim body As SurfaceBody = def.SurfaceBodies.Item(1)

Dim bodyDef As PartComponentDefinition = body.ComponentDefinition
Dim mass As MassProperties = bodyDef.MassProperties

mass.Volume = 1

Also, I found this topic. Here someone wants to get the value (not set it). The Autodesk employee confirms that there is no direct way to get the value. He proposes some alternative ways to get the value but I guess it will not help you set the values. I came to the conclusion that it's not possible to set the mass of a solid body.

 

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

Message 4 of 7

Anonymous
Not applicable

I konw there is no way with ilogic or VBA. But i am wondering is there a way in VB.net (Like if you want to make an add-in)? I know it's more complicated. I don't want to start learning making add-ins if i don't know if i can set one body mass  of multibodypart to zero??????

0 Likes
Message 5 of 7

JelteDeJong
Mentor
Mentor

When you write iLogic rules you are writing vb.net code. To interact with Inventor by code in an add-in you need to use the same API as the API you have access to in iLogic. Therefore there is no difference between what you can do with iLogic and an add-in. (I have to note that there are some things that are very hard to do by iLogic rule. Like reacting to events.) So in your case creating an add-in will not help you.

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 6 of 7

WCrihfield
Mentor
Mentor

Just a passing thought, but if you really need to eliminate the calculation of mass from one separate body in a multi-body part, you may need to convert that body to a surface, instead of a solid, one way or another.  It might be possible to do by code if that sounds like a plan that would work for your situation.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 7

Anonymous
Not applicable

It's a great idea but sadly it doesn't help in my case. Maybe a way to check the changed body mass or changed body volume would help in my case?? If i can't change it via ilogic, than i want to in some way check If the changed body mass(or body volume is zeri). Is this maybe possible???

0 Likes