[PD] Body and utils: remove unused includes
This commit is contained in:
@@ -23,31 +23,16 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Placement.h>
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Origin.h>
|
||||
|
||||
#include <Mod/Part/App/DatumFeature.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
|
||||
|
||||
#include "Feature.h"
|
||||
#include "FeatureSketchBased.h"
|
||||
#include "FeatureTransformed.h"
|
||||
#include "DatumPoint.h"
|
||||
#include "DatumLine.h"
|
||||
#include "DatumPlane.h"
|
||||
#include "ShapeBinder.h"
|
||||
#include <Base/Placement.h>
|
||||
|
||||
#include "Body.h"
|
||||
#include "FeatureBase.h"
|
||||
#include "BodyPy.h"
|
||||
#include "FeatureBase.h"
|
||||
#include "FeatureSketchBased.h"
|
||||
#include "FeatureTransformed.h"
|
||||
#include "ShapeBinder.h"
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
|
||||
@@ -24,11 +24,8 @@
|
||||
#ifndef PARTDESIGN_Body_H
|
||||
#define PARTDESIGN_Body_H
|
||||
|
||||
#include <App/PropertyStandard.h>
|
||||
#include <Mod/Part/App/BodyBase.h>
|
||||
|
||||
#include <boost_signals2.hpp>
|
||||
|
||||
namespace App {
|
||||
class Origin;
|
||||
}
|
||||
|
||||
@@ -1,101 +1,95 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
|
||||
#include "Mod/Part/App/Part2DObject.h"
|
||||
#include "Mod/PartDesign/App/Body.h"
|
||||
#include "Mod/PartDesign/App/Feature.h"
|
||||
|
||||
// inclusion of the generated files (generated out of ItemPy.xml)
|
||||
#include "BodyPy.h"
|
||||
#include "BodyPy.cpp"
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string BodyPy::representation(void) const
|
||||
{
|
||||
return std::string("<body object>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
PyObject *BodyPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BodyPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* BodyPy::insertObject(PyObject *args)
|
||||
{
|
||||
PyObject* featurePy;
|
||||
PyObject* targetPy;
|
||||
PyObject* afterPy = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "O!O|O!", &(App::DocumentObjectPy::Type), &featurePy,
|
||||
&targetPy, &PyBool_Type, &afterPy)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
App::DocumentObject* feature = static_cast<App::DocumentObjectPy*>(featurePy)->getDocumentObjectPtr();
|
||||
App::DocumentObject* target = nullptr;
|
||||
if (PyObject_TypeCheck(targetPy, &(App::DocumentObjectPy::Type))) {
|
||||
target = static_cast<App::DocumentObjectPy*>(targetPy)->getDocumentObjectPtr();
|
||||
}
|
||||
|
||||
if (!Body::isAllowed(feature)) {
|
||||
PyErr_SetString(PyExc_SystemError, "Only PartDesign features, datum features and sketches can be inserted into a Body");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool after = PyObject_IsTrue(afterPy) ? true : false;
|
||||
Body* body = this->getBodyPtr();
|
||||
|
||||
try {
|
||||
body->insertObject(feature, target, after);
|
||||
}
|
||||
catch (Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_SystemError, e.what());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
Py::Object BodyPy::getVisibleFeature() const {
|
||||
for(auto obj : getBodyPtr()->Group.getValues()) {
|
||||
if(obj->Visibility.getValue() && obj->isDerivedFrom(PartDesign::Feature::getClassTypeId()))
|
||||
return Py::Object(obj->getPyObject(),true);
|
||||
}
|
||||
return Py::Object();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2010 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include "Mod/PartDesign/App/Body.h"
|
||||
#include "Mod/PartDesign/App/Feature.h"
|
||||
|
||||
// inclusion of the generated files (generated out of ItemPy.xml)
|
||||
#include "BodyPy.h"
|
||||
#include "BodyPy.cpp"
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string BodyPy::representation(void) const
|
||||
{
|
||||
return std::string("<body object>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
PyObject *BodyPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BodyPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject* BodyPy::insertObject(PyObject *args)
|
||||
{
|
||||
PyObject* featurePy;
|
||||
PyObject* targetPy;
|
||||
PyObject* afterPy = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "O!O|O!", &(App::DocumentObjectPy::Type), &featurePy,
|
||||
&targetPy, &PyBool_Type, &afterPy)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
App::DocumentObject* feature = static_cast<App::DocumentObjectPy*>(featurePy)->getDocumentObjectPtr();
|
||||
App::DocumentObject* target = nullptr;
|
||||
if (PyObject_TypeCheck(targetPy, &(App::DocumentObjectPy::Type))) {
|
||||
target = static_cast<App::DocumentObjectPy*>(targetPy)->getDocumentObjectPtr();
|
||||
}
|
||||
|
||||
if (!Body::isAllowed(feature)) {
|
||||
PyErr_SetString(PyExc_SystemError, "Only PartDesign features, datum features and sketches can be inserted into a Body");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool after = PyObject_IsTrue(afterPy) ? true : false;
|
||||
Body* body = this->getBodyPtr();
|
||||
|
||||
try {
|
||||
body->insertObject(feature, target, after);
|
||||
}
|
||||
catch (Base::Exception& e) {
|
||||
PyErr_SetString(PyExc_SystemError, e.what());
|
||||
return 0;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
Py::Object BodyPy::getVisibleFeature() const {
|
||||
for(auto obj : getBodyPtr()->Group.getValues()) {
|
||||
if(obj->Visibility.getValue() && obj->isDerivedFrom(PartDesign::Feature::getClassTypeId()))
|
||||
return Py::Object(obj->getPyObject(),true);
|
||||
}
|
||||
return Py::Object();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,35 +24,26 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <QMessageBox>
|
||||
# include <Precision.hxx>
|
||||
# include <gp_Pln.hxx>
|
||||
# include <Precision.hxx>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <App/Part.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/OriginFeature.h>
|
||||
#include <App/DocumentObjectGroup.h>
|
||||
#include <App/Part.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/CommandT.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
#include <Gui/MDIView.h>
|
||||
#include <Gui/ViewProviderPart.h>
|
||||
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include <Mod/PartDesign/App/Feature.h>
|
||||
#include <Mod/PartDesign/App/FeatureSketchBased.h>
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
|
||||
#include <Mod/PartDesign/App/Feature.h>
|
||||
#include <Mod/PartDesign/App/Body.h>
|
||||
#include <Mod/PartDesign/App/FeaturePrimitive.h>
|
||||
#include <Mod/PartDesign/App/FeatureSketchBased.h>
|
||||
#include <Mod/PartDesign/App/FeatureBoolean.h>
|
||||
#include <Mod/PartDesign/App/DatumCS.h>
|
||||
|
||||
#include "ReferenceSelection.h"
|
||||
#include "Utils.h"
|
||||
#include "WorkflowManager.h"
|
||||
#include "DlgActiveBody.h"
|
||||
#include "ReferenceSelection.h"
|
||||
#include "WorkflowManager.h"
|
||||
|
||||
|
||||
FC_LOG_LEVEL_INIT("PartDesignGui",true,true)
|
||||
|
||||
@@ -31,26 +31,21 @@
|
||||
# include <Inventor/nodes/SoMaterial.h>
|
||||
# include <Inventor/nodes/SoPickStyle.h>
|
||||
# include <Bnd_Box.hxx>
|
||||
# include <BRep_Tool.hxx>
|
||||
# include <BRepBndLib.hxx>
|
||||
# include <BRepMesh_IncrementalMesh.hxx>
|
||||
# include <BRep_Tool.hxx>
|
||||
# include <Standard_Version.hxx>
|
||||
# include <TopExp_Explorer.hxx>
|
||||
# include <TopoDS.hxx>
|
||||
# include <Standard_Version.hxx>
|
||||
#endif
|
||||
|
||||
#include "ViewProviderAddSub.h"
|
||||
#include <Mod/Part/Gui/SoBrepFaceSet.h>
|
||||
#include <Mod/Part/App/Tools.h>
|
||||
#include <Mod/PartDesign/App/FeatureAddSub.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/Control.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Mod/Part/App/Tools.h>
|
||||
#include <Mod/Part/Gui/SoBrepFaceSet.h>
|
||||
#include <Mod/PartDesign/App/FeatureAddSub.h>
|
||||
|
||||
#include "ViewProviderAddSub.h"
|
||||
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
@@ -1,99 +1,96 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2017 Stefan Tröger <stefantroeger@gmx.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include <App/Document.h>
|
||||
#include "ViewProviderBase.h"
|
||||
#include <Mod/PartDesign/App/FeatureBase.h>
|
||||
#include <Gui/Command.h>
|
||||
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
PROPERTY_SOURCE(PartDesignGui::ViewProviderBase,PartDesignGui::ViewProvider)
|
||||
|
||||
ViewProviderBase::ViewProviderBase()
|
||||
{
|
||||
sPixmap = "PartDesign_BaseFeature.svg";
|
||||
}
|
||||
|
||||
ViewProviderBase::~ViewProviderBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ViewProviderBase::doubleClicked(void)
|
||||
{
|
||||
// If the Placement is mutable then open the transform panel.
|
||||
// If the Placement can't be modified then just do nothing on double-click.
|
||||
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(getObject());
|
||||
if (!base->Placement.testStatus(App::Property::Immutable) &&
|
||||
!base->Placement.testStatus(App::Property::ReadOnly) &&
|
||||
!base->Placement.testStatus(App::Property::Hidden)) {
|
||||
|
||||
try {
|
||||
std::string Msg("Edit ");
|
||||
Msg += base->Label.getValue();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
FCMD_SET_EDIT(base);
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewProviderBase::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
// If the Placement is mutable then show the context-menu of the base class.
|
||||
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(getObject());
|
||||
if (!base->Placement.testStatus(App::Property::Immutable) &&
|
||||
!base->Placement.testStatus(App::Property::ReadOnly) &&
|
||||
!base->Placement.testStatus(App::Property::Hidden)) {
|
||||
PartDesignGui::ViewProvider::setupContextMenu(menu, receiver, member);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderBase::setEdit(int ModNum)
|
||||
{
|
||||
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(getObject());
|
||||
if (!base->Placement.testStatus(App::Property::Immutable) &&
|
||||
!base->Placement.testStatus(App::Property::ReadOnly) &&
|
||||
!base->Placement.testStatus(App::Property::Hidden)) {
|
||||
return PartGui::ViewProviderPart::setEdit(ModNum);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewProviderBase::unsetEdit(int ModNum)
|
||||
{
|
||||
PartGui::ViewProviderPart::unsetEdit(ModNum);
|
||||
}
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2017 Stefan Tröger <stefantroeger@gmx.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <Gui/Command.h>
|
||||
#include <Mod/PartDesign/App/FeatureBase.h>
|
||||
|
||||
#include "ViewProviderBase.h"
|
||||
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
PROPERTY_SOURCE(PartDesignGui::ViewProviderBase,PartDesignGui::ViewProvider)
|
||||
|
||||
ViewProviderBase::ViewProviderBase()
|
||||
{
|
||||
sPixmap = "PartDesign_BaseFeature.svg";
|
||||
}
|
||||
|
||||
ViewProviderBase::~ViewProviderBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ViewProviderBase::doubleClicked(void)
|
||||
{
|
||||
// If the Placement is mutable then open the transform panel.
|
||||
// If the Placement can't be modified then just do nothing on double-click.
|
||||
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(getObject());
|
||||
if (!base->Placement.testStatus(App::Property::Immutable) &&
|
||||
!base->Placement.testStatus(App::Property::ReadOnly) &&
|
||||
!base->Placement.testStatus(App::Property::Hidden)) {
|
||||
|
||||
try {
|
||||
std::string Msg("Edit ");
|
||||
Msg += base->Label.getValue();
|
||||
Gui::Command::openCommand(Msg.c_str());
|
||||
FCMD_SET_EDIT(base);
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
Gui::Command::abortCommand();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewProviderBase::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
// If the Placement is mutable then show the context-menu of the base class.
|
||||
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(getObject());
|
||||
if (!base->Placement.testStatus(App::Property::Immutable) &&
|
||||
!base->Placement.testStatus(App::Property::ReadOnly) &&
|
||||
!base->Placement.testStatus(App::Property::Hidden)) {
|
||||
PartDesignGui::ViewProvider::setupContextMenu(menu, receiver, member);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderBase::setEdit(int ModNum)
|
||||
{
|
||||
PartDesign::FeatureBase* base = static_cast<PartDesign::FeatureBase*>(getObject());
|
||||
if (!base->Placement.testStatus(App::Property::Immutable) &&
|
||||
!base->Placement.testStatus(App::Property::ReadOnly) &&
|
||||
!base->Placement.testStatus(App::Property::Hidden)) {
|
||||
return PartGui::ViewProviderPart::setEdit(ModNum);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ViewProviderBase::unsetEdit(int ModNum)
|
||||
{
|
||||
PartGui::ViewProviderPart::unsetEdit(ModNum);
|
||||
}
|
||||
|
||||
@@ -24,22 +24,20 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <boost_bind_bind.hpp>
|
||||
# include <Inventor/actions/SoGetBoundingBoxAction.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
# include <Precision.hxx>
|
||||
# include <QMenu>
|
||||
#endif
|
||||
|
||||
#include <App/Origin.h>
|
||||
#include <App/Part.h>
|
||||
#include <Base/Console.h>
|
||||
#include <Gui/ActionFunction.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/MDIView.h>
|
||||
#include <App/Origin.h>
|
||||
#include <App/Part.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/View3DInventor.h>
|
||||
#include <Gui/View3DInventorViewer.h>
|
||||
#include <Gui/ViewProviderOrigin.h>
|
||||
|
||||
Reference in New Issue
Block a user