Difference between revisions of "BlueprintRealUnit"
m (→Related discussions in the past: update links) |
|||
(17 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
This blueprint tries to collect all information about how to implement real world units (in, mm) in a standard compliant way. | This blueprint tries to collect all information about how to implement real world units (in, mm) in a standard compliant way. | ||
This blueprint is part of the [[CAD]] collections, please see it if you are interesting to an other CAD feature. | |||
== The problem == | == The problem == | ||
=== Inkscape side === | === Inaccuracy === | ||
==== Inkscape side ==== | |||
Even if the user switch everywhere the unit to mm, inkscape | Even if the user switch everywhere the unit to mm, inkscape | ||
converts it to px unit and writes it in the .svg file resulting inaccuracies. | |||
=== SVG side === | ==== SVG side ==== | ||
All the units in svg drawing needs to be in px unit. | All the units in svg drawing needs to be in px unit. | ||
Line 20: | Line 24: | ||
Examples: | Examples: | ||
This is invalid in SVG: | |||
This is '''invalid''' in SVG: | |||
<path d="M 0,0 L 30mm,0 L 30mm,30mm L 45mm,30mm" id="path7887" /> | <path d="M 0,0 L 30mm,0 L 30mm,30mm L 45mm,30mm" id="path7887" /> | ||
The correct solution would be to specify it in pixel and after tranform it. | The correct solution would be to specify it in pixel and after tranform it. | ||
=== Flipping the coordinate system === | |||
Inkscape use the SVG standard coordinate system, where the origin is at the | |||
top-left corner. For humans the svg file is more readable if the coordinate system were at the bottom-left corner. | |||
Would be nice, if it were an ability to specify the origin of the coordinate system (top-left vs. bottom-left). | |||
So all the svg object would be defined for human reading and the whole page is flipped using the transform attribute of the svg specification. | |||
== Document width and document height == | |||
In inkscape it is possible to specify the document width and height as described in the [http://www.w3.org/TR/SVG/struct.html#SVGElement section 5.1.2]. | |||
Although it can be written that the document width is 210mm and height is 297mm, it has '''no effect''' to the units in the svg document. | |||
It simply specify the page size around the drawing. (it is useful when exporting a page to pdf) | |||
A simple svg definition: | |||
<svg width="210mm" height="297mm" id="svg3248"> | |||
== Typical workflow == | |||
TODO | |||
== Use cases == | |||
1. Bob wants everything in mm | |||
2. Bob wants everything in mm except fonts which he wants in points. | |||
3. Bob wants mix units in mm and inch. But always want to see the original unit. | |||
4. Bob does not care about units he wants just draw something to the web | |||
5. 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.) | |||
== More resource on the web == | == More resource on the web == | ||
* [http://www.w3.org/TR/SVG/coords.html#TransformAttribute Transform] | * [http://www.w3.org/TR/SVG/coords.html#TransformAttribute Transform in the SVG specification] | ||
* [http://support.adobe.com/devsup/devsup.nsf/docs/50556.htm Possible solution to coordinate system by adobe] | * [http://support.adobe.com/devsup/devsup.nsf/docs/50556.htm Possible solution to coordinate system by adobe] | ||
Line 43: | Line 82: | ||
On the inkscape-dev mailing list: | On the inkscape-dev mailing list: | ||
[http:// | [http://old.nabble.com/Problem-with-real-units-%28mm%29-tt14966336.html#a14971033 Problem with real units (mm)] | ||
Although attaching parasite information to an svg element is not necessary, but maybe useful if additional information must be keeped about conversion inaccuracy. | Although attaching parasite information to an svg element is not necessary, but maybe useful if additional information must be keeped about conversion inaccuracy. | ||
Please see this thread for more information: [http:// | Please see this thread for more information: [http://old.nabble.com/Attaching-parasite-information-to-an-object-%28or-group%29-tt14892304.html#a14892304 Attaching parasite information to an object (or group)] | ||
[[Category:Proposals]] |
Latest revision as of 03:15, 19 August 2012
Summary
This blueprint tries to collect all information about how to implement real world units (in, mm) in a standard compliant way.
This blueprint is part of the CAD collections, please see it if you are interesting to an other CAD feature.
The problem
Inaccuracy
Inkscape side
Even if the user switch everywhere the unit to mm, inkscape converts it to px unit and writes it in the .svg file resulting inaccuracies.
SVG side
All the units in svg drawing needs to be in px unit. The grammar in the SVG specification does not allow other units then pixel: http://www.w3.org/TR/SVG/paths.html#PathDataBNF
More information about coordinate system: http://www.w3.org/TR/SVG/coords.html
Examples:
This is invalid in SVG:
<path d="M 0,0 L 30mm,0 L 30mm,30mm L 45mm,30mm" id="path7887" />
The correct solution would be to specify it in pixel and after tranform it.
Flipping the coordinate system
Inkscape use the SVG standard coordinate system, where the origin is at the top-left corner. For humans the svg file is more readable if the coordinate system were at the bottom-left corner.
Would be nice, if it were an ability to specify the origin of the coordinate system (top-left vs. bottom-left).
So all the svg object would be defined for human reading and the whole page is flipped using the transform attribute of the svg specification.
Document width and document height
In inkscape it is possible to specify the document width and height as described in the section 5.1.2. Although it can be written that the document width is 210mm and height is 297mm, it has no effect to the units in the svg document. It simply specify the page size around the drawing. (it is useful when exporting a page to pdf)
A simple svg definition:
<svg width="210mm" height="297mm" id="svg3248">
Typical workflow
TODO
Use cases
1. Bob wants everything in mm
2. Bob wants everything in mm except fonts which he wants in points.
3. Bob wants mix units in mm and inch. But always want to see the original unit.
4. Bob does not care about units he wants just draw something to the web
5. 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.)
More resource on the web
Related bug reports
#168753: SVG defaults to pixels (90dpi) despite default units Duplicates: #168516: Inkscape doesn't save page size units in plain svg #170738: preserve units
Viewbox related bug reports: #171203: Use viewBox to explicitly define a coordinate system
Related discussions in the past
On the inkscape-dev mailing list:
Although attaching parasite information to an svg element is not necessary, but maybe useful if additional information must be keeped about conversion inaccuracy. Please see this thread for more information: Attaching parasite information to an object (or group)