[Bf-taskforce25] Units/Dimensions through RNA

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Mon Aug 10 16:40:51 CEST 2009


Hi Campbell,

I work in an international company using imperial and metric units on
both side of the Atlantic. To ease our work we created a tool that
converts any unit to the desired one. I cannot share code but I can
explain how this simple tool works so you can reverse-engineer it
easily. What we did is define sets of physical quantities, like time,
mass, flow, etc. Each of these sets have certain corresponding units
like time has minute/hour/day etc. Additionally each phys.quant has a
default unit defined. This default unit relates all other units within
the phys.quant set.

The nice thing about this setup is that converting a unit within a
physical quantity is a simple linear relationship. So you only need a
bias and conversion factor. The conversion factor for s -> m in
physquant "Time" would be (f)actor=60 and (b)ias=0. For C->F belonging
to physquant "Temperature" you would need f=9/5 and b=32. And behold the
same conversion belonging to physquant "Temperature difference" would
have f=9/5 and b=0. So you see the context of a unit is also important,
hence the phys. quant. defined.

Additionally you can assign each unit belonging to the metric or
imperial system, so you can switch blender globally from displaying
metric or imperial units. 

Regards, Darius

On Mon, 2009-08-10 at 06:55 -0700, Campbell Barton wrote:
> Sure, it can work for angles, radian/deg but  time too so you can type
> in 2hr or 10sec, though Id like to get dimensioning working first then
> adding others should be trivial.
> 
> http://sourceforge.net/projects/units/
> I tried using this unit library but its advanced in ways we don't need
> and missing in some we do. Focuses a lot more on translating input
> then humanly readably output where you can only give it a base unit
> and it gives you back a number.
> 
> So Id prefer to do our own (its not that big I deal to write I think)
> 
> On Mon, Aug 10, 2009 at 5:59 AM, William Reynish<william at reynish.com> wrote:
> > That sounds great. And the ability to mix and match unit types is neat.
> >
> > Perhaps this could work for degrees too?
> >
> > Cheers,
> >
> > -W
> >
> >
> > On 10 Aug, 2009, at 2:48 PM, Campbell Barton wrote:
> >
> >> Recently I was thinking that RNA api could be easily used to display
> >> and output units - metric/imperial for buttons defined as distance,
> >> time, volume, weight etc.
> >> My plan is to get this working for RNA button input/output, and after
> >> that maybe use these settings for the view grid and transform numeric
> >> input.
> >>
> >> http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DimensionRNA
> >>
> >> --
> >> - Campbell
> >> _______________________________________________
> >> Bf-taskforce25 mailing list
> >> Bf-taskforce25 at blender.org
> >> http://lists.blender.org/mailman/listinfo/bf-taskforce25
> >
> > _______________________________________________
> > Bf-taskforce25 mailing list
> > Bf-taskforce25 at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-taskforce25
> >
> 
> 
> 



More information about the Bf-taskforce25 mailing list