Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mass as a custom property

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
chorch123
2817 Views, 2 Replies

Mass as a custom property

Hello,

I know this is an ancient topic but I have been unable to find a suitable answer.

My problem is that I need to show the physical property Mass in my Vault Basic.

The only way I know to do this is to create a custom property that I could import later in Vault.

When trying to create "Weight" (in order not to have the same name) as a custom property of the physical property Mass I find some inconveniences:

- There is too much precision, I have 6 decimal numbers after the point.

- The result is in gramms

I define Custom property, as a text property, =<Mass> kg

So, is there any way that I can obtain this property as:

0.4 kg                    instead of

432.562014 kg       ?

Thank you very much in advanced

 

2 REPLIES 2
Message 2 of 3
chorch123
in reply to: chorch123

Hello again,

I had forgotten that I need to do this for .ipt and .iam.

For parts I can create the custom property, despite its customization, but I have no idea how to do it with an assembly, because Inventor doesn't recognise <Mass> as property.

Thanks again

Jorge

Message 3 of 3
Anonymous
in reply to: chorch123

Not really sure if this will help you but I have this piece of code which changes the amount of decimal places based on the total weight.

Dim mass As Decimal 
mass = iProperties.Mass

Dim massString As String


Select Case mass
	Case < 1 
	massString = CStr(Round(mass, 2, MidpointRounding.AwayFromZero))& " kg"
	Case 1 To 10 
	massString = CStr(Round(mass, 1, MidpointRounding.AwayFromZero))& " kg"
	Case > 10 
	massString = CStr(Round(mass, 0, MidpointRounding.AwayFromZero))& " kg"
End Select 

iProperties.Value("Custom", "Mymass")= massString

 I can then populate the drawing border with the custom property. Works in part and assembly files also.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report