Recently, I wanted to use Inkscape to draw a floor plan for a large house. For this, I needed to use a grid specified in feet and inches.
I found that in order to fit the whole drawing on the screen at once, I had to set the zoom factor to 3% or less, which was inconvenient. It seems that for some reason you cannot set a zoom factor of less than 1%, so if the building were even three times larger, there would be no way to view it all at once, if you used the correct units to draw it.
It seems that I'm not the only person having this problem:
http://inkscape-forum.andreas-s.net/topic/1209992
The suggested solution is to scale your drawing in "px" units, and then apply a mental scale factor to get the real dimensions. Of course you COULD do that, but why should you have to? Why can't Inkscape accommodate whatever units, dimensions, and scales are appropriate for the task at hand?
My first solution was as follows. The inch and foot units are defined in the Inkscape config file "/usr/share/inkscape/ui/units.txt", or possibly "/usr/share/inkscape/ui/units.xml". I'm not sure which of these files is supposed to be normative; why are there two of them?
# name plural abbr type factor PRI description
inch inches in LINEAR 90.0 N Inches (90 px/in) foot feet ft LINEAR 1080 N Feet (12 in/ft)
I added the following units, which are defined to be 1/360 of the usual ones:
x-inch x-inches xin LINEAR 0.25 N X-Inches (0.25 px/xin) x-foot x-feet xft LINEAR 3 N X-Feet (12 xin/xft)
Inkscape then recognizes these new units for the "Default units" and "Page Size" options, and for the "Transform" dialog. It DOES NOT recognize them for the object dimension boxes along the top of the canvas, and when the drawing's default unit is set to "xft", the rulers are graduated in "px" units.
I then tried adding the same definitions to the "units.xml" file:
<unit type="LINEAR" pri="n"> <name>x-inch</name> <plural>x-inches</plural> <abbr>xin</abbr> <factor>0.25</factor> <description>X-Inches (0.25 px/xin)</description> </unit> <unit type="LINEAR" pri="n"> <name>x-foot</name> <plural>x-feet</plural> <abbr>xft</abbr> <factor>3</factor> <description>X-Feet (12 xin/xft)</description> </unit>
This did not appear to have any further effect.
It seems rather silly that for some purposes, the unit definitions would be read at runtime from a config file, while for other purposes, they would be compiled into the program binary, but that appears to be how it currently works.
I suppose I could fix this so that all the unit definitions were read from a single config file at runtime, and then define corresponding metric x-units as 1/100 of the usual ones, but that would be kind of pointless. People who want to draw cells, or integrated circuits, or molecules, would have to define y-micrometres, y-nanometres, and y-angstroms, as a million times bigger than the standard units, because it turns out that the maximum zoom factor you can apply is 25600%, or 256. (It's pretty silly to have to write 256 as "25600%", but apparently you do have to.)
There is a much better solution, which is illustrated by the attached image "scale.png". This is intended as an addition to the current "Document Properties/Page" config window. It specifies the scale at which the drawing will be displayed on the physical screen, as a ratio between real dimensions on the screen, and the declared dimensions of the drawing.
This does not replace the current "Zoom" option in the "View" menu or the box in the lower right corner of the main window. It is simply multiplied together with that setting, so if the zoom factor is set to "1:1" or "100%", the specified display scale factor is what you get. The intention is that the display scale factor will be set once, to an appropriate value for the drawing, while the zoom factor will be changed frequently while working.
The display scale factor is specified as a ratio between two values, each of which consists of a decimal number and a unit chosen from a selection list. The available units are those read from the units.{txt,xml} file, with the addition of "width" and "height". These two units will refer to the physical screen dimensions, and the declared page size for the drawing. You can therefore specify that the normal display scale is such that the width of the drawing is the width of the screen (or half that, or twice that). This is likely to be useful, because often the X server does not have an accurate idea of the physical screen dimensions, but it always knows the size in pixels.
It seems that this feature should be fairly simple to implement, for someone familiar with the Inkscape code. It only requires four additional widgets for the Document Properties window, for this setting to be saved and read from the SVG file, and for the resulting value to be multiplied with the existing zoom factor wherever that appears.
Note the following related feature request, rated as "Priority: High":
https://blueprints.launchpad.net/inkscape/+spec/real-units
Bob wants to draw a house plan in feet and inches, but still print it on a letter-sized paper. (one idea: different layers can have different scales: e.g. border layer is actual size, house layer is 1 in. = 8 ft.)
I would point out that the SVG specification does not prescribe any particular ratio between "px" drawing units and actual physical lengths. (It certainly DOES NOT specify that 90 px = 1 inch, as Inkscape currently assumes [units.txt]; this ratio is only mentioned as "for example".)
http://www.w3.org/TR/SVG/coords.html#Units
I suggest that for Inkscape, "px" be considered to be equivalent to the specified "Default unit" from the Document Properties window. If the default unit is metres, or whatever, then that's what "px" means, for that document, but no other. I don't see how this is inconsistent with the SVG specification.
Another related proposal is here:
http://sourceforge.net/mailarchive/message.php?msg_id=29861176
I think that if we are going to break compatibility, we go for one release to do it. Basically, all of the new-style stuff including custom doc coords would be a huge win to introduce all at once. I would love to see a rotatable canvas in Inkscape, but I have no idea how feasible it is with the current rendering/viewport stuff we have in place.
In principle it should be possible to change doc2dt and dt2doc matrices to any transform without any modifications to the display subsystem, but it might expose bugs - mainly hidden assumptions that doc2dt is always an Y flip + translation.
If the canvas can be rotated by an arbitrary angle (or "any transform matrix" applied), then certainly another uniform scaling factor can be applied at the same time.
Finally, I must comment on how strange it is that "units.txt" contains the following definition:
# name plural abbr type factor PRI description
% % % DIMENSIONLESS 1.00 Y Percentage
It seems clear that since 100% = 100/100 = 1.0 , then 1% = 1/100 = 0.01 ; this is what the conversion factor should be.
Only slightly less strange is this:
degree degrees deg RADIAL 1.00 Y Degrees
The natural base unit for rotations (if not radians) is one whole rotation, the identity operation, analogous to multiplication by one.
These definitions necessarily imply that there must be inverse conversion factors of "100" and "360" hard-wired into the Inkscape code somewhere. But why should that be? The natural place for such conversion factors is this same "units.txt" definition file; that's what it's FOR.
In this regard, it would be helpful if whatever piece of code is responsible for reading these definitions were (trivially) extended to handle ratios; then a degree could be defined as "1/360", rather than "0.002777777".
Then, if someone wants to specify angles in milliradians, for some reason, they can define that as "1/6283.185", rather than "0.05729578", as is currently necessary.
http://en.wikipedia.org/wiki/Angle#Units
Similarly, if someone is working on some tiling problem and wants to scale things by multiples of 1/64, rather than 1/100, they can call that a "perfoo", and define it as "1/64", instead of "1.5625", as currently necessary.
Another thing that would be useful for this file is to have some notation for "the n-th root of x"; for example, "2\4" could mean "the fourth root of two", which might otherwise be written as "2^(1/4)".
Currently, the "+" and "-" keys zoom the display by a factor of 2^(1/2) (usually called "square root of two", 1.414214), while the up and down arrows next to the zoom factor box change it by almost, but not quite, 2^(1/10) ("tenth root of two", 1.071773). If there were some convenient notation for specifying geometric roots in the "units.txt" file, these zoom factors might be made configurable, and they could also be used in the "Transform" dialog for scaling objects.
-- Ian Bruce
participants (1)
-
unknown@example.com