+ Add parametric feature to create face from sketches
This commit is contained in:
parent
74270c23d2
commit
6944658bd4
|
@ -43,6 +43,7 @@
|
|||
#include "FeatureGeometrySet.h"
|
||||
#include "FeatureChamfer.h"
|
||||
#include "FeatureCompound.h"
|
||||
#include "FeatureFace.h"
|
||||
#include "FeatureExtrusion.h"
|
||||
#include "FeatureFillet.h"
|
||||
#include "FeatureMirroring.h"
|
||||
|
@ -263,6 +264,7 @@ void PartExport initPart()
|
|||
Part::Wedge ::init();
|
||||
Part::Part2DObject ::init();
|
||||
Part::Part2DObjectPython ::init();
|
||||
Part::Face ::init();
|
||||
Part::RuledSurface ::init();
|
||||
Part::Loft ::init();
|
||||
Part::Sweep ::init();
|
||||
|
|
|
@ -113,6 +113,8 @@ SET(Features_SRCS
|
|||
FeatureCompound.h
|
||||
FeatureExtrusion.cpp
|
||||
FeatureExtrusion.h
|
||||
FeatureFace.cpp
|
||||
FeatureFace.h
|
||||
FeatureFillet.cpp
|
||||
FeatureFillet.h
|
||||
FeatureMirroring.cpp
|
||||
|
|
|
@ -44,12 +44,13 @@
|
|||
#include <Base/Placement.h>
|
||||
|
||||
#include "FeatureFace.h"
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
|
||||
|
||||
using namespace PartDesign;
|
||||
using namespace Part;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::Face, Part::Part2DObject)
|
||||
PROPERTY_SOURCE(Part::Face, Part::Feature)
|
||||
|
||||
Face::Face()
|
||||
{
|
||||
|
@ -61,7 +62,7 @@ short Face::mustExecute() const
|
|||
{
|
||||
if (Sources.isTouched())
|
||||
return 1;
|
||||
return Part::Part2DObject::mustExecute();
|
||||
return Part::Feature::mustExecute();
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Face::execute(void)
|
|
@ -21,17 +21,17 @@
|
|||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef PARTDESIGN_FACE_H
|
||||
#define PARTDESIGN_FACE_H
|
||||
#ifndef PART_FACE_H
|
||||
#define PART_FACE_H
|
||||
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
namespace PartDesign
|
||||
namespace Part
|
||||
{
|
||||
|
||||
class PartDesignExport Face : public Part::Part2DObject
|
||||
class PartExport Face : public Part::Feature
|
||||
{
|
||||
PROPERTY_HEADER(PartDesign::Face);
|
||||
PROPERTY_HEADER(Part::Face);
|
||||
|
||||
public:
|
||||
Face();
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
class Wire_Compare;
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
} //namespace Part
|
||||
|
||||
|
||||
#endif // PARTDESIGN_FACE_H
|
||||
#endif // PART_FACE_H
|
|
@ -39,6 +39,7 @@
|
|||
#include <Base/Exception.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
#include <Gui/Action.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
|
@ -53,6 +54,7 @@
|
|||
#include <Gui/WaitCursor.h>
|
||||
|
||||
#include "../App/PartFeature.h"
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
#include "DlgPartImportStepImp.h"
|
||||
#include "DlgBooleanOperation.h"
|
||||
#include "DlgExtrusion.h"
|
||||
|
@ -1021,6 +1023,44 @@ bool CmdPartExtrude::isActive(void)
|
|||
return (hasActiveDocument() && !Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_MakeFace
|
||||
//===========================================================================
|
||||
DEF_STD_CMD_A(CmdPartMakeFace);
|
||||
|
||||
CmdPartMakeFace::CmdPartMakeFace()
|
||||
: Command("Part_MakeFace")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Make face from sketch");
|
||||
sToolTipText = QT_TR_NOOP("Make face from a selected sketch");
|
||||
sWhatsThis = "Part_MakeFace";
|
||||
sStatusTip = sToolTipText;
|
||||
}
|
||||
|
||||
void CmdPartMakeFace::activated(int iMsg)
|
||||
{
|
||||
std::vector<Part::Part2DObject*> sketches = Gui::Selection().getObjectsOfType<Part::Part2DObject>();
|
||||
openCommand("Make face");
|
||||
for (std::vector<Part::Part2DObject*>::iterator it = sketches.begin(); it != sketches.end(); ++it) {
|
||||
App::DocumentObjectT obj(*it);
|
||||
std::stringstream str;
|
||||
str << obj.getDocumentPython()
|
||||
<< ".addObject(\"Part::Face\", \"Face\").Sources = "
|
||||
<< obj.getObjectPython();
|
||||
doCommand(Doc,str.str().c_str());
|
||||
}
|
||||
commitCommand();
|
||||
updateActive();
|
||||
}
|
||||
|
||||
bool CmdPartMakeFace::isActive(void)
|
||||
{
|
||||
return (Gui::Selection().countObjectsOfType(Part::Part2DObject::getClassTypeId()) > 0 &&
|
||||
!Gui::Control().activeDialog());
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_Revolve
|
||||
//===========================================================================
|
||||
|
@ -1837,6 +1877,7 @@ void CreatePartCommands(void)
|
|||
rcCmdMgr.addCommand(new CmdPartReverseShape());
|
||||
rcCmdMgr.addCommand(new CmdPartBoolean());
|
||||
rcCmdMgr.addCommand(new CmdPartExtrude());
|
||||
rcCmdMgr.addCommand(new CmdPartMakeFace());
|
||||
rcCmdMgr.addCommand(new CmdPartMirror());
|
||||
rcCmdMgr.addCommand(new CmdPartRevolve());
|
||||
rcCmdMgr.addCommand(new CmdPartCrossSections());
|
||||
|
|
|
@ -79,7 +79,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Part_ShapeFromMesh" << "Part_MakeSolid" << "Part_ReverseShape"
|
||||
<< "Part_SimpleCopy" << "Part_RefineShape" << "Part_CheckGeometry"
|
||||
<< "Separator" << bop << join << "Separator"
|
||||
<< "Part_CrossSections" << "Part_Compound" << "Part_Extrude"
|
||||
<< "Part_CrossSections" << "Part_Compound" << "Part_MakeFace" << "Part_Extrude"
|
||||
<< "Part_Revolve" << "Part_Mirror" << "Part_Fillet" << "Part_Chamfer"
|
||||
<< "Part_RuledSurface" << "Part_Loft" << "Part_Sweep"
|
||||
<< "Part_Offset" << "Part_Thickness";
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "FeatureDressUp.h"
|
||||
#include "FeatureChamfer.h"
|
||||
#include "FeatureDraft.h"
|
||||
#include "FeatureFace.h"
|
||||
#include "FeatureSubtractive.h"
|
||||
#include "FeatureAdditive.h"
|
||||
#include "FeatureTransformed.h"
|
||||
|
@ -96,8 +95,7 @@ void PartDesignExport init_PartDesign()
|
|||
PartDesign::Revolution ::init();
|
||||
PartDesign::Groove ::init();
|
||||
PartDesign::Chamfer ::init();
|
||||
PartDesign::Face ::init();
|
||||
PartDesign::Draft ::init();
|
||||
PartDesign::Draft ::init();
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
|
|
@ -62,8 +62,6 @@ SOURCE_GROUP("DressUpFeatures" FILES ${FeaturesDressUp_SRCS})
|
|||
SET(FeaturesSketchBased_SRCS
|
||||
FeatureSketchBased.cpp
|
||||
FeatureSketchBased.h
|
||||
FeatureFace.cpp
|
||||
FeatureFace.h
|
||||
FeaturePad.cpp
|
||||
FeaturePad.h
|
||||
FeaturePocket.cpp
|
||||
|
|
Loading…
Reference in New Issue
Block a user