高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】export to svg with odasvgexporter seems to generate funny co
export to svg with odasvgexporter seems to generate funny co
export to svg with odasvgexporter seems to generate funny coordinates
to write an svg file i do this (copied directly from example):
dwgdirectx.iodasvgexporter exp = new dwgdirectx.odasvgexporter();
exp.set_properties("lineweightscale", 1.0);
exp.set_properties("precision", 6);
exp.set_properties("imagebase", system.io.path.getdirectoryname( outputfilename));
exp.set_properties("imageurl", "");
exp.set_properties("defaultimageext", ".png");
exp.set_properties("genericfontfamily", "sans-serif");
exp.set_properties("usehlr", true);
exp.export(acdocument, outputfilename);
i do get an svg file and it looks good, but when examining it closer the svg viewport and the svg polyline coordinates are rather strange and do not match, at all, the coordinates i extract from the dwg's polylines.
the svg viewport becomes "0 0 1000 1000" and the coordinates are neither meters nor millimeters. it looks like everything is scaled down to fit within a predefined viewport, which makes it useless for any purpose other than illustrating that an svg file can be written.
is there a property i can set to make the export use the real coordinates and calculate a viewport that fits the drawing?
best regards
michael
what are "real" coordinates?
vladimir
real coordinates
that would be the ones defining the polylines.
if the dwg uses coordinates in millimeters and contains a polyline that goes from x,y -4000, 0 to 4000, 0 i would expect to find the number -4000 and 4000 in the svg-file, and i would expect the viewport to be something like "-4100, -4100, 4100, 4100", ie. a square that can contain all points of the drawing.
best regards
michael
your need is very specific. what do you expect e.g. of perspective viewport?
(after all, svg is a picture, just a vector picture)
anyway, you have the sources, and may tweak them as it suits you.
vladimir
|