Commit eb17dd55 authored by sumpfralle's avatar sumpfralle

fixed the STL export issue regarding "unit" (see r983)

fixed the order or vertices in STL output to avoid "vertex rotation" (caused no harm but resulted in different ascii output)


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@990 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0e42d380
......@@ -28,8 +28,7 @@ import os
class STLExporter:
def __init__(self, model, name="model", created_by="pycam", linesep=None,
comment=None):
# sadly STL does not seem to support comments
**kwargs):
self.model = model
self.name = name
self.created_by = created_by
......@@ -56,7 +55,7 @@ class STLExporter:
yield " outer loop"
# Triangle vertices are stored in clockwise order - thus we need
# to reverse the order (STL expects counter-clockwise orientation).
for point in (triangle.p3, triangle.p2, triangle.p1):
for point in (triangle.p1, triangle.p3, triangle.p2):
yield " vertex %f %f %f" % (point.x, point.y, point.z)
yield " endloop"
yield "endfacet"
......
......@@ -108,7 +108,7 @@ class SVGExporter:
#TODO: we need to create a unified "Exporter" interface and base class
class SVGExporterContourModel(object):
def __init__(self, model, comment=None, unit="mm"):
def __init__(self, model, unit="mm", **kwargs):
self.model = model
self.unit = unit
......
......@@ -2530,11 +2530,14 @@ class ProjectGui:
return
try:
file_in = open(filename, "w")
model.export(comment=self.get_meta_data()).write(file_in)
model.export(comment=self.get_meta_data(),
unit=self.settings.get("unit")).write(file_in)
file_in.close()
except IOError, err_msg:
log.error("Failed to save model file: %s" % err_msg)
else:
log.info("Successfully stored the current model as '%s'." % \
str(filename))
self.add_to_recent_file_list(filename)
@gui_activity_guard
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment