Showing results for 
Search instead for 
Do you mean 
Reply

Assigning a unit

[ Edited ]

Hello everyone!

 

I know one method to assign a unit variable: Unit kg = (Unit)workPart.UnitCollection.FindObject("Kilogram");

Is this the only way to make it? Or is it possible to assign it in a more traditional way?

3 REPLIES

Re: Assigning a unit

[ Edited ]

Basically, what I am unhappy about is that units defined in this way are the units of the particular part. If I need to assign attributes with this units to another part, I need to take extra steps to convert units so that they are the same type but from another part. I have a nagging feeling that I am doing something wrong. Man Happy

Re: Assigning a unit

What you could use is:

 

BasePart.Units unit = theSession.Parts.Work.PartUnits;

 

This returns the base units. Trying to understand if that's what you are looking for.

 

 

Re: Assigning a unit

But it is also returns units of a work part, no?