Implementing new Alignment approach
This commit is contained in:
parent
4ab5bd57c9
commit
6f5ae0dd42
|
@ -114,6 +114,8 @@ private:
|
|||
void readNastran(const std::string &Filename);
|
||||
|
||||
private:
|
||||
/// positioning matrix
|
||||
Base::Matrix4D _Mtrx;
|
||||
SMESH_Gen *myGen;
|
||||
SMESH_Mesh *myMesh;
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#endif
|
||||
|
||||
#include "FemMeshObject.h"
|
||||
#include "FemMesh.h"
|
||||
#include <App/DocumentObjectPy.h>
|
||||
#include <Base/Placement.h>
|
||||
|
||||
|
@ -62,4 +63,10 @@ PyObject *FemMeshObject::getPyObject()
|
|||
void FemMeshObject::onChanged(const Property* prop)
|
||||
{
|
||||
App::GeoFeature::onChanged(prop);
|
||||
|
||||
// if the placement has changed apply the change to the mesh data as well
|
||||
if (prop == &this->Placement) {
|
||||
const_cast<Fem::FemMesh&>(this->FemMesh.getValue()).setTransform(this->Placement.getValue().toMatrix());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
<property name="text">
|
||||
<string>Auto minimize</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -44,8 +44,24 @@ class _CommandAlignment:
|
|||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("MachDist_Alignment","Part Alignment")}
|
||||
|
||||
def Activated(self):
|
||||
FemMeshObject = None
|
||||
import FemGui, Mesh
|
||||
# check if a active analysis is present and no Mesh in it
|
||||
if FemGui.getActiveAnalysis() != None:
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Fem::FemMeshObject"):
|
||||
FemMeshObject = i
|
||||
break
|
||||
else:
|
||||
return
|
||||
FreeCAD.ActiveDocument.openTransaction("Alignment")
|
||||
taskd = _AlignTaskPanel()
|
||||
|
||||
n = FemMeshObject.FemMesh.Nodes
|
||||
p = Mesh.calculateEigenTransform(n)
|
||||
p2 = p.inverse()
|
||||
FemMeshObject.Placement = p2
|
||||
|
||||
taskd = _AlignTaskPanel(FemMeshObject)
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
@ -58,19 +74,19 @@ class _CommandAlignment:
|
|||
|
||||
class _AlignTaskPanel:
|
||||
'''The editmode TaskPanel for Material objects'''
|
||||
def __init__(self):
|
||||
def __init__(self,object):
|
||||
# the panel has a tree widget that contains categories
|
||||
# for the subcomponents, such as additions, subtractions.
|
||||
# the categories are shown only if they are not empty.
|
||||
form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Machining_Distortion/Aligment.ui")
|
||||
|
||||
self.obj = None
|
||||
self.obj = object
|
||||
self.formUi = form_class()
|
||||
self.form = QtGui.QWidget()
|
||||
self.formUi.setupUi(self.form)
|
||||
|
||||
#Connect Signals and Slots
|
||||
#QtCore.QObject.connect(form.button_select_files, QtCore.SIGNAL("clicked()"), self.select_files)
|
||||
QtCore.QObject.connect(self.formUi.pushButton_FlipX, QtCore.SIGNAL("clicked()"), self.flipX)
|
||||
|
||||
self.update()
|
||||
|
||||
|
@ -87,6 +103,8 @@ class _AlignTaskPanel:
|
|||
|
||||
def reject(self):
|
||||
FreeCADGui.Control.closeDialog()
|
||||
|
||||
|
||||
def flipX(self):
|
||||
return
|
||||
|
||||
FreeCADGui.addCommand('MachDist_Alignment',_CommandAlignment())
|
||||
|
|
Loading…
Reference in New Issue
Block a user