+ add points view feature and command to triangulate it
This commit is contained in:
@@ -345,8 +345,8 @@ Mesh.show(m)
|
||||
int width;
|
||||
int height;
|
||||
|
||||
static char* kwds_greedy[] = {"Points", "Width", "Height", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!|ii", kwds_greedy,
|
||||
static char* kwds_view[] = {"Points", "Width", "Height", NULL};
|
||||
if (!PyArg_ParseTupleAndKeywords(args.ptr(), kwds.ptr(), "O!|ii", kwds_view,
|
||||
&(Points::PointsPy::Type), &pts,
|
||||
&width, &height))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/Points/App/PointsFeature.h>
|
||||
#include <Mod/Points/App/ViewFeature.h>
|
||||
#include <Mod/Mesh/App/MeshFeature.h>
|
||||
#include <Mod/Mesh/App/Core/Approximation.h>
|
||||
|
||||
@@ -214,10 +214,63 @@ bool CmdPoissonReconstruction::isActive(void)
|
||||
return (hasActiveDocument() && !Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
DEF_STD_CMD_A(CmdViewTriangulation);
|
||||
|
||||
CmdViewTriangulation::CmdViewTriangulation()
|
||||
: Command("Reen_ViewTriangulation")
|
||||
{
|
||||
sAppModule = "Reen";
|
||||
sGroup = QT_TR_NOOP("Reverse Engineering");
|
||||
sMenuText = QT_TR_NOOP("View triangulation");
|
||||
sToolTipText = QT_TR_NOOP("View triangulation");
|
||||
sToolTipText = QT_TR_NOOP("View triangulation");
|
||||
sWhatsThis = "Reen_ViewTriangulation";
|
||||
}
|
||||
|
||||
void CmdViewTriangulation::activated(int iMsg)
|
||||
{
|
||||
std::vector<App::DocumentObject*> obj = Gui::Selection().getObjectsOfType(Points::ViewFeature::getClassTypeId());
|
||||
addModule(App,"ReverseEngineering");
|
||||
openCommand("View triangulation");
|
||||
try {
|
||||
for (std::vector<App::DocumentObject*>::iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
App::DocumentObjectT objT(*it);
|
||||
QString document = QString::fromStdString(objT.getDocumentPython());
|
||||
QString object = QString::fromStdString(objT.getObjectPython());
|
||||
|
||||
QString command = QString::fromLatin1("%1.addObject('Mesh::Feature', 'View mesh').Mesh = ReverseEngineering.viewTriangulation("
|
||||
"Points=%2.Points,"
|
||||
"Width=%2.Width,"
|
||||
"Height=%2.Height)"
|
||||
)
|
||||
.arg(document)
|
||||
.arg(object)
|
||||
;
|
||||
doCommand(Doc, command.toLatin1());
|
||||
}
|
||||
|
||||
commitCommand();
|
||||
updateActive();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
abortCommand();
|
||||
QMessageBox::warning(Gui::getMainWindow(),
|
||||
qApp->translate("Reen_ViewTriangulation", "View triangulation failed"),
|
||||
QString::fromLatin1(e.what())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdViewTriangulation::isActive(void)
|
||||
{
|
||||
return Gui::Selection().countObjectsOfType(Points::ViewFeature::getClassTypeId()) > 0;
|
||||
}
|
||||
|
||||
void CreateReverseEngineeringCommands(void)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
rcCmdMgr.addCommand(new CmdApproxSurface());
|
||||
rcCmdMgr.addCommand(new CmdApproxPlane());
|
||||
rcCmdMgr.addCommand(new CmdPoissonReconstruction());
|
||||
rcCmdMgr.addCommand(new CmdViewTriangulation());
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
|
||||
Gui::MenuItem *reconstruct = new Gui::MenuItem();
|
||||
reconstruct->setCommand("Surface reconstruction");
|
||||
*reconstruct << "Reen_PoissonReconstruction";
|
||||
*reconstruct << "Reen_PoissonReconstruction"
|
||||
<< "Reen_ViewTriangulation";
|
||||
*reen << reconstruct;
|
||||
|
||||
return root;
|
||||
|
||||
Reference in New Issue
Block a user