switch PartDesign to Bodies

This commit is contained in:
jriegel 2012-05-16 21:45:03 +02:00 committed by Stefan Tröger
parent bf26a422cb
commit fbd763a8f4
10 changed files with 2875 additions and 683 deletions

View File

@ -47,15 +47,8 @@ public:
const std::string& getValue(void) const;
static std::string createUuid(void);
/// raw data
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
private:
std::string _uuid;
};
} //namespace Base

View File

@ -21,6 +21,7 @@ link_directories(${OCC_LIBRARY_DIR})
set(PartDesignGui_LIBS
PartDesign
SketcherGui
PartGui
SketcherGui
FreeCADGui

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
// Importing of App classes
#ifdef FC_OS_WIN32
# define PartDesignExport __declspec(dllimport)
# define PartDesignGuiExport __declspec(dllexport)
# define PartDesignGuiExport __declspec(dllexport)
# define PartExport __declspec(dllimport)
# define PartGuiExport __declspec(dllimport)
# define SketcherExport __declspec(dllimport)

View File

@ -28,7 +28,9 @@
#include "ViewProviderBody.h"
#include <Gui/Command.h>
//#include <Gui/Document.h>
#include <Mod/PartDesign/App/Body.h>
#include <Mod/PartDesign/App/FeatureSketchBased.h>
#include <algorithm>
using namespace PartDesignGui;
@ -51,4 +53,25 @@ bool ViewProviderBody::doubleClicked(void)
return true;
}
std::vector<App::DocumentObject*> ViewProviderBody::claimChildren(void)const
{
std::vector<App::DocumentObject*> Model = static_cast<PartDesign::Body*>(getObject())->Model.getValues();
std::set<App::DocumentObject*> OutSet;
// search for objects handled (claimed) by the features
for(std::vector<App::DocumentObject*>::const_iterator it = Model.begin();it!=Model.end();++it){
// sketches of SketchBased features get claimed under the feature so has to be removed from the Body
if ((*it)->isDerivedFrom(PartDesign::SketchBased::getClassTypeId())){
OutSet.insert(static_cast<PartDesign::SketchBased*>(*it)->Sketch.getValue());
}
}
// remove the otherwise handled objects
std::vector<App::DocumentObject*> Result(Model.size());
sort (Model.begin(), Model.end());
std::vector<App::DocumentObject*>::iterator it = set_difference (Model.begin(), Model.end(), OutSet.begin(),OutSet.end(), Result.begin());
// return the rest as claim set of the Body
return std::vector<App::DocumentObject*>(Result.begin(),it);
}

View File

@ -40,6 +40,8 @@ public:
virtual ~ViewProviderBody();
virtual bool doubleClicked(void);
std::vector<App::DocumentObject*> claimChildren(void)const;
};

View File

@ -34,7 +34,6 @@
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>
#include <Gui/Control.h>
#include <Gui/Command.h>
using namespace PartDesignGui;
@ -85,10 +84,10 @@ void Workbench::activated()
));
const char* Face[] = {
"Sketcher_NewSketch",
"PartDesign_NewSketch",
"PartDesign_Fillet",
"PartDesign_Chamfer",
"PartDesign_Draft",
// "PartDesign_Draft",
0};
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
"SELECT Part::Feature SUBELEMENT Face COUNT 1",
@ -100,7 +99,7 @@ void Workbench::activated()
const char* Faces[] = {
"PartDesign_Fillet",
"PartDesign_Chamfer",
"PartDesign_Draft",
// "PartDesign_Draft",
0};
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
"SELECT Part::Feature SUBELEMENT Face COUNT 2..",
@ -110,12 +109,10 @@ void Workbench::activated()
));
const char* Sketch[] = {
"Sketcher_NewSketch",
"Sketcher_EditSketch",
"PartDesign_NewSketch",
"PartDesign_Pad",
"PartDesign_Pocket",
"PartDesign_Revolution",
"PartDesign_Groove",
0};
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
"SELECT Sketcher::SketchObject COUNT 1",
@ -124,22 +121,22 @@ void Workbench::activated()
"Part_Box"
));
const char* Transformed[] = {
"PartDesign_Mirrored",
"PartDesign_LinearPattern",
"PartDesign_PolarPattern",
// "PartDesign_Scaled",
"PartDesign_MultiTransform",
0};
Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
"SELECT PartDesign::SketchBased",
Transformed,
"Transformation tools",
"PartDesign_MultiTransform"
));
// const char* Transformed[] = {
// "PartDesign_Mirrored",
// "PartDesign_LinearPattern",
// "PartDesign_PolarPattern",
//// "PartDesign_Scaled",
// "PartDesign_MultiTransform",
// 0};
// Watcher.push_back(new Gui::TaskView::TaskWatcherCommands(
// "SELECT PartDesign::SketchBased",
// Transformed,
// "Transformation tools",
// "PartDesign_MultiTransform"
// ));
const char* Empty[] = {
"Sketcher_NewSketch",
"PartDesign_NewSketch",
"Part_Box",
"Part_Cylinder",
0};
@ -184,22 +181,26 @@ Gui::MenuItem* Workbench::setupMenuBar() const
root->insertItem(item, part);
part->setCommand("&Part Design");
SketcherGui::addSketcherWorkbenchSketchActions( *part );
*part << geom
*part << "PartDesign_NewSketch"
<< "Sketcher_LeaveSketch"
<< "Sketcher_ViewSketch"
<< "Sketcher_MapSketch"
<< geom
<< cons
<< consaccel
<< "Separator"
<< "PartDesign_Pad"
<< "PartDesign_Pocket"
<< "PartDesign_Revolution"
<< "PartDesign_Groove"
// << "PartDesign_Groove"
<< "PartDesign_Fillet"
<< "PartDesign_Chamfer"
<< "PartDesign_Draft"
<< "PartDesign_Mirrored"
<< "PartDesign_LinearPattern"
<< "PartDesign_PolarPattern"
<< "PartDesign_Chamfer";
// << "PartDesign_Draft"
// << "PartDesign_Mirrored"
// << "PartDesign_LinearPattern"
// << "PartDesign_PolarPattern"
// << "PartDesign_Scaled"
<< "PartDesign_MultiTransform";
// << "PartDesign_MultiTransform";
// For 0.13 a couple of python packages like numpy, matplotlib and others
// are not deployed with the installer on Windows. Thus, the WizardShaft is
// not deployed either hence the check for the existence of the command.
@ -218,20 +219,23 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
Gui::ToolBarItem* root = StdWorkbench::setupToolBars();
Gui::ToolBarItem* part = new Gui::ToolBarItem(root);
part->setCommand("Part Design");
SketcherGui::addSketcherWorkbenchSketchActions( *part );
*part << "Separator"
// TODO: reenable features than rebasing
// SketcherGui::addSketcherWorkbenchSketchActions( *part );
*part << "PartDesign_NewSketch"
<< "Sketcher_LeaveSketch"
<< "Separator"
<< "PartDesign_Pad"
<< "PartDesign_Pocket"
<< "PartDesign_Revolution"
<< "PartDesign_Groove"
// << "PartDesign_Groove"
<< "PartDesign_Fillet"
<< "PartDesign_Chamfer"
<< "PartDesign_Draft"
<< "PartDesign_Mirrored"
<< "PartDesign_LinearPattern"
<< "PartDesign_PolarPattern"
<< "PartDesign_Chamfer";
// << "PartDesign_Draft"
// << "PartDesign_Mirrored"
// << "PartDesign_LinearPattern"
// << "PartDesign_PolarPattern"
// << "PartDesign_Scaled"
<< "PartDesign_MultiTransform";
// << "PartDesign_MultiTransform";
Gui::ToolBarItem* geom = new Gui::ToolBarItem(root);
geom->setCommand("Sketcher geometries");

View File

@ -28,9 +28,9 @@
// Importing of App classes
#ifdef FC_OS_WIN32
# define SketcherExport __declspec(dllimport)
# define PartExport __declspec(dllimport)
# define PartGuiExport __declspec(dllimport)
# define SketcherExport __declspec(dllimport)
# define PartExport __declspec(dllimport)
# define PartGuiExport __declspec(dllimport)
# define SketcherGuiExport __declspec(dllexport)
#else // for Linux
# define SketcherExport

View File

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2011 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2011 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
@ -29,7 +29,7 @@
namespace SketcherGui {
class Ui_SketchOrientationDialog;
class SketchOrientationDialog : public QDialog
class SketcherGuiExport SketchOrientationDialog : public QDialog
{
Q_OBJECT