Skip to content

Commit

Permalink
cross-section of meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 20, 2019
1 parent 019198a commit 7407fe9
Show file tree
Hide file tree
Showing 7 changed files with 979 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/Mod/Mesh/Gui/Command.cpp
Expand Up @@ -1051,6 +1051,31 @@ bool CmdMeshSectionByPlane::isActive(void)

//--------------------------------------------------------------------------------------

DEF_STD_CMD_A(CmdMeshCrossSections)

CmdMeshCrossSections::CmdMeshCrossSections()
: Command("Mesh_CrossSections")
{
sAppModule = "Mesh";
sGroup = QT_TR_NOOP("Mesh");
sMenuText = QT_TR_NOOP("Cross-sections...");
sToolTipText = QT_TR_NOOP("Cross-sections");
sStatusTip = QT_TR_NOOP("Cross-sections");
}

void CmdMeshCrossSections::activated(int)
{
doCommand(Doc,"import MeshPartGui, FreeCADGui\nFreeCADGui.runCommand('MeshPart_CrossSections')\n");
}

bool CmdMeshCrossSections::isActive(void)
{
return (Gui::Selection().countObjectsOfType(Mesh::Feature::getClassTypeId()) > 0 &&
!Gui::Control().activeDialog());
}

//--------------------------------------------------------------------------------------

DEF_STD_CMD_A(CmdMeshPolySplit)

CmdMeshPolySplit::CmdMeshPolySplit()
Expand Down Expand Up @@ -1769,6 +1794,7 @@ void CreateMeshCommands(void)
rcCmdMgr.addCommand(new CmdMeshPolyTrim());
rcCmdMgr.addCommand(new CmdMeshTrimByPlane());
rcCmdMgr.addCommand(new CmdMeshSectionByPlane());
rcCmdMgr.addCommand(new CmdMeshCrossSections());
rcCmdMgr.addCommand(new CmdMeshEvaluation());
rcCmdMgr.addCommand(new CmdMeshEvaluateFacet());
rcCmdMgr.addCommand(new CmdMeshEvaluateSolid());
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/Mesh/Gui/Workbench.cpp
Expand Up @@ -195,7 +195,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "Mesh_PolyTrim"
//<< "Mesh_PolySegm"
<< "Mesh_TrimByPlane"
<< "Mesh_SectionByPlane";
<< "Mesh_SectionByPlane"
<< "Mesh_CrossSections";

mesh->setCommand("&Meshes");
*mesh << "Mesh_Import"
Expand Down
5 changes: 5 additions & 0 deletions src/Mod/MeshPart/Gui/CMakeLists.txt
Expand Up @@ -35,6 +35,7 @@ set(MeshPartGui_LIBS
)

set(MeshPartGui_MOC_HDRS
CrossSections.h
CurveOnMesh.h
TaskCurveOnMesh.h
Tessellation.h
Expand All @@ -43,6 +44,7 @@ fc_wrap_cpp(MeshPartGui_MOC_SRCS ${MeshPartGui_MOC_HDRS})
SOURCE_GROUP("Moc" FILES ${MeshPartGui_MOC_SRCS})

set(MeshPartGui_UIC_SRCS
CrossSections.ui
TaskCurveOnMesh.ui
Tessellation.ui
)
Expand All @@ -60,6 +62,9 @@ SET(MeshPartGui_SRCS
${MeshPartGui_UIC_HDRS}
AppMeshPartGui.cpp
Command.cpp
CrossSections.ui
CrossSections.cpp
CrossSections.h
CurveOnMesh.cpp
CurveOnMesh.h
Resources/MeshPart.qrc
Expand Down
41 changes: 41 additions & 0 deletions src/Mod/MeshPart/Gui/Command.cpp
Expand Up @@ -42,6 +42,7 @@
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include "Tessellation.h"
#include "CrossSections.h"
#include "TaskCurveOnMesh.h"

using namespace std;
Expand Down Expand Up @@ -263,6 +264,45 @@ bool CmdMeshPartSection::isActive(void)
return true;
}

//===========================================================================
// MeshPart_CrossSections
//===========================================================================
DEF_STD_CMD_A(CmdMeshPartCrossSections)

CmdMeshPartCrossSections::CmdMeshPartCrossSections()
:Command("MeshPart_CrossSections")
{
sAppModule = "MeshPart";
sGroup = QT_TR_NOOP("MeshPart");
sMenuText = QT_TR_NOOP("Cross-sections...");
sToolTipText = QT_TR_NOOP("Cross-sections");
sWhatsThis = "MeshPart_CrossSections";
sStatusTip = sToolTipText;
//sPixmap = "MeshPart_CrossSections";
}

void CmdMeshPartCrossSections::activated(int iMsg)
{
Q_UNUSED(iMsg);
Gui::TaskView::TaskDialog* dlg = Gui::Control().activeDialog();
if (!dlg) {
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType
(Mesh::Feature::getClassTypeId());
Base::BoundBox3d bbox;
for (std::vector<App::DocumentObject*>::iterator it = obj.begin(); it != obj.end(); ++it) {
bbox.Add(static_cast<Mesh::Feature*>(*it)->Mesh.getBoundingBox());
}
dlg = new MeshPartGui::TaskCrossSections(bbox);
}
Gui::Control().showDialog(dlg);
}

bool CmdMeshPartCrossSections::isActive(void)
{
return (Gui::Selection().countObjectsOfType(Mesh::Feature::getClassTypeId()) > 0 &&
!Gui::Control().activeDialog());
}

DEF_STD_CMD_A(CmdMeshPartCurveOnMesh)

CmdMeshPartCurveOnMesh::CmdMeshPartCurveOnMesh()
Expand Down Expand Up @@ -307,5 +347,6 @@ void CreateMeshPartCommands(void)
rcCmdMgr.addCommand(new CmdMeshPartMesher());
rcCmdMgr.addCommand(new CmdMeshPartTrimByPlane());
rcCmdMgr.addCommand(new CmdMeshPartSection());
rcCmdMgr.addCommand(new CmdMeshPartCrossSections());
rcCmdMgr.addCommand(new CmdMeshPartCurveOnMesh());
}

0 comments on commit 7407fe9

Please sign in to comment.