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: 

Working with ConvertUnits to emulate [bar] pressure.

1 REPLY 1
SOLVED
Reply
Message 1 of 2
albertuan
185 Views, 1 Reply

Working with ConvertUnits to emulate [bar] pressure.

Hi to all,

 

I'm quite new to this forum. I tried, but I did not find any similar topic, so I'm asking your help.

 

I'm using Inventor 2019 and I need to manage pressure in bar ( Pascall x 100000 )

 

I store this value in a unitless param called "pressure_bar". 

 

Now I have to fill the param "pressur_psig" that is in [psi]

 

I expected to be able to write something like :

Parameter("PRESSURE_BAR") = ThisApplication.UnitsOfMeasure.ConvertUnits(Parameter("PRESSURE_PSI"),UnitsTypeEnum.kPSIPressureUnits, UnitsTypeEnum.kPascalPressureUnits) * 10^5

 

After a ton of attempts, that's what I find that works

Parameter("PRESSURE_BAR") = ThisApplication.UnitsOfMeasure.ConvertUnits(Parameter("DESIGN_PRESSURE_PSIG"), UnitsTypeEnum.kPSIPressureUnits, UnitsTypeEnum.kPSIPressureUnits)/ 10^2

 

Why? 😲

 

Can anyone explain it to me?

 

Thanks a lot!

1 REPLY 1
Message 2 of 2
albertuan
in reply to: albertuan

Sorry,

 

Now I have understood.

 

The "internal" Unit Of Measure of a PSI Parameter is KPascal.

 

The assignment of a PSI Parameter to a UnitLess Paramete assign to the UnitLess parameter the "internal" value in KPascal.

 

So, with my first attempt, I was doing a double conversion. The correct grammar is simply and assignment, and a reduction of factor 100 to convert KPascal in bar.

 

Parameter("PRESSURE_BAR") = Parameter("PRESSURE_PSIG") / 10^2

 

Where are true the two conditions:

Parameter.Param("PRESSURE_BAR").Units = UnitsTypeEnum.kUnitlessUnits
Parameter.Param("PRESSURE_PSIG").Units = UnitsTypeEnum.kPSIPressureUnits

Hope it could help others ... the assignment to a unitless parameter, with the automatic conversion to an "internal unit of measure", I didn't find it so intuitive.

 

🤔

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

Post to forums  

Autodesk Design & Make Report