Implement Isostatic Gui
This commit is contained in:
parent
2cad732138
commit
9155eed7d9
|
@ -442,7 +442,8 @@ static PyObject * getBoundary_Conditions(PyObject *self, PyObject *args)
|
|||
PyObject *input;
|
||||
Py::List boundary_nodes;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O",&input))
|
||||
if (!PyArg_ParseTuple(args, "O!", &(FemMeshPy::Type), &input))
|
||||
//if (!PyArg_ParseTuple(args, "O",&input))
|
||||
return NULL;
|
||||
|
||||
PY_TRY {
|
||||
|
|
|
@ -77,6 +77,8 @@ TaskCreateNodeSet::TaskCreateNodeSet(Fem::FemSetNodesObject *pcObject,QWidget *p
|
|||
QObject::connect(ui->toolButton_Pick,SIGNAL(clicked()),this,SLOT(Pick()));
|
||||
QObject::connect(ui->comboBox,SIGNAL(activated (int)),this,SLOT(SwitchMethod(int)));
|
||||
|
||||
// check if the Link to the FemMesh is defined
|
||||
assert(pcObject->FemMesh.getValue<Fem::FemMeshObject*>());
|
||||
MeshViewProvider = dynamic_cast<ViewProviderFemMesh*>(Gui::Application::Instance->getViewProvider( pcObject->FemMesh.getValue<Fem::FemMeshObject*>()));
|
||||
assert(MeshViewProvider);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace FemGui
|
|||
|
||||
class ViewProviderSetNodes : public Gui::ViewProviderGeometryObject
|
||||
{
|
||||
PROPERTY_HEADER(RobotGui::ViewProviderSetNodes);
|
||||
PROPERTY_HEADER(FemGui::ViewProviderSetNodes);
|
||||
|
||||
public:
|
||||
virtual bool doubleClicked(void);
|
||||
|
|
|
@ -25,6 +25,7 @@ SET(MachDist_SRCS
|
|||
Material.ui
|
||||
Aligment.ui
|
||||
JobControl.ui
|
||||
Isostatic.ui
|
||||
)
|
||||
SOURCE_GROUP("" FILES ${MachDist_SRCS})
|
||||
|
||||
|
|
39
src/Mod/Machining_Distortion/Isostatic.ui
Normal file
39
src/Mod/Machining_Distortion/Isostatic.ui
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Isostatic</class>
|
||||
<widget class="QWidget" name="Isostatic">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>228</width>
|
||||
<height>42</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_InfoNodes">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -20,13 +20,14 @@
|
|||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
import FreeCAD, Fem
|
||||
import FreeCAD, Fem, Mesh
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
import FreeCADGui,FemGui
|
||||
from FreeCAD import Vector
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from pivy import coin
|
||||
import PyQt4.uic as uic
|
||||
|
||||
__title__="Machine-Distortion Isostatic managment"
|
||||
__author__ = "Juergen Riegel"
|
||||
|
@ -43,12 +44,56 @@ class _CommandIsostatic:
|
|||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("MachDist_Isostatic","Add or edit a Machine-Distortion Isostatic")}
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Isostatic")
|
||||
FreeCADGui.doCommand("import MachDist")
|
||||
FreeCADGui.doCommand("axe = MachDist.makeIsostatic()")
|
||||
FreeCADGui.doCommand("MachDist.makeStructuralSystem(" + MachDistCommands.getStringList(st) + ",[axe])")
|
||||
FreeCADGui.doCommand("MachDist.makeIsostatic()")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
FreeCAD.ActiveDocument.openTransaction("Isostatic")
|
||||
|
||||
obj = None
|
||||
FemMesh = None
|
||||
if FemGui.getActiveAnalysis():
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Fem::FemSetNodesObject"):
|
||||
obj = i
|
||||
break
|
||||
else:
|
||||
return
|
||||
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Fem::FemMeshObject"):
|
||||
FemMeshObj = i
|
||||
|
||||
if not obj:
|
||||
FreeCADGui.doCommand("App.activeDocument().addObject('Fem::FemSetNodesObject','IsostaticNodes')")
|
||||
FreeCADGui.doCommand("App.activeDocument().ActiveObject.FemMesh = App.activeDocument()."+FemMeshObj.Name)
|
||||
obj = FreeCAD.activeDocument().ActiveObject
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument().ActiveObject]")
|
||||
|
||||
node_numbers = Fem.getBoundary_Conditions(FemMeshObj.FemMesh)
|
||||
nodes = FemMeshObj.FemMesh.Nodes
|
||||
meshObj = None
|
||||
|
||||
for i in FemGui.getActiveAnalysis().Member:
|
||||
if i.isDerivedFrom("Mesh::Feature"):
|
||||
meshObj = i
|
||||
break
|
||||
|
||||
if not meshObj:
|
||||
FreeCADGui.doCommand("App.activeDocument().addObject('Mesh::Feature','IsostaticPlane')")
|
||||
meshObj = FreeCAD.activeDocument().ActiveObject
|
||||
meshObj.ViewObject.ShapeColor = (0.0, 1.0, 0.0, 0.0)
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [App.activeDocument().ActiveObject]")
|
||||
|
||||
planarMesh = [
|
||||
# triangle 1
|
||||
nodes[node_numbers[0]],nodes[node_numbers[1]],nodes[node_numbers[2]],
|
||||
#triangle 2
|
||||
#[-0.5000,-0.5000,0.0000],[0.5000,-0.5000,0.0000],[0.5000,0.5000,0.0000],
|
||||
]
|
||||
aMesh = Mesh.Mesh(planarMesh)
|
||||
meshObj.Mesh = aMesh
|
||||
|
||||
taskd = _IsostaticTaskPanel(obj,meshObj,FemMeshObj)
|
||||
|
||||
FreeCADGui.Control.showDialog(taskd)
|
||||
|
||||
def IsActive(self):
|
||||
if FemGui.getActiveAnalysis():
|
||||
|
@ -59,4 +104,51 @@ class _CommandIsostatic:
|
|||
return False
|
||||
|
||||
|
||||
|
||||
class _IsostaticTaskPanel:
|
||||
'''The editmode TaskPanel for Material objects'''
|
||||
def __init__(self,obj,meshObj,femMeshObj):
|
||||
# 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/Isostatic.ui")
|
||||
|
||||
self.obj = obj
|
||||
self.meshObj = meshObj
|
||||
self.femMeshObj = femMeshObj
|
||||
self.formUi = form_class()
|
||||
self.form = QtGui.QWidget()
|
||||
self.formUi.setupUi(self.form)
|
||||
self.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Machining_Distortion")
|
||||
|
||||
|
||||
#QtCore.QObject.connect(self.formUi.select_L_file, QtCore.SIGNAL("clicked()"), self.add_L_data)
|
||||
self.femMeshObj.ViewObject.Transparency = 50
|
||||
self.meshObj.ViewObject.Visibility=True
|
||||
|
||||
self.update()
|
||||
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok) | int(QtGui.QDialogButtonBox.Cancel)
|
||||
|
||||
def update(self):
|
||||
'fills the widgets'
|
||||
return
|
||||
|
||||
def accept(self):
|
||||
self.femMeshObj.ViewObject.Transparency = 0
|
||||
self.meshObj.ViewObject.Visibility=False
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCADGui.Control.closeDialog()
|
||||
|
||||
|
||||
def reject(self):
|
||||
self.femMeshObj.ViewObject.Transparency = 0
|
||||
self.meshObj.ViewObject.Visibility=False
|
||||
FreeCAD.ActiveDocument.abortTransaction()
|
||||
FreeCADGui.Control.closeDialog()
|
||||
|
||||
|
||||
|
||||
FreeCADGui.addCommand('MachDist_Isostatic',_CommandIsostatic())
|
||||
|
|
Loading…
Reference in New Issue
Block a user