Merge pull request #14773 from wwmayer/fix_fem
FEM: Fix linking errors & clean-up code
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* additional statement(s) for element sets *
|
||||
* *
|
||||
* added to: AppFem.cpp *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: FemSetNodesObject.cpp *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
@@ -35,7 +33,6 @@ using namespace App;
|
||||
|
||||
PROPERTY_SOURCE(Fem::FemSetElementNodesObject, Fem::FemSetObject)
|
||||
|
||||
|
||||
FemSetElementNodesObject::FemSetElementNodesObject()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Elements,
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: FemSetNodesObject.h *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
@@ -56,8 +53,10 @@ public:
|
||||
}
|
||||
short mustExecute() const override;
|
||||
PyObject* getPyObject() override;
|
||||
static std::string elementsName; // = "ElementsSet";
|
||||
static std::string uniqueElementsName; // "ElementsSet" latest name
|
||||
static std::string getElementName()
|
||||
{
|
||||
return "ElementsSet";
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Fem
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* additional statement(s) for element sets *
|
||||
* *
|
||||
* added to: AppFemGui.cpp *
|
||||
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Peter McB *
|
||||
* added erase elements function *
|
||||
* *
|
||||
* added to: Command.cpp *
|
||||
* *
|
||||
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
@@ -73,7 +69,7 @@ using namespace std;
|
||||
//================================================================================================
|
||||
//================================================================================================
|
||||
// helpers
|
||||
bool getConstraintPrerequisits(Fem::FemAnalysis** Analysis)
|
||||
static bool getConstraintPrerequisits(Fem::FemAnalysis** Analysis)
|
||||
{
|
||||
if (!FemGui::ActiveAnalysisObserver::instance()->hasActiveObject()) {
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
@@ -89,7 +85,7 @@ bool getConstraintPrerequisits(Fem::FemAnalysis** Analysis)
|
||||
}
|
||||
|
||||
// OvG: Visibility automation show parts and hide meshes on activation of a constraint
|
||||
std::string gethideMeshShowPartStr(std::string showConstr = "")
|
||||
static std::string gethideMeshShowPartStr(std::string showConstr = "")
|
||||
{
|
||||
return "for amesh in App.activeDocument().Objects:\n\
|
||||
if \""
|
||||
@@ -103,6 +99,63 @@ std::string gethideMeshShowPartStr(std::string showConstr = "")
|
||||
amesh.ViewObject.Visibility = False\n";
|
||||
}
|
||||
|
||||
static std::string getSelectedNodes(Gui::View3DInventorViewer* view)
|
||||
{
|
||||
Gui::SelectionRole role;
|
||||
std::vector<SbVec2f> clPoly = view->getGLPolygon(&role);
|
||||
if (clPoly.size() < 3) {
|
||||
return {};
|
||||
}
|
||||
if (clPoly.front() != clPoly.back()) {
|
||||
clPoly.push_back(clPoly.front());
|
||||
}
|
||||
|
||||
SoCamera* cam = view->getSoRenderManager()->getCamera();
|
||||
SbViewVolume vv = cam->getViewVolume();
|
||||
Gui::ViewVolumeProjection proj(vv);
|
||||
Base::Polygon2d polygon;
|
||||
for (auto it : clPoly) {
|
||||
polygon.Add(Base::Vector2d(it[0], it[1]));
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> docObj =
|
||||
Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId());
|
||||
if (docObj.size() != 1) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const SMESHDS_Mesh* data =
|
||||
static_cast<Fem::FemMeshObject*>(docObj[0])->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
|
||||
Base::Vector3f pt2d;
|
||||
std::set<int> IntSet;
|
||||
|
||||
while (aNodeIter->more()) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
Base::Vector3f vec(aNode->X(), aNode->Y(), aNode->Z());
|
||||
pt2d = proj(vec);
|
||||
if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) {
|
||||
IntSet.insert(aNode->GetID());
|
||||
}
|
||||
}
|
||||
|
||||
std::stringstream set;
|
||||
|
||||
set << "[";
|
||||
for (auto it = IntSet.cbegin(); it != IntSet.cend(); ++it) {
|
||||
if (it == IntSet.begin()) {
|
||||
set << *it;
|
||||
}
|
||||
else {
|
||||
set << "," << *it;
|
||||
}
|
||||
}
|
||||
set << "]";
|
||||
|
||||
return set.str();
|
||||
}
|
||||
|
||||
|
||||
//================================================================================================
|
||||
//================================================================================================
|
||||
@@ -1035,7 +1088,7 @@ bool CmdFemConstraintTransform::isActive()
|
||||
//================================================================================================
|
||||
DEF_STD_CMD_A(CmdFemDefineNodesSet)
|
||||
|
||||
void DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
static void DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
{
|
||||
Fem::FemAnalysis* Analysis;
|
||||
|
||||
@@ -1052,88 +1105,20 @@ void DefineNodesCallback(void* ud, SoEventCallback* n)
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineNodesCallback, ud);
|
||||
n->setHandled();
|
||||
|
||||
Gui::SelectionRole role;
|
||||
std::vector<SbVec2f> clPoly = view->getGLPolygon(&role);
|
||||
if (clPoly.size() < 3) {
|
||||
return;
|
||||
std::string str = getSelectedNodes(view);
|
||||
if (!str.empty()) {
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Place robot"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.addObject('Fem::FemSetNodesObject','NodeSet')");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.ActiveObject.Nodes = %s",
|
||||
str.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.activeDocument().%s.addObject(App.activeDocument().NodeSet)",
|
||||
Analysis->getNameInDocument());
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
if (clPoly.front() != clPoly.back()) {
|
||||
clPoly.push_back(clPoly.front());
|
||||
}
|
||||
|
||||
SoCamera* cam = view->getSoRenderManager()->getCamera();
|
||||
SbViewVolume vv = cam->getViewVolume();
|
||||
Gui::ViewVolumeProjection proj(vv);
|
||||
Base::Polygon2d polygon;
|
||||
for (auto it : clPoly) {
|
||||
polygon.Add(Base::Vector2d(it[0], it[1]));
|
||||
}
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> docObj =
|
||||
Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId());
|
||||
if (docObj.size() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const SMESHDS_Mesh* data =
|
||||
static_cast<Fem::FemMeshObject*>(docObj[0])->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
|
||||
Base::Vector3f pt2d;
|
||||
std::set<int> IntSet;
|
||||
|
||||
while (aNodeIter->more()) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
Base::Vector3f vec(aNode->X(), aNode->Y(), aNode->Z());
|
||||
pt2d = proj(vec);
|
||||
if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) {
|
||||
IntSet.insert(aNode->GetID());
|
||||
}
|
||||
}
|
||||
|
||||
std::stringstream set;
|
||||
|
||||
set << "[";
|
||||
for (std::set<int>::const_iterator it = IntSet.begin(); it != IntSet.end(); ++it) {
|
||||
if (it == IntSet.begin()) {
|
||||
set << *it;
|
||||
}
|
||||
else {
|
||||
set << "," << *it;
|
||||
}
|
||||
}
|
||||
set << "]";
|
||||
|
||||
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Place robot"));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.addObject('Fem::FemSetNodesObject','NodeSet')");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.ActiveObject.Nodes = %s",
|
||||
set.str().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.activeDocument().%s.addObject(App.activeDocument().NodeSet)",
|
||||
Analysis->getNameInDocument());
|
||||
// Gui::Command::updateActive();
|
||||
Gui::Command::commitCommand();
|
||||
|
||||
// std::vector<Gui::ViewProvider*> views =
|
||||
// view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId()); if (!views.empty()) {
|
||||
// Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command",
|
||||
// "Cut")); for (std::vector<Gui::ViewProvider*>::iterator it = views.begin(); it !=
|
||||
// views.end(); ++it) {
|
||||
// ViewProviderMesh* that = static_cast<ViewProviderMesh*>(*it);
|
||||
// if (that->getEditingMode() > -1) {
|
||||
// that->finishEditing();
|
||||
// that->cutMesh(clPoly, *view, clip_inner);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
|
||||
// view->render();
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -1251,13 +1236,10 @@ bool CmdFemCreateNodesSet::isActive()
|
||||
//===========================================================================
|
||||
// start of Erase Elements code
|
||||
//===========================================================================
|
||||
std::string Fem::FemSetElementNodesObject::elementsName;
|
||||
std::string Fem::FemSetElementNodesObject::uniqueElementsName;
|
||||
|
||||
|
||||
DEF_STD_CMD_A(CmdFemDefineElementsSet);
|
||||
|
||||
void DefineElementsCallback(void* ud, SoEventCallback* n)
|
||||
static void DefineElementsCallback(void* ud, SoEventCallback* n)
|
||||
{
|
||||
Fem::FemAnalysis* Analysis;
|
||||
|
||||
@@ -1274,70 +1256,22 @@ void DefineElementsCallback(void* ud, SoEventCallback* n)
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), DefineElementsCallback, ud);
|
||||
n->setHandled();
|
||||
|
||||
Gui::SelectionRole role;
|
||||
std::vector<SbVec2f> clPoly = view->getGLPolygon(&role);
|
||||
if (clPoly.size() < 3) {
|
||||
return;
|
||||
std::string str = getSelectedNodes(view);
|
||||
if (!str.empty()) {
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Place robot"));
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"App.ActiveDocument.addObject('Fem::FemSetElementNodesObject','ElementSet')");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.ActiveObject.Nodes = %s",
|
||||
str.c_str());
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"App.activeDocument().%s.addObject(App.activeDocument().ElementSet)",
|
||||
Analysis->getNameInDocument());
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
if (clPoly.front() != clPoly.back()) {
|
||||
clPoly.push_back(clPoly.front());
|
||||
}
|
||||
|
||||
SoCamera* cam = view->getSoRenderManager()->getCamera();
|
||||
SbViewVolume vv = cam->getViewVolume();
|
||||
Gui::ViewVolumeProjection proj(vv);
|
||||
Base::Polygon2d polygon;
|
||||
for (std::vector<SbVec2f>::const_iterator it = clPoly.begin(); it != clPoly.end(); ++it) {
|
||||
polygon.Add(Base::Vector2d((*it)[0], (*it)[1]));
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> docObj =
|
||||
Gui::Selection().getObjectsOfType(Fem::FemMeshObject::getClassTypeId());
|
||||
if (docObj.size() != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const SMESHDS_Mesh* data =
|
||||
static_cast<Fem::FemMeshObject*>(docObj[0])->FemMesh.getValue().getSMesh()->GetMeshDS();
|
||||
|
||||
SMDS_NodeIteratorPtr aNodeIter = data->nodesIterator();
|
||||
Base::Vector3f pt2d;
|
||||
std::set<int> IntSet;
|
||||
|
||||
while (aNodeIter->more()) {
|
||||
const SMDS_MeshNode* aNode = aNodeIter->next();
|
||||
Base::Vector3f vec(aNode->X(), aNode->Y(), aNode->Z());
|
||||
pt2d = proj(vec);
|
||||
if (polygon.Contains(Base::Vector2d(pt2d.x, pt2d.y))) {
|
||||
IntSet.insert(aNode->GetID());
|
||||
}
|
||||
}
|
||||
|
||||
std::stringstream set;
|
||||
|
||||
set << "[";
|
||||
for (std::set<int>::const_iterator it = IntSet.begin(); it != IntSet.end(); ++it) {
|
||||
if (it == IntSet.begin()) {
|
||||
set << *it;
|
||||
}
|
||||
else {
|
||||
set << "," << *it;
|
||||
}
|
||||
}
|
||||
set << "]";
|
||||
|
||||
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Place robot"));
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,
|
||||
"App.ActiveDocument.addObject('Fem::FemSetElementNodesObject','ElementSet')");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.ActiveObject.Nodes = %s",
|
||||
set.str().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.activeDocument().%s.addObject(App.activeDocument().ElementSet)",
|
||||
Analysis->getNameInDocument());
|
||||
|
||||
Gui::Command::commitCommand();
|
||||
}
|
||||
|
||||
CmdFemDefineElementsSet::CmdFemDefineElementsSet()
|
||||
@@ -1423,22 +1357,18 @@ void CmdFemCreateElementsSet::activated(int)
|
||||
Fem::FemMeshObject* MeshObj =
|
||||
static_cast<Fem::FemMeshObject*>(FemMeshFilter.Result[0][0].getObject());
|
||||
|
||||
Fem::FemSetElementNodesObject::elementsName = "ElementsSet";
|
||||
Fem::FemSetElementNodesObject::uniqueElementsName =
|
||||
Command::getUniqueObjectName(Fem::FemSetElementNodesObject::elementsName.c_str());
|
||||
|
||||
std::string elementsName = Fem::FemSetElementNodesObject::getElementName();
|
||||
std::string uniqueElementsName = Command::getUniqueObjectName(elementsName.c_str());
|
||||
|
||||
openCommand(QT_TRANSLATE_NOOP("Command", "Create Elements set"));
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().addObject('Fem::FemSetElementNodesObject','%s')",
|
||||
Fem::FemSetElementNodesObject::uniqueElementsName.c_str());
|
||||
uniqueElementsName.c_str());
|
||||
doCommand(Gui,
|
||||
"App.activeDocument().%s.FemMesh = App.activeDocument().%s",
|
||||
Fem::FemSetElementNodesObject::uniqueElementsName.c_str(),
|
||||
uniqueElementsName.c_str(),
|
||||
MeshObj->getNameInDocument());
|
||||
doCommand(Gui,
|
||||
"Gui.activeDocument().setEdit('%s')",
|
||||
Fem::FemSetElementNodesObject::uniqueElementsName.c_str());
|
||||
doCommand(Gui, "Gui.activeDocument().setEdit('%s')", uniqueElementsName.c_str());
|
||||
}
|
||||
else {
|
||||
QMessageBox::warning(
|
||||
|
||||
@@ -1,26 +1,22 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* implementation of the erase elements function *
|
||||
* *
|
||||
* loosely based on: TaskCreateNodeSet.cpp *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
@@ -545,7 +541,8 @@ void TaskCreateElementSet::Restore(void)
|
||||
objectN.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
|
||||
}
|
||||
else if (objectN.find(Fem::FemSetElementNodesObject::elementsName) != std::string::npos) {
|
||||
else if (objectN.find(Fem::FemSetElementNodesObject::getElementName())
|
||||
!= std::string::npos) {
|
||||
if (elList > 0) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.removeObject(\'%s\')",
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: TaskCreateNodeSet.h *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef GUI_TASKVIEW_TaskCreateElementSet_H
|
||||
#define GUI_TASKVIEW_TaskCreateElementSet_H
|
||||
#ifndef FemGui_TaskCreateElementSet_H
|
||||
#define FemGui_TaskCreateElementSet_H
|
||||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Mod/Fem/App/FemSetElementNodesObject.h>
|
||||
@@ -93,4 +90,4 @@ private:
|
||||
|
||||
} // namespace FemGui
|
||||
|
||||
#endif // GUI_TASKVIEW_TaskCreateElementSet_H
|
||||
#endif // FemGui_TaskCreateElementSet_H
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: TaskDlgCreateNodeSet.cpp *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Exception.h>
|
||||
#include <Gui/Application.h>
|
||||
@@ -72,9 +69,6 @@ bool TaskDlgCreateElementSet::accept()
|
||||
try {
|
||||
FemSetElementNodesObject->Elements.setValues(param->elementTempSet);
|
||||
FemSetElementNodesObject->recomputeFeature();
|
||||
// Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
// if(doc)
|
||||
// doc->resetEdit();
|
||||
param->MeshViewProvider->resetHighlightNodes();
|
||||
FemSetElementNodesObject->Label.setValue(name->name);
|
||||
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
|
||||
|
||||
@@ -1,31 +1,29 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: FemSetNodesObject.h *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef ROBOTGUI_TaskDlgCreateElementSet_H
|
||||
#define ROBOTGUI_TaskDlgCreateElementSet_H
|
||||
#ifndef FemGui_TaskDlgCreateElementSet_H
|
||||
#define FemGui_TaskDlgCreateElementSet_H
|
||||
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Mod/Fem/App/FemSetElementNodesObject.h>
|
||||
@@ -83,4 +81,4 @@ protected:
|
||||
|
||||
} // namespace FemGui
|
||||
|
||||
#endif // ROBOTGUI_TASKDLGSIMULATE_H
|
||||
#endif // FemGui_TaskDlgCreateElementSet_H
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: ViewProviderSetNodes.cpp *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
@@ -47,9 +45,7 @@ bool ViewProviderSetElementNodes::doubleClicked()
|
||||
|
||||
bool ViewProviderSetElementNodes::setEdit(int)
|
||||
{
|
||||
Gui::TaskView::TaskDialog* dlg =
|
||||
new TaskDlgCreateElementSet(static_cast<Fem::FemSetElementNodesObject*>(getObject()));
|
||||
Gui::Control().showDialog(dlg);
|
||||
doubleClicked();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* *
|
||||
* based on: ViewProviderSetNodes.h *
|
||||
* Copyright (c) 2013 Jürgen Riegel (FreeCAD@juergen-riegel.net) *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* This file is part of FreeCAD. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* FreeCAD is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 2.1 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* FreeCAD is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with FreeCAD. If not, see *
|
||||
* <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2023 Peter McB *
|
||||
* additional statement(s) for element sets: *
|
||||
* added entry to Gui::MenuItem* mesh *
|
||||
* *
|
||||
* added to: Workbench.cpp
|
||||
* Copyright (c) 2008 Werner Mayer <werner.wm.mayer@gmx.de> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
|
||||
Reference in New Issue
Block a user