Hello,
Thank you for the information. We used DXF files for testing, the entities coordinates are imported correctly from this file format. As for the SVG format, a
FPointXMat function used in the SimpleImport demo project transforms and reflects SVG coordinates in the x-axis (Y coordinate values change a sign from the + to a - sign).
Let's say, you draw a line in Inkscape and save it to an .svg file. In the saved .svg file this line will be defined as follows:
Code: Select all
<path
d="M 720.94214,22.944193 614.33009,94.601473"
id="path2989"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
Note: Inkscape actually is not reporting the SVG coordinates, but flipping the y-axis instead: the Y coordinate value is increasing as the mouse cursor goes upwards.
The
<path/> element is imported as
ceLWPolyline entity, so you should use an ImportPolyLine procedure in the demo project to obtain point coordinates. Let's take a look at the code which calculates coordinates of LWPolyline vertices:
Code: Select all
P := FPointXMat(Vertex.Point, FCADParams.Matrix);
If you step over this line with debugger, Vertex.Point will contain the following coordinates:
(720,94213867, 22,944192886, 0)
(614,33007812, 94,601470947, 0)
But FCADParams.Matrix.M will be ((1,811689539, 0, 0), (0, -1,811689539, 0), (0, 0, 1,811689539), (0, 0, 0)) that means the image scaling and reflection in relation to the x-axis. The reflection is applied to compensate a difference in the y-axis direction of SVG and DWG/DXF formats. In SVG files the initial coordinate system has the origin at the top/left with the x-axis pointing to the right and the y-axis pointing down, while in AutoCAD files the y-axis is upward. So, if you try to use the SVG coordinates to generate an AutoCAD DWG/DXF file, the output drawing will be flipped when viewing in AutoCAD. To get the nontransformed SVG coordinates, you should omit usage of the FPointXMat function.
Mikhail