Mesh: Added Mesh Merge command
This command joins selected mesh objects into one
This commit is contained in:
parent
cfbcd3a6f3
commit
b4ea012edc
|
@ -1632,6 +1632,47 @@ bool CmdMeshSegmentation::isActive(void)
|
||||||
(Mesh::Feature::getClassTypeId()) == 1;
|
(Mesh::Feature::getClassTypeId()) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
DEF_STD_CMD_A(CmdMeshMerge);
|
||||||
|
|
||||||
|
CmdMeshMerge::CmdMeshMerge()
|
||||||
|
:Command("Mesh_Merge")
|
||||||
|
{
|
||||||
|
sAppModule = "Mesh";
|
||||||
|
sGroup = QT_TR_NOOP("Mesh");
|
||||||
|
sMenuText = QT_TR_NOOP("Merge");
|
||||||
|
sToolTipText = "Merges selected meshes into one";
|
||||||
|
sWhatsThis = "Mesh_Merge";
|
||||||
|
sStatusTip = sToolTipText;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CmdMeshMerge::activated(int iMsg)
|
||||||
|
{
|
||||||
|
App::Document *pcDoc = App::GetApplication().getActiveDocument();
|
||||||
|
if (!pcDoc)
|
||||||
|
return;
|
||||||
|
openCommand("Mesh merge");
|
||||||
|
Mesh::MeshObject* newMesh = new(Mesh::MeshObject);
|
||||||
|
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType(Mesh::Feature::getClassTypeId());
|
||||||
|
for (std::vector<App::DocumentObject*>::const_iterator it = objs.begin(); it != objs.end(); ++it) {
|
||||||
|
const MeshObject& mesh = static_cast<Mesh::Feature*>(*it)->Mesh.getValue();
|
||||||
|
MeshCore::MeshKernel kernel = mesh.getKernel();
|
||||||
|
newMesh->addMesh(kernel);
|
||||||
|
}
|
||||||
|
Mesh::Feature *pcFeature = (Mesh::Feature*)pcDoc->addObject("Mesh::Feature", "Mesh");
|
||||||
|
pcFeature->Mesh.setValue(*newMesh);
|
||||||
|
updateActive();
|
||||||
|
commitCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CmdMeshMerge::isActive(void)
|
||||||
|
{
|
||||||
|
return getSelection().countObjectsOfType(Mesh::Feature::getClassTypeId()) >= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CreateMeshCommands(void)
|
void CreateMeshCommands(void)
|
||||||
{
|
{
|
||||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||||
|
@ -1667,4 +1708,5 @@ void CreateMeshCommands(void)
|
||||||
rcCmdMgr.addCommand(new CmdMeshFromGeometry());
|
rcCmdMgr.addCommand(new CmdMeshFromGeometry());
|
||||||
rcCmdMgr.addCommand(new CmdMeshFromPartShape());
|
rcCmdMgr.addCommand(new CmdMeshFromPartShape());
|
||||||
rcCmdMgr.addCommand(new CmdMeshSegmentation());
|
rcCmdMgr.addCommand(new CmdMeshSegmentation());
|
||||||
|
rcCmdMgr.addCommand(new CmdMeshMerge());
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||||
<< analyze << "Mesh_HarmonizeNormals" << "Mesh_FlipNormals" << "Separator"
|
<< analyze << "Mesh_HarmonizeNormals" << "Mesh_FlipNormals" << "Separator"
|
||||||
<< "Mesh_FillupHoles" << "Mesh_FillInteractiveHole" << "Mesh_RemoveComponents"
|
<< "Mesh_FillupHoles" << "Mesh_FillInteractiveHole" << "Mesh_RemoveComponents"
|
||||||
<< "Mesh_RemoveCompByHand" << "Mesh_AddFacet" << "Mesh_Smoothing" << "Separator"
|
<< "Mesh_RemoveCompByHand" << "Mesh_AddFacet" << "Mesh_Smoothing" << "Separator"
|
||||||
<< "Mesh_BuildRegularSolid" << boolean << "Separator" << "Mesh_PolySelect" << "Mesh_PolyCut"
|
<< "Mesh_BuildRegularSolid" << boolean << "Separator" << "Mesh_Merge" << "Mesh_PolySelect" << "Mesh_PolyCut"
|
||||||
<< "Mesh_PolySplit" << "Mesh_PolySegm" << "Mesh_PolyTrim" << "Mesh_TrimByPlane" << "Mesh_Segmentation"
|
<< "Mesh_PolySplit" << "Mesh_PolySegm" << "Mesh_PolyTrim" << "Mesh_TrimByPlane" << "Mesh_Segmentation"
|
||||||
<< "Mesh_VertexCurvature";
|
<< "Mesh_VertexCurvature";
|
||||||
return root;
|
return root;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user