polish Mesh workbench
This commit is contained in:
@@ -78,7 +78,8 @@
|
||||
|
||||
using namespace Mesh;
|
||||
|
||||
|
||||
// deprecated
|
||||
#if 0
|
||||
DEF_STD_CMD_A(CmdMeshTransform);
|
||||
|
||||
CmdMeshTransform::CmdMeshTransform()
|
||||
@@ -157,6 +158,61 @@ bool CmdMeshDemolding::isActive(void)
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdMeshToolMesh);
|
||||
|
||||
CmdMeshToolMesh::CmdMeshToolMesh()
|
||||
:Command("Mesh_ToolMesh")
|
||||
{
|
||||
sAppModule = "Mesh";
|
||||
sGroup = QT_TR_NOOP("Mesh");
|
||||
sMenuText = QT_TR_NOOP("Segment by tool mesh");
|
||||
sToolTipText = QT_TR_NOOP("Creates a segment from a given tool mesh");
|
||||
sWhatsThis = "Mesh_ToolMesh";
|
||||
sStatusTip = QT_TR_NOOP("Creates a segment from a given tool mesh");
|
||||
}
|
||||
|
||||
void CmdMeshToolMesh::activated(int)
|
||||
{
|
||||
std::vector<App::DocumentObject*> fea = Gui::Selection().getObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||
if ( fea.size() == 2 )
|
||||
{
|
||||
std::string fName = getUniqueObjectName("MeshSegment");
|
||||
App::DocumentObject* mesh = fea.front();
|
||||
App::DocumentObject* tool = fea.back();
|
||||
|
||||
openCommand("Segment by tool mesh");
|
||||
doCommand(Doc, "import Mesh");
|
||||
doCommand(Gui, "import MeshGui");
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().addObject(\"Mesh::SegmentByMesh\",\"%s\")\n"
|
||||
"App.activeDocument().%s.Source = App.activeDocument().%s\n"
|
||||
"App.activeDocument().%s.Tool = App.activeDocument().%s\n",
|
||||
fName.c_str(), fName.c_str(), mesh->getNameInDocument(), fName.c_str(), tool->getNameInDocument() );
|
||||
|
||||
commitCommand();
|
||||
updateActive();
|
||||
|
||||
App::Document* pDoc = getDocument();
|
||||
App::DocumentObject * pObj = pDoc->getObject( fName.c_str() );
|
||||
|
||||
if ( pObj )
|
||||
{
|
||||
doCommand(Gui,"Gui.hide(\"%s\")", mesh->getNameInDocument());
|
||||
doCommand(Gui,"Gui.hide(\"%s\")", tool->getNameInDocument());
|
||||
getSelection().clearSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdMeshToolMesh::isActive(void)
|
||||
{
|
||||
// Check for the selected mesh feature (all Mesh types)
|
||||
return getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId()) == 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdMeshUnion);
|
||||
|
||||
CmdMeshUnion::CmdMeshUnion()
|
||||
@@ -716,7 +772,7 @@ bool CmdMeshPolySegm::isActive(void)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
DEF_STD_CMD_A(CmdMeshPolySelect);
|
||||
|
||||
CmdMeshPolySelect::CmdMeshPolySelect()
|
||||
@@ -767,7 +823,7 @@ bool CmdMeshPolySelect::isActive(void)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdMeshAddFacet);
|
||||
@@ -1039,60 +1095,6 @@ bool CmdMeshPolySplit::isActive(void)
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdMeshToolMesh);
|
||||
|
||||
CmdMeshToolMesh::CmdMeshToolMesh()
|
||||
:Command("Mesh_ToolMesh")
|
||||
{
|
||||
sAppModule = "Mesh";
|
||||
sGroup = QT_TR_NOOP("Mesh");
|
||||
sMenuText = QT_TR_NOOP("Segment by tool mesh");
|
||||
sToolTipText = QT_TR_NOOP("Creates a segment from a given tool mesh");
|
||||
sWhatsThis = "Mesh_ToolMesh";
|
||||
sStatusTip = QT_TR_NOOP("Creates a segment from a given tool mesh");
|
||||
}
|
||||
|
||||
void CmdMeshToolMesh::activated(int)
|
||||
{
|
||||
std::vector<App::DocumentObject*> fea = Gui::Selection().getObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||
if ( fea.size() == 2 )
|
||||
{
|
||||
std::string fName = getUniqueObjectName("MeshSegment");
|
||||
App::DocumentObject* mesh = fea.front();
|
||||
App::DocumentObject* tool = fea.back();
|
||||
|
||||
openCommand("Segment by tool mesh");
|
||||
doCommand(Doc, "import Mesh");
|
||||
doCommand(Gui, "import MeshGui");
|
||||
doCommand(Doc,
|
||||
"App.activeDocument().addObject(\"Mesh::SegmentByMesh\",\"%s\")\n"
|
||||
"App.activeDocument().%s.Source = App.activeDocument().%s\n"
|
||||
"App.activeDocument().%s.Tool = App.activeDocument().%s\n",
|
||||
fName.c_str(), fName.c_str(), mesh->getNameInDocument(), fName.c_str(), tool->getNameInDocument() );
|
||||
|
||||
commitCommand();
|
||||
updateActive();
|
||||
|
||||
App::Document* pDoc = getDocument();
|
||||
App::DocumentObject * pObj = pDoc->getObject( fName.c_str() );
|
||||
|
||||
if ( pObj )
|
||||
{
|
||||
doCommand(Gui,"Gui.hide(\"%s\")", mesh->getNameInDocument());
|
||||
doCommand(Gui,"Gui.hide(\"%s\")", tool->getNameInDocument());
|
||||
getSelection().clearSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdMeshToolMesh::isActive(void)
|
||||
{
|
||||
// Check for the selected mesh feature (all Mesh types)
|
||||
return getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId()) == 2;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
DEF_STD_CMD_A(CmdMeshEvaluation);
|
||||
|
||||
CmdMeshEvaluation::CmdMeshEvaluation()
|
||||
@@ -1455,7 +1457,9 @@ void CmdMeshBoundingBox::activated(int)
|
||||
Base::Console().Message("Boundings: Min=<%f,%f,%f>, Max=<%f,%f,%f>\n",
|
||||
box.MinX,box.MinY,box.MinZ,box.MaxX,box.MaxY,box.MaxZ);
|
||||
|
||||
QString bound = QObject::tr("Min=<%1,%2,%3>\n\nMax=<%4,%5,%6>")
|
||||
QString bound = qApp->translate("Mesh_BoundingBox", "Boundings of %1:")
|
||||
.arg(QString::fromUtf8((*it)->Label.getValue()));
|
||||
bound += QString::fromLatin1("\n\nMin=<%1,%2,%3>\n\nMax=<%4,%5,%6>")
|
||||
.arg(box.MinX).arg(box.MinY).arg(box.MinZ)
|
||||
.arg(box.MaxX).arg(box.MaxY).arg(box.MaxZ);
|
||||
QMessageBox::information(Gui::getMainWindow(), QObject::tr("Boundings"), bound);
|
||||
@@ -1703,6 +1707,9 @@ bool CmdMeshScale::isActive(void)
|
||||
void CreateMeshCommands(void)
|
||||
{
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
//rcCmdMgr.addCommand(new CmdMeshDemolding());
|
||||
//rcCmdMgr.addCommand(new CmdMeshToolMesh());
|
||||
//rcCmdMgr.addCommand(new CmdMeshTransform());
|
||||
rcCmdMgr.addCommand(new CmdMeshImport());
|
||||
rcCmdMgr.addCommand(new CmdMeshExport());
|
||||
rcCmdMgr.addCommand(new CmdMeshVertexCurvature());
|
||||
@@ -1710,17 +1717,14 @@ void CreateMeshCommands(void)
|
||||
rcCmdMgr.addCommand(new CmdMeshUnion());
|
||||
rcCmdMgr.addCommand(new CmdMeshDifference());
|
||||
rcCmdMgr.addCommand(new CmdMeshIntersection());
|
||||
rcCmdMgr.addCommand(new CmdMeshDemolding());
|
||||
rcCmdMgr.addCommand(new CmdMeshPolySegm());
|
||||
rcCmdMgr.addCommand(new CmdMeshPolySelect());
|
||||
//rcCmdMgr.addCommand(new CmdMeshPolySelect());
|
||||
rcCmdMgr.addCommand(new CmdMeshAddFacet());
|
||||
rcCmdMgr.addCommand(new CmdMeshPolyCut());
|
||||
rcCmdMgr.addCommand(new CmdMeshPolySplit());
|
||||
rcCmdMgr.addCommand(new CmdMeshPolyTrim());
|
||||
rcCmdMgr.addCommand(new CmdMeshTrimByPlane());
|
||||
rcCmdMgr.addCommand(new CmdMeshSectionByPlane());
|
||||
rcCmdMgr.addCommand(new CmdMeshToolMesh());
|
||||
rcCmdMgr.addCommand(new CmdMeshTransform());
|
||||
rcCmdMgr.addCommand(new CmdMeshEvaluation());
|
||||
rcCmdMgr.addCommand(new CmdMeshEvaluateFacet());
|
||||
rcCmdMgr.addCommand(new CmdMeshEvaluateSolid());
|
||||
|
||||
Reference in New Issue
Block a user