Commit 43655cc3 authored by Guillaume Seguin's avatar Guillaume Seguin

Draw objects centered on the offset position in plater

parent 76860fb6
......@@ -327,10 +327,9 @@ class StlPlater(Plater):
maxz = j[2]
model.dims = [minx, maxx, miny, maxy, minz, maxz]
self.add_model(name, model)
#if minx < 0:
# model.offsets[0] = -minx
#if miny < 0:
# model.offsets[1] = -miny
model.centeroffset = [(maxx - minx) / 2,
(maxy - miny) / 2,
0]
self.s.drawmodel(model, 2)
def export_to(self, name):
......
......@@ -354,12 +354,14 @@ class StlViewPanel(wxGLPanel):
glPushMatrix()
# Draw objects
for i in self.parent.models.values():
for i in self.parent.models:
model = self.parent.models[i]
glPushMatrix()
glTranslatef(*(i.offsets))
glRotatef(i.rot, 0.0, 0.0, 1.0)
glScalef(*i.scale)
i.batch.draw()
glTranslatef(*(model.offsets))
glTranslatef(*(model.centeroffset))
glRotatef(model.rot, 0.0, 0.0, 1.0)
glScalef(*model.scale)
model.batch.draw()
glPopMatrix()
glPopMatrix()
glPopMatrix()
......
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