From Inkscape Wiki
Revision as of 15:46, 20 April 2007 by Colin Marquardt (Reverted edits by Fr2Xu8 (Talk); changed back to last version by NathanHurst)
njh has put a prototype written in python in experimental/units/ It still needs lots of work.
<njh> bryce: are you familiar with the program 'units'? <bryce> no <njh> apt-get install units <njh> you probably already have it installed <bryce> yup <bryce> hmm, no man page <njh> well I've been thinking about a gtk widget that allows users to enter anything that units would accept <bryce> what's it do? <njh> run it <njh> type <njh> attoparsec <njh> mm <njh> You have: attoparsec You want: mm * 30.856776 / 0.032407793 <njh> that tells you that to convert from attoparsecs to millimetres you need to multiply by 30.8 <njh> You have: foot slugs / (furlong fortnight) You want: Definition: 1.8280365e-08 kg / s <bryce> ahh <bryce> heh, I wrote a unit converter thingee long ago. Cool. <njh> now for a program designed to understand scale, this is great: we can have all the measurements in say attoparsecs or even something archaic... <njh> like feet <bryce> I made it into an OCX control for Windows MFC <njh> and the units database combined with the units 'solver' allows as to cleanly munge between them <njh> yep <bryce> but the backend is totally generic C++. I could dig it out and see if it'd be useful for this <bryce> the couple cool features of my code is that it computes compound units <njh> units is more sophisticated than most systems, it can do reasoning on combinations of units <bryce> e.g. 42 ft^2/sec into acres/fortnight <njh> You have: joules You want: Definition: joule = N m = 1 kg m^2 / s^2 <njh> You have: 42 ft^2/sec You want: acres/fortnight * 1166.2763 / 0.00085742973 <bryce> also, it supports sigfigs, precision, and engineering notation <njh> Ok, I don't know if units does that. <bryce> engineering notation is like scientific notation but in powers of 3 <njh> the advantage that units has is that the database is already there and maintained. the advantage of your code is a) you have already widgetified it (at least though about the concepts) b) it is librarified? <njh> probably the right thing to do is to take your code and munge it to read the units database <bryce> I librarified it for Visual C++ <bryce> it's just a handful of source files plus a data file for defining the units so pretty easy to make a library out of <njh> units is one file :) <njh> dig it up and I'll compare the two. <njh> do you think it's a good idea? <njh> just reading the units man page. it understands things like wire gauges, which would be useful for technical drawing. <bryce> yeah I think its a brilliant idea <bryce> ok digging... <njh> cute, units changes things like the size of a gallon based on LOCALE <bryce> ah nice. mine doesn't do that <bryce> njh - http://developer.osdl.org/bryce/value.tar.gz <bryce> the Unit.* is the immediate interest <bryce> the other classes implement some different kinds of numbers-with-units <bryce> I also have the OCX that implements a MFC widget using the Scalar class, but it's probably of little usefulness. But I can post that too if it's any use <bryce> if you think this would be worth using I'll put it into 'experimental' <bryce> tbere's some other files that go with it to define some lower level utility things, so it won't compile as is; I can post those too - they probably should be wrapped into it, or replaced.
(The above needs to be revised into prose)