[openscad] mirror mesh feature -- separate gui from function

This commit is contained in:
mwganson
2020-07-19 16:59:14 -05:00
committed by Yorik van Havre
parent 92b14ba161
commit 2c0b49ea46
2 changed files with 20 additions and 15 deletions

View File

@@ -298,18 +298,15 @@ def vec2householder(nv):
nv.z*nv.x*l,nv.z*nv.y*l,nv.z*nv.z*l,0,0,0,0,0)
return FreeCAD.Matrix()-hh
def mirror(msh):
def mirror(msh,vec):
from exportCSG import mesh2polyhedron
from PySide import QtGui
items=["[1,0,0]","[0,1,0]","[0,0,1]","[1,1,0]","[0,1,1]","[1,0,1]","[1,1,1]"]
item, ok = QtGui.QInputDialog.getItem(QtGui.QApplication.activeWindow(),u'Mirror about which Axis?',u'Select Axis (or enter custom value)?',items,editable=True)
if ok:
param = 'mirror('+item+')'
poly = mesh2polyhedron(msh)
mi = callopenscadmeshstring('%s{%s}' % (param,''.join(poly)))
mi.flipNormals()
return mi
return None
poly = mesh2polyhedron(msh)
vec_string = '['+str(vec.x)+','+str(vec.y)+','+str(vec.z)+']'
param = 'mirror('+vec_string+')'
mi = callopenscadmeshstring('%s{%s}' % (param,''.join(poly)))
mi.flipNormals()
return mi
def angneg(d):