some tuning in Alignment & copy constructor for FemMeshPy
This commit is contained in:
parent
f3aebef651
commit
211764b5da
|
@ -63,9 +63,38 @@ PyObject *FemMeshPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Py
|
|||
// constructor method
|
||||
int FemMeshPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
{
|
||||
PyObject *pcObj=0;
|
||||
if (!PyArg_ParseTuple(args, "|O", &pcObj)) // convert args: Python->C
|
||||
return -1; // NULL triggers exception
|
||||
|
||||
try {
|
||||
// if no mesh is given
|
||||
if (!pcObj) return 0;
|
||||
if (PyObject_TypeCheck(pcObj, &(FemMeshPy::Type))) {
|
||||
getFemMeshPtr()->operator= (*static_cast<FemMeshPy*>(pcObj)->getFemMeshPtr());
|
||||
}
|
||||
else {
|
||||
PyErr_Format(PyExc_TypeError, "Cannot create a FemMesh out of a '%s'",
|
||||
pcObj->ob_type->tp_name);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception &e) {
|
||||
PyErr_SetString(PyExc_Exception,e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
PyErr_SetString(PyExc_Exception,e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (const Py::Exception&) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ===== Methods ============================================================
|
||||
|
||||
PyObject* FemMeshPy::setShape(PyObject *args)
|
||||
|
|
|
@ -167,7 +167,7 @@ class MachiningDistortionWorkbench ( Workbench ):
|
|||
self.appendToolbar("MachiningDistortionTools2",CmdList2)
|
||||
self.appendMenu("Machining Distortion2",CmdList2)
|
||||
|
||||
self.setWatchers()
|
||||
#self.setWatchers()
|
||||
|
||||
Gui.addPreferencePage(":/ui/userprefs-base.ui","Machining Distortion")
|
||||
|
||||
|
@ -175,10 +175,11 @@ class MachiningDistortionWorkbench ( Workbench ):
|
|||
def Activated(self):
|
||||
self.setWatchers()
|
||||
FreeCADGui.Control.showTaskView()
|
||||
Msg("MachiningDistortionWorkbench::Activated()\n")
|
||||
Msg("PartDistortionWorkbench::Activated()\n")
|
||||
|
||||
def Deactivated(self):
|
||||
Msg("MachiningDistortionWorkbench::Deactivated()\n")
|
||||
FreeCADGui.Control.clearTaskWatcher()
|
||||
Msg("PartDistortionWorkbench::Deactivated()\n")
|
||||
|
||||
|
||||
Gui.addWorkbench(MachiningDistortionWorkbench)
|
||||
|
|
|
@ -58,11 +58,16 @@ class _CommandAlignment:
|
|||
|
||||
# switch on Bound Box
|
||||
FemMeshObject.ViewObject.BoundingBox = True
|
||||
|
||||
QtGui.qApp.setOverrideCursor(QtCore.Qt.WaitCursor)
|
||||
n = FemMeshObject.FemMesh.Nodes
|
||||
p = Mesh.calculateEigenTransform(n)
|
||||
p2 = p.inverse()
|
||||
FemMeshObject.Placement = p2
|
||||
#FemMeshObject.Placement = p
|
||||
m = Fem.FemMesh(FemMeshObject.FemMesh)
|
||||
m.setTransform(p)
|
||||
FemMeshObject.FemMesh = m
|
||||
FemMeshObject.Placement = FreeCAD.Placement()
|
||||
|
||||
QtGui.qApp.restoreOverrideCursor()
|
||||
|
||||
taskd = _AlignTaskPanel(FemMeshObject)
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
|
|
Loading…
Reference in New Issue
Block a user