# Create a cut
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(anExtrusionBody, None)
aBooleanFt.selectionList("tool_objects").append(aCylinderBody, None)
-aBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(aBooleanTypeCut)
aBooleanFt.execute()
aSession.finishOperation()
SET(PROJECT_HEADERS
FeaturesAPI.h
- FeaturesAPI_Boolean.h
+ FeaturesAPI_BooleanCut.h
+ FeaturesAPI_BooleanFuse.h
+ FeaturesAPI_BooleanCommon.h
+ FeaturesAPI_BooleanSmash.h
+ FeaturesAPI_BooleanFill.h
FeaturesAPI_Extrusion.h
FeaturesAPI_ExtrusionBoolean.h
FeaturesAPI_Fillet.h
)
SET(PROJECT_SOURCES
- FeaturesAPI_Boolean.cpp
+ FeaturesAPI_BooleanCut.cpp
+ FeaturesAPI_BooleanFuse.cpp
+ FeaturesAPI_BooleanCommon.cpp
+ FeaturesAPI_BooleanSmash.cpp
+ FeaturesAPI_BooleanFill.cpp
FeaturesAPI_Extrusion.cpp
FeaturesAPI_ExtrusionBoolean.cpp
FeaturesAPI_Fillet.cpp
%include "std_shared_ptr.i"
// shared pointers
-%shared_ptr(FeaturesAPI_Boolean)
+%shared_ptr(FeaturesAPI_BooleanCut)
+%shared_ptr(FeaturesAPI_BooleanFuse)
+%shared_ptr(FeaturesAPI_BooleanCommon)
+%shared_ptr(FeaturesAPI_BooleanSmash)
+%shared_ptr(FeaturesAPI_BooleanFill)
%shared_ptr(FeaturesAPI_Extrusion)
%shared_ptr(FeaturesAPI_ExtrusionBoolean)
%shared_ptr(FeaturesAPI_ExtrusionCut)
%shared_ptr(FeaturesAPI_Union)
// all supported interfaces
-%include "FeaturesAPI_Boolean.h"
+%include "FeaturesAPI_BooleanCut.h"
+%include "FeaturesAPI_BooleanFuse.h"
+%include "FeaturesAPI_BooleanCommon.h"
+%include "FeaturesAPI_BooleanSmash.h"
+%include "FeaturesAPI_BooleanFill.h"
%include "FeaturesAPI_Extrusion.h"
%include "FeaturesAPI_ExtrusionBoolean.h"
%include "FeaturesAPI_Fillet.h"
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 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
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "FeaturesAPI_Boolean.h"
-
-#include <ModelHighAPI_Dumper.h>
-#include <ModelHighAPI_Integer.h>
-#include <ModelHighAPI_Selection.h>
-#include <ModelHighAPI_Tools.h>
-
-//==================================================================================================
-FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
-: ModelHighAPI_Interface(theFeature)
-{
- initialize();
-}
-
-//==================================================================================================
-FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const ModelHighAPI_Integer& theBoolType,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-: ModelHighAPI_Interface(theFeature)
-{
- if(initialize()) {
- fillAttribute(theBoolType, myboolType);
- fillAttribute(theMainObjects, mymainObjects);
- fillAttribute(theToolObjects, mytoolObjects);
-
- execute(false);
- }
-}
-
-//==================================================================================================
-FeaturesAPI_Boolean::~FeaturesAPI_Boolean()
-{
-
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setBoolType(const ModelHighAPI_Integer& theBoolType)
-{
- fillAttribute(theBoolType, myboolType);
-
- execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
-{
- fillAttribute(theMainObjects, mymainObjects);
-
- execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- fillAttribute(theToolObjects, mytoolObjects);
-
- execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::dump(ModelHighAPI_Dumper& theDumper) const
-{
- FeaturePtr aBase = feature();
-
- FeaturesPlugin_Boolean::OperationType aType =
- (FeaturesPlugin_Boolean::OperationType)aBase->integer(
- FeaturesPlugin_Boolean::TYPE_ID())->value();
-
- theDumper << aBase << " = model.add";
-
- switch(aType) {
- case FeaturesPlugin_Boolean::BOOL_CUT: theDumper << "Cut"; break;
- case FeaturesPlugin_Boolean::BOOL_FUSE: theDumper << "Fuse"; break;
- case FeaturesPlugin_Boolean::BOOL_COMMON: theDumper << "Common"; break;
- case FeaturesPlugin_Boolean::BOOL_FILL: theDumper << "Fill"; break;
- case FeaturesPlugin_Boolean::BOOL_SMASH: theDumper << "Smash"; break;
- }
-
- const std::string& aDocName = theDumper.name(aBase->document());
- AttributeSelectionListPtr anObjects =
- aBase->selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
- AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
-
- theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
-}
-
-//==================================================================================================
-BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_CUT,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- std::list<ModelHighAPI_Selection> aToolObjects;
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_FUSE,
- theObjects,
- aToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_FUSE,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_COMMON,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_SMASH,
- theMainObjects,
- theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
- return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
- FeaturesPlugin_Boolean::BOOL_FILL,
- theMainObjects,
- theToolObjects));
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 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
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef FeaturesAPI_Boolean_H_
-#define FeaturesAPI_Boolean_H_
-
-#include "FeaturesAPI.h"
-
-#include <FeaturesPlugin_Boolean.h>
-
-#include <ModelHighAPI_Interface.h>
-#include <ModelHighAPI_Macro.h>
-
-class ModelHighAPI_Integer;
-class ModelHighAPI_Selection;
-
-/// \class FeaturesAPI_Boolean
-/// \ingroup CPPHighAPI
-/// \brief Interface for Boolean feature.
-class FeaturesAPI_Boolean: public ModelHighAPI_Interface
-{
-public:
- /// Constructor without values.
- FEATURESAPI_EXPORT
- explicit FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
-
- /// Constructor with values.
- FEATURESAPI_EXPORT
- FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const ModelHighAPI_Integer& theBoolType,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
- /// Destructor.
- FEATURESAPI_EXPORT
- virtual ~FeaturesAPI_Boolean();
-
- INTERFACE_3(FeaturesPlugin_Boolean::ID(),
- boolType, FeaturesPlugin_Boolean::TYPE_ID(),
- ModelAPI_AttributeInteger, /** Operation type */,
- mainObjects, FeaturesPlugin_Boolean::OBJECT_LIST_ID(),
- ModelAPI_AttributeSelectionList, /** Main objects */,
- toolObjects, FeaturesPlugin_Boolean::TOOL_LIST_ID(),
- ModelAPI_AttributeSelectionList, /** Tool objects*/)
-
- /// Set operation type.
- FEATURESAPI_EXPORT
- void setBoolType(const ModelHighAPI_Integer& theBoolType);
-
- /// Set main objects.
- FEATURESAPI_EXPORT
- void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
-
- /// Set tool objects.
- FEATURESAPI_EXPORT
- void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
-
- /// Dump wrapped feature
- FEATURESAPI_EXPORT
- virtual void dump(ModelHighAPI_Dumper& theDumper) const;
-};
-
-/// Pointer on Boolean object.
-typedef std::shared_ptr<FeaturesAPI_Boolean> BooleanPtr;
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Cut feature.
-FEATURESAPI_EXPORT
-BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fuse feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fuse feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Common feature.
-FEATURESAPI_EXPORT
-BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Smash feature.
-FEATURESAPI_EXPORT
-BooleanPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fill feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theMainObjects,
- const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-#endif // FeaturesAPI_Boolean_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanCommon.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addCommon";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
+ return BooleanCommonPtr(new FeaturesAPI_BooleanCommon(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanCommon_H_
+#define FeaturesAPI_BooleanCommon_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanCommon.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanCommon
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Common feature.
+class FeaturesAPI_BooleanCommon: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanCommon();
+
+ INTERFACE_2(FeaturesPlugin_BooleanCommon::ID(),
+ mainObjects, FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanCommon::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanCommon> BooleanCommonPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Common feature.
+FEATURESAPI_EXPORT
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanCommon_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanCut.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addCut";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID());
+ return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanCut_H_
+#define FeaturesAPI_BooleanCut_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanCut.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanCut
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Cut feature.
+class FeaturesAPI_BooleanCut: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanCut();
+
+ INTERFACE_2(FeaturesPlugin_BooleanCut::ID(),
+ mainObjects, FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanCut::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanCut> BooleanCutPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Cut feature.
+FEATURESAPI_EXPORT
+BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanCut_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanFill.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addFill";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID());
+ return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanFill_H_
+#define FeaturesAPI_BooleanFill_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanFill.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanFill
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Fill feature.
+class FeaturesAPI_BooleanFill: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanFill();
+
+ INTERFACE_2(FeaturesPlugin_BooleanFill::ID(),
+ mainObjects, FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanFill::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanFill> BooleanFillPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fill feature.
+FEATURESAPI_EXPORT
+BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanFill_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanFuse.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addFuse";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanFuse::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
+ std::list<ModelHighAPI_Selection> aToolObjects;
+ return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature,
+ theObjects,
+ aToolObjects));
+}
+
+//==================================================================================================
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
+ return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanFuse_H_
+#define FeaturesAPI_BooleanFuse_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanFuse.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanFuse
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Fuse feature.
+class FeaturesAPI_BooleanFuse: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanFuse();
+
+ INTERFACE_2(FeaturesPlugin_BooleanFuse::ID(),
+ mainObjects, FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanFuse::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanFuse> BooleanFusePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanFuse_H_
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanSmash.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute(false);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setToolObjects(
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+
+ theDumper << aBase << " = model.addSmash";
+
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID());
+ AttributeSelectionListPtr aTools =
+ aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID());
+
+ theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanSmash::ID());
+ return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanSmash_H_
+#define FeaturesAPI_BooleanSmash_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanSmash.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanSmash
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Smash feature.
+class FeaturesAPI_BooleanSmash: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_BooleanSmash();
+
+ INTERFACE_2(FeaturesPlugin_BooleanSmash::ID(),
+ mainObjects, FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_BooleanSmash::TOOL_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanSmash> BooleanSmashPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Smash feature.
+FEATURESAPI_EXPORT
+BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanSmash_H_
#include <ModelHighAPI_swig.h>
#include "FeaturesAPI.h"
- #include "FeaturesAPI_Boolean.h"
+ #include "FeaturesAPI_BooleanCut.h"
+ #include "FeaturesAPI_BooleanFuse.h"
+ #include "FeaturesAPI_BooleanCommon.h"
+ #include "FeaturesAPI_BooleanSmash.h"
+ #include "FeaturesAPI_BooleanFill.h"
#include "FeaturesAPI_Extrusion.h"
#include "FeaturesAPI_ExtrusionBoolean.h"
#include "FeaturesAPI_Fillet.h"
FeaturesPlugin_Rotation.h
FeaturesPlugin_Translation.h
FeaturesPlugin_Boolean.h
+ FeaturesPlugin_BooleanCut.h
+ FeaturesPlugin_BooleanFuse.h
+ FeaturesPlugin_BooleanCommon.h
+ FeaturesPlugin_BooleanSmash.h
+ FeaturesPlugin_BooleanFill.h
FeaturesPlugin_Intersection.h
FeaturesPlugin_Partition.h
FeaturesPlugin_Pipe.h
#include <map>
//=================================================================================================
-FeaturesPlugin_Boolean::FeaturesPlugin_Boolean()
+FeaturesPlugin_Boolean::FeaturesPlugin_Boolean(const OperationType theOperationType)
+: myOperationType(theOperationType)
{
}
//=================================================================================================
void FeaturesPlugin_Boolean::initAttributes()
{
- data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
-
AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
}
//=================================================================================================
-void FeaturesPlugin_Boolean::execute()
+FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType()
{
- // Getting operation type.
- std::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = std::dynamic_pointer_cast<
- ModelAPI_AttributeInteger>(data()->attribute(FeaturesPlugin_Boolean::TYPE_ID()));
- if (!aTypeAttr)
- return;
- OperationType aType = (FeaturesPlugin_Boolean::OperationType)aTypeAttr->value();
+ return myOperationType;
+}
+//=================================================================================================
+void FeaturesPlugin_Boolean::execute()
+{
ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
aCompSolidsObjects[aContextShape].push_back(anObject);
}
} else {
- if(aType != BOOL_FILL
+ if(myOperationType != BOOL_FILL
&& (anObject->shapeType() == GeomAPI_Shape::EDGE
|| anObject->shapeType() == GeomAPI_Shape::FACE))
{
ResultPtr aContext = aToolAttr->context();
aPlanes.push_back(aToolAttr->context()->shape());
}
- else if(aType != BOOL_FILL
+ else if (myOperationType != BOOL_FILL
&& (aTool->shapeType() == GeomAPI_Shape::EDGE
|| aTool->shapeType() == GeomAPI_Shape::FACE))
{
int aResultIndex = 0;
- switch(aType) {
+ switch(myOperationType) {
case BOOL_CUT:
case BOOL_COMMON:
case BOOL_FILL: {
std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
GeomShapePtr aResShape;
- switch(aType) {
+ switch(myOperationType) {
case BOOL_CUT: {
aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
aTools,
aMakeShapeList.appendAlgo(aBoolAlgo);
if(GeomAlgoAPI_ShapeTools::volume(aResShape) > 1.e-27
- || (aType != BOOL_CUT && aType != BOOL_COMMON))
+ || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
{
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
ListOfShape aUsedTools = aTools;
- if (aType == BOOL_FILL) {
+ if (myOperationType == BOOL_FILL) {
aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
}
loadNamingDS(aResultBody, anObject, aUsedTools, aResShape,
- aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()), aType == BOOL_FILL);
+ aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()),
+ myOperationType == BOOL_FILL);
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
GeomAlgoAPI_MakeShapeList aMakeShapeList;
std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
- switch(aType) {
+ switch(myOperationType) {
case BOOL_CUT: {
aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
aTools,
}
if(GeomAlgoAPI_ShapeTools::volume(aResultShape) > 1.e-27
- || (aType != BOOL_CUT && aType != BOOL_COMMON))
+ || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
{
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
ListOfShape aUsedTools = aTools;
- if (aType == BOOL_FILL) {
+ if (myOperationType == BOOL_FILL) {
aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
}
aResultShape,
aMakeShapeList,
aMapOfShapes,
- aType == BOOL_FILL);
+ myOperationType == BOOL_FILL);
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
//
-#ifndef FeaturesPlugin_Cut_H_
-#define FeaturesPlugin_Cut_H_
+#ifndef FeaturesPlugin_Boolean_H_
+#define FeaturesPlugin_Boolean_H_
#include "FeaturesPlugin.h"
BOOL_SMASH
};
- /// Feature kind.
- inline static const std::string& ID()
- {
- static const std::string MY_ID("Boolean");
- return MY_ID;
- }
-
/// Attribute name of main objects.
inline static const std::string& OBJECT_LIST_ID()
{
return MY_TOOL_LIST_ID;
}
- /// Attribute name of operation type.
- inline static const std::string& TYPE_ID()
- {
- static const std::string MY_TYPE_ID("bool_type");
- return MY_TYPE_ID;
- }
-
- /// \return the kind of a feature.
- FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
- {
- static std::string MY_KIND = FeaturesPlugin_Boolean::ID();
- return MY_KIND;
- }
+ /// \return boolean operation type.
+ FEATURESPLUGIN_EXPORT OperationType operationType();
/// Creates a new part document if needed.
FEATURESPLUGIN_EXPORT virtual void execute();
/// Request for initialization of data model of the feature: adding all attributes.
FEATURESPLUGIN_EXPORT virtual void initAttributes();
+protected:
+
/// Use plugin manager for features creation.
- FeaturesPlugin_Boolean();
+ FeaturesPlugin_Boolean(const OperationType theOperationType);
private:
std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
GeomAlgoAPI_MakeShape& theMakeShape,
GeomAPI_DataMapOfShapeShape& theMapOfShapes,
const bool theIsStoreAsGenerated = false);
+
+private:
+ OperationType myOperationType;
};
#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanCommon_H_
+#define FeaturesPlugin_BooleanCommon_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanCommon
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Common operation.
+class FeaturesPlugin_BooleanCommon : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Common");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanCommon::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanCommon(): FeaturesPlugin_Boolean(BOOL_COMMON) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanCut_H_
+#define FeaturesPlugin_BooleanCut_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanCut
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Cut operation.
+class FeaturesPlugin_BooleanCut : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Cut");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanCut::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanCut(): FeaturesPlugin_Boolean(BOOL_CUT) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanFill_H_
+#define FeaturesPlugin_BooleanFill_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanFill
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Fill operation.
+class FeaturesPlugin_BooleanFill : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Fill");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanFill::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanFill(): FeaturesPlugin_Boolean(BOOL_FILL) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanFuse_H_
+#define FeaturesPlugin_BooleanFuse_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanFuse
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Fuse operation.
+class FeaturesPlugin_BooleanFuse : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Fuse");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanFuse::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanFuse(): FeaturesPlugin_Boolean(BOOL_FUSE) {};
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 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
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanSmash_H_
+#define FeaturesPlugin_BooleanSmash_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanSmash
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Smash operation.
+class FeaturesPlugin_BooleanSmash : public FeaturesPlugin_Boolean
+{
+public:
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Smash");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_BooleanSmash::ID();
+ return MY_KIND;
+ }
+
+public:
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_BooleanSmash(): FeaturesPlugin_Boolean(BOOL_SMASH) {};
+
+};
+
+#endif
#include <FeaturesPlugin_Plugin.h>
-#include <FeaturesPlugin_Boolean.h>
+#include <FeaturesPlugin_BooleanCut.h>
+#include <FeaturesPlugin_BooleanFuse.h>
+#include <FeaturesPlugin_BooleanCommon.h>
+#include <FeaturesPlugin_BooleanSmash.h>
+#include <FeaturesPlugin_BooleanFill.h>
#include <FeaturesPlugin_Extrusion.h>
#include <FeaturesPlugin_ExtrusionCut.h>
#include <FeaturesPlugin_ExtrusionFuse.h>
new FeaturesPlugin_ValidatorFilletSelection);
aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
new FeaturesPlugin_ValidatorCircular);
+ aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments",
+ new FeaturesPlugin_ValidatorBooleanArguments);
// register this plugin
ModelAPI_Session::get()->registerPlugin(this);
return FeaturePtr(new FeaturesPlugin_Rotation);
} else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
return FeaturePtr(new FeaturesPlugin_Translation);
- } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
- return FeaturePtr(new FeaturesPlugin_Boolean);
+ } else if (theFeatureID == FeaturesPlugin_BooleanCut::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanCut);
+ } else if (theFeatureID == FeaturesPlugin_BooleanFuse::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanFuse);
+ } else if (theFeatureID == FeaturesPlugin_BooleanCommon::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanCommon);
+ } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanSmash);
+ } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID()) {
+ return FeaturePtr(new FeaturesPlugin_BooleanFill);
} else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
return FeaturePtr(new FeaturesPlugin_Intersection);
} else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
"Error: This validator can only work with selection list attributes in \"Boolean\" feature.";
return false;
}
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- int anOperationType = aFeature->integer("bool_type")->value();
+ std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
+ std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theAttribute->owner());
+ FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType();
for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) {
AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex);
}
return isValid;
}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorBooleanArguments::isValid(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<std::string>& theArguments,
+ Events_InfoMessage& theError) const
+{
+ if (theArguments.size() != 2)
+ {
+ theError = "Wrong number of arguments (expected 2).";
+ return false;
+ }
+
+ int anObjectsNb = 0, aToolsNb = 0;
+ //int anOperationType = 0;
+
+ std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
+
+ bool isAllInSameCompSolid = true;
+ ResultCompSolidPtr aCompSolid;
+
+ AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
+ if (anAttrSelList)
+ {
+ anObjectsNb = anAttrSelList->size();
+ for (int anIndex = 0; anIndex < anObjectsNb; ++anIndex)
+ {
+ AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+ ResultPtr aContext = anAttr->context();
+ ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ if (aResCompSolidPtr.get())
+ {
+ if (aCompSolid.get())
+ {
+ isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+ }
+ else
+ {
+ aCompSolid = aResCompSolidPtr;
+ }
+ }
+ else
+ {
+ isAllInSameCompSolid = false;
+ break;
+ }
+ }
+ }
+ anIt++;
+
+
+ anAttrSelList = theFeature->selectionList(*anIt);
+ if (anAttrSelList)
+ {
+ aToolsNb = anAttrSelList->size();
+ if (isAllInSameCompSolid)
+ {
+ for (int anIndex = 0; anIndex < aToolsNb; ++anIndex)
+ {
+ AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+ ResultPtr aContext = anAttr->context();
+ ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+ if (aResCompSolidPtr.get())
+ {
+ if (aCompSolid.get())
+ {
+ isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+ }
+ else
+ {
+ aCompSolid = aResCompSolidPtr;
+ }
+ }
+ else
+ {
+ isAllInSameCompSolid = false;
+ break;
+ }
+ }
+ }
+ }
+ anIt++;
+
+ std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
+ std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theFeature);
+ FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType();
+
+ if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE)
+ {
+ // Fuse operation
+ if (anObjectsNb + aToolsNb < 2)
+ {
+ theError = "Not enough arguments for Fuse operation.";
+ return false;
+ }
+ else if (isAllInSameCompSolid)
+ {
+ theError = "Operations only between sub-shapes of the same shape not allowed.";
+ return false;
+ }
+ }
+ else
+ {
+ if (anObjectsNb < 1)
+ {
+ theError = "Objects not selected.";
+ return false;
+ }
+ if (aToolsNb < 1)
+ {
+ theError = "Tools not selected.";
+ return false;
+ }
+ if (isAllInSameCompSolid)
+ {
+ theError = "Operations only between sub-shapes of the same shape not allowed.";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory(std::string theFeature,
+ std::string theAttribute)
+{
+ if (theAttribute == "main_objects" || theAttribute == "tool_objects")
+ {
+ return true;
+ }
+
+ return false;
+}
Events_InfoMessage& theError) const;
};
+/** \class FeaturesPlugin_ValidatorBooleanArguments
+* \ingroup Validators
+* \brief Validates that boolean operation have enough arguments.
+*/
+class FeaturesPlugin_ValidatorBooleanArguments: public ModelAPI_FeatureValidator
+{
+public:
+ /** \brief Returns true if feature and/or attributes are valid.
+ * \param[in] theFeature the validated feature.
+ * \param[in] theArguments the arguments in the configuration file for this validator.
+ * \param[out] theError error message.
+ * \returns true if feature is valid.
+ */
+ virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<std::string>& theArguments,
+ Events_InfoMessage& theError) const;
+
+ /// \return true if the attribute in feature is not obligatory for the feature execution.
+ virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
+};
+
#endif
model.do()
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Boolean_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Smash_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
model.do()
model.end()
model.do()
Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
-Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Boolean_1_1"), model.selection("SOLID", "Boolean_1_2")])
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
# skip 3 vertices, limitation
-Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Boolean_2_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Boolean_1_2/Modified_Face_2&Boolean_1_2/Modified_Face_1"), model.selection("VERTEX", "Boolean_1_1/Modified_Face_2&Boolean_1_1/Modified_Face_1")]
+Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("VERTEX", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
# skip 3 edges, limitation
-Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "Boolean_1_2/Modified_Face_2&Boolean_1_2/Modified_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&Boolean_1_2/Modified_Face_2"), model.selection("EDGE", "Boolean_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Boolean_1_1/Modified_Edge_1"), model.selection("EDGE", "Boolean_1_1/Modified_Face_2&Boolean_1_1/Modified_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&Boolean_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
+Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_2/Modified_Face_2"), model.selection("EDGE", "Common_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Common_1_1/Modified_Edge_1"), model.selection("EDGE", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
-Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Boolean_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Boolean_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Boolean_2_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Boolean_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Boolean_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
+Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Common_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Common_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Cut_1_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Common_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Common_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
model.end()
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.result())
Extrusion_1.setNestedSketch(Sketch_2)
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Boolean_1_1_2/Modified_Face_3&Boolean_1_1_2/Modified_Face_2&Boolean_1_1_2/Modified_Face_1"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Fill_1_1_2/Modified_Face_3&Fill_1_1_2/Modified_Face_2&Fill_1_1_2/Modified_Face_1"))
Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True)
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True)
Plane_5.result().setName("Plane_2 arrivee tuyau")
Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), 45)
Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"), "90+45")
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_1_1_1")], [model.selection("FACE", "Plane_5")])
-Boolean_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_2_1_2")], [model.selection("FACE", "Plane_3")])
-Boolean_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_3_1_2")], [model.selection("FACE", "Plane_4")])
-Boolean_4.result().setColor(102, 51, 51)
-Boolean_4.result().subResult(0).setColor(153, 153, 76)
-Boolean_4.result().subResult(1).setColor(0, 204, 204)
-Boolean_4.result().subResult(2).setColor(51, 51, 102)
-Boolean_4.result().subResult(3).setColor(102, 204, 102)
-Boolean_4.result().subResult(4).setColor(204, 204, 0)
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")])
+Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")])
+Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")])
+Fill_4.result().setColor(102, 51, 51)
+Fill_4.result().subResult(0).setColor(153, 153, 76)
+Fill_4.result().subResult(1).setColor(0, 204, 204)
+Fill_4.result().subResult(2).setColor(51, 51, 102)
+Fill_4.result().subResult(3).setColor(102, 204, 102)
+Fill_4.result().subResult(4).setColor(204, 204, 0)
-Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Boolean_4_1_4"), model.selection("SOLID", "Boolean_4_1_2")])
+Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Fill_4_1_4"), model.selection("SOLID", "Fill_4_1_2")])
Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau"))
Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_18"), 0, 180)
-Boolean_5 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
-Boolean_5.result().setName("demi-sphere")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
+Cut_1.result().setName("demi-sphere")
Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/From_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_10&Extrusion_2_1/To_Face_4"))
Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_12&Extrusion_2_1/Generated_Face_11&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/From_Face_1"))
Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/From_Face_3"))
Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/From_Face_4"))
-Recover_1 = model.addRecover(Part_1_doc, Boolean_5, [Extrusion_3.result()])
+Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()])
Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape4"), model.selection("EDGE", "Recover_1_1/Shape4&Recover_1_1/Shape6"), "90+45")
Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape1"), model.selection("EDGE", "Recover_1_1/Shape1&Recover_1_1/Shape6"), "90+45")
Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape2"), model.selection("EDGE", "Recover_1_1/Shape2&Recover_1_1/Shape6"), "90+45")
Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape6"), model.selection("EDGE", "Recover_1_1/Shape3&Recover_1_1/Shape6"), 45)
-Boolean_6_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
-Boolean_6 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Boolean_6_objects_2)
+Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
+Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2)
-Union_2_objects = [model.selection("SOLID", "Boolean_6_1_16"), model.selection("SOLID", "Boolean_6_1_13"), model.selection("SOLID", "Boolean_6_1_14")]
+Union_2_objects = [model.selection("SOLID", "Fill_5_1_16"), model.selection("SOLID", "Fill_5_1_13"), model.selection("SOLID", "Fill_5_1_14")]
Union_2 = model.addUnion(Part_1_doc, Union_2_objects)
-Union_3_objects = [model.selection("SOLID", "Boolean_6_1_10/Boolean_6_1_10"), model.selection("SOLID", "Boolean_6_1_3/Boolean_6_1_3"), model.selection("SOLID", "Boolean_6_1_5/Boolean_6_1_5"), model.selection("SOLID", "Boolean_6_1_11/Boolean_6_1_11")]
+Union_3_objects = [model.selection("SOLID", "Fill_5_1_10/Fill_5_1_10"), model.selection("SOLID", "Fill_5_1_3/Fill_5_1_3"), model.selection("SOLID", "Fill_5_1_5/Fill_5_1_5"), model.selection("SOLID", "Fill_5_1_11/Fill_5_1_11")]
Union_3 = model.addUnion(Part_1_doc, Union_3_objects)
-Union_4_objects = [model.selection("SOLID", "Boolean_6_1_12/Boolean_6_1_12"), model.selection("SOLID", "Boolean_6_1_6/Boolean_6_1_6"), model.selection("SOLID", "Boolean_6_1_4/Boolean_6_1_4")]
+Union_4_objects = [model.selection("SOLID", "Fill_5_1_12/Fill_5_1_12"), model.selection("SOLID", "Fill_5_1_6/Fill_5_1_6"), model.selection("SOLID", "Fill_5_1_4/Fill_5_1_4")]
Union_4 = model.addUnion(Part_1_doc, Union_4_objects)
-Union_5_objects = [model.selection("SOLID", "Boolean_6_1_2/Boolean_6_1_2"), model.selection("SOLID", "Boolean_6_1_1/Boolean_6_1_1"), model.selection("SOLID", "Boolean_6_1_7/Boolean_6_1_7")]
+Union_5_objects = [model.selection("SOLID", "Fill_5_1_2/Fill_5_1_2"), model.selection("SOLID", "Fill_5_1_1/Fill_5_1_1"), model.selection("SOLID", "Fill_5_1_7/Fill_5_1_7")]
Union_5 = model.addUnion(Part_1_doc, Union_5_objects)
-Union_6_objects = [model.selection("SOLID", "Boolean_6_1_8/Boolean_6_1_8"), model.selection("SOLID", "Boolean_6_1_9/Boolean_6_1_9"), model.selection("SOLID", "Boolean_6_1_15/Boolean_6_1_15")]
+Union_6_objects = [model.selection("SOLID", "Fill_5_1_8/Fill_5_1_8"), model.selection("SOLID", "Fill_5_1_9/Fill_5_1_9"), model.selection("SOLID", "Fill_5_1_15/Fill_5_1_15")]
Union_6 = model.addUnion(Part_1_doc, Union_6_objects)
Union_6.result().setColor(0, 0, 204)
Union_6.result().subResult(0).setColor(204, 102, 102)
# Create a pacman as boolean cut of the prism from the cylinder
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-kBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
aBooleanFt.execute()
aSession.finishOperation()
# Create a pacman as boolean cut of the prism from the cylinder
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None)
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None)
-aBooleanType = 0
-aBooleanFt.integer("bool_type").setValue(aBooleanType)
aBooleanFt.execute()
aSession.finishOperation()
# Fuse
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Fuse")
aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None)
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None)
-aBooleanType = 1
-aBooleanFt.integer("bool_type").setValue(aBooleanType)
aBooleanFt.execute()
aSession.finishOperation()
# Smash prism into the cylinder
#=========================================================================
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Smash")
aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-kBooleanTypeSmash = 3
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeSmash)
aBooleanFt.execute()
aSession.finishOperation()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Boolean_1_1")], [model.selection("SOLID", "Box_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
model.checkBooleansResult(Boolean_2, model, 1, [6], [0], [6], [22], [44])
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Boolean_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
model.do()
model.checkBooleansResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
- anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+ anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
# v1.0.2 from master
# anExtrusionFt.selection("extrusion_face").setValue(
# aSketchResult, aSketchFaces[0])
aCurrentResult = modelAPI_ResultBody(aBox.firstResult())
aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
for i in xrange(0, N * N):
anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
-kBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
aBooleanFt.execute()
aFactory = ModelAPI_Session.get().validators()
assert (aFactory.validate(aBooleanFt))
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
- anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+ anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
# v1.0.2 from master
# anExtrusionFt.selection("extrusion_face").setValue(
# aSketchResult, aSketchFaces[0])
aFactory = ModelAPI_Session.get().validators()
for i in xrange(0, N * N):
anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
- aBooleanFt = aPart.addFeature("Boolean")
+ aBooleanFt = aPart.addFeature("Cut")
aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
- kBooleanTypeCut = 0
- aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
aBooleanFt.execute()
assert (aFactory.validate(aBooleanFt))
assert (len(aBooleanFt.results()) > 0)
-->
<source>
- <module_choice id="bool_type"
- widget_type="radiobuttons"
- buttons_dir="horizontal"
- label="Operation type"
- tooltip="Type of boolean operation"
- string_list="Cut Fuse Common Fill Smash"
- use_in_title="true"
- icons_list="icons/Features/bool_cut.png icons/Features/bool_fuse.png icons/Features/bool_common.png icons/Features/bool_fill.png icons/Features/bool_smash.png"
- default="0"
- />
<multi_selector id="main_objects"
label="Main objects"
icon=""
<validator id="PartSet_DifferentObjects"/>
<validator id="FeaturesPlugin_ValidatorBooleanSelection"/>
</multi_selector>
- <validator id="GeomValidators_BooleanArguments" parameters="main_objects,tool_objects,bool_type"/>
+ <validator id="FeaturesPlugin_ValidatorBooleanArguments" parameters="main_objects,tool_objects"/>
</source>
</feature>
</group>
<group id="Boolean">
- <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with objects" icon="icons/Features/cut.png"
+ <feature id="Cut" title="Cut" tooltip="Perform boolean cut operation with objects" icon="icons/Features/bool_cut.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ <feature id="Fuse" title="Fuse" tooltip="Perform boolean fuse operation with objects" icon="icons/Features/bool_fuse.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ <feature id="Common" title="Common" tooltip="Perform boolean common operation with objects" icon="icons/Features/bool_common.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
+ <feature id="Smash" title="Smash" tooltip="Perform boolean smash operation with objects" icon="icons/Features/bool_smash.png"
auto_preview="false">
<source path="boolean_widget.xml"/>
</feature>
auto_preview="false">
<source path="partition_widget.xml"/>
</feature>
+ <feature id="Fill" title="Fill" tooltip="Perform boolean fill operation with objects" icon="icons/Features/bool_fill.png"
+ auto_preview="false">
+ <source path="boolean_widget.xml"/>
+ </feature>
<feature id="Union" title="Union" tooltip="Perform union operations with shapes" icon="icons/Features/union.png">
<source path="union_widget.xml"/>
</feature>
SET(PROJECT_HEADERS
GeomValidators.h
GeomValidators_BodyShapes.h
- GeomValidators_BooleanArguments.h
GeomValidators_ConstructionComposite.h
GeomValidators_DifferentShapes.h
GeomValidators_Face.h
SET(PROJECT_SOURCES
GeomValidators_BodyShapes.cpp
- GeomValidators_BooleanArguments.cpp
GeomValidators_ConstructionComposite.cpp
GeomValidators_DifferentShapes.cpp
GeomValidators_Face.cpp
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 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
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_BooleanArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeInteger.h>
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_ResultCompSolid.h>
-#include <ModelAPI_Tools.h>
-
-//=================================================================================================
-bool GeomValidators_BooleanArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const
-{
- if(theArguments.size() != 3) {
- theError = "Wrong number of arguments (expected 3).";
- return false;
- }
-
- int anObjectsNb = 0, aToolsNb = 0;
- int anOperationType = 0;
-
- std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
- bool isAllInSameCompSolid = true;
- ResultCompSolidPtr aCompSolid;
-
- AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- anObjectsNb = anAttrSelList->size();
- for(int anIndex = 0; anIndex < anObjectsNb; ++anIndex) {
- AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
- ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
- if(aResCompSolidPtr.get()) {
- if(aCompSolid.get()) {
- isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
- } else {
- aCompSolid = aResCompSolidPtr;
- }
- } else {
- isAllInSameCompSolid = false;
- break;
- }
- }
- }
- anIt++;
-
-
- anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- aToolsNb = anAttrSelList->size();
- if(isAllInSameCompSolid) {
- for(int anIndex = 0; anIndex < aToolsNb; ++anIndex) {
- AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
- ResultPtr aContext = anAttr->context();
- ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
- if(aResCompSolidPtr.get()) {
- if(aCompSolid.get()) {
- isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
- } else {
- aCompSolid = aResCompSolidPtr;
- }
- } else {
- isAllInSameCompSolid = false;
- break;
- }
- }
- }
- }
- anIt++;
-
- std::shared_ptr<ModelAPI_AttributeInteger> anAttrInt = theFeature->integer(*anIt);
- if(anAttrInt) {
- anOperationType = anAttrInt->value();
- }
-
- if(anOperationType == 1) {
- // Fuse operation
- if(anObjectsNb + aToolsNb < 2) {
- theError = "Not enough arguments for Fuse operation.";
- return false;
- } else if(isAllInSameCompSolid) {
- theError = "Operations only between sub-shapes of the same shape not allowed.";
- return false;
- }
- } else {
- if(anObjectsNb < 1) {
- theError = "Objects not selected.";
- return false;
- }
- if(aToolsNb < 1) {
- theError = "Tools not selected.";
- return false;
- }
- if(isAllInSameCompSolid) {
- theError = "Operations only between sub-shapes of the same shape not allowed.";
- return false;
- }
- }
-
- return true;
-}
-
-//=================================================================================================
-bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature,
- std::string theAttribute)
-{
- if(theAttribute == "main_objects" || theAttribute == "tool_objects") {
- return true;
- }
-
- return false;
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 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
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_BooleanArguments_H
-#define GeomValidators_BooleanArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_BooleanArguments
- * \ingroup Validators
- * \brief Validates that boolean operation have enough arguments.
- */
-class GeomValidators_BooleanArguments : public ModelAPI_FeatureValidator
-{
-public:
- /** \brief Returns true if feature and/or attributes are valid.
- * \param[in] theFeature the validated feature.
- * \param[in] theArguments the arguments in the configuration file for this validator.
- * \param[out] theError error message.
- * \returns true if feature is valid.
- */
- GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const;
-
- /// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
- bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
#include <GeomValidators_Plugin.h>
#include <GeomValidators_BodyShapes.h>
-#include <GeomValidators_BooleanArguments.h>
#include <GeomValidators_ConstructionComposite.h>
#include <GeomValidators_Different.h>
#include <GeomValidators_DifferentShapes.h>
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
aFactory->registerValidator("GeomValidators_BodyShapes", new GeomValidators_BodyShapes);
- aFactory->registerValidator("GeomValidators_BooleanArguments",
- new GeomValidators_BooleanArguments);
aFactory->registerValidator("GeomValidators_ConstructionComposite",
new GeomValidators_ConstructionComposite);
aFactory->registerValidator("GeomValidators_Different", new GeomValidators_Different);
# Do cut a hole from a box
#=========================================================================
aSession.startOperation()
-aCut1 = aPart.addFeature("Boolean")
+aCut1 = aPart.addFeature("Cut")
aCut1.selectionList("main_objects").append(aBox.firstResult(), None)
aCut1.selectionList("tool_objects").append(aHoleExt.firstResult(), None)
-aCut1.integer("bool_type").setValue(0) # cut
aSession.finishOperation()
#=========================================================================
# Do fuse with a tower. Tower must be an argument (not tool) to add the problem to the faces owners detection.
#=========================================================================
aSession.startOperation()
-aFuse = aPart.addFeature("Boolean")
+aFuse = aPart.addFeature("Fuse")
aFuse.selectionList("main_objects").append(aTower.firstResult(), None)
aFuse.selectionList("tool_objects").append(aCut1.firstResult(), None)
-aFuse.integer("bool_type").setValue(1) # fuse
aSession.finishOperation()
#=========================================================================
# check faces
check_owner("Extrusion_1_1/Generated_Face_1", "face", aBox)
-check_owner("Boolean_2_1/Modified_Face_3", "face", aBox)
-check_owner("Boolean_1_1/Modified_Face_1", "face", aHoleExt)
-check_owner("Boolean_2_1/Modified_Face_1", "face", aTower)
+check_owner("Fuse_1_1/Modified_Face_3", "face", aBox)
+check_owner("Cut_1_1/Modified_Face_1", "face", aHoleExt)
+check_owner("Fuse_1_1/Modified_Face_1", "face", aTower)
# check edges without ambiguity
-check_owner("Boolean_2_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
-check_owner("Boolean_2_1/Modified_Face_1&Extrusion_3_1/To_Face_1_1", "edge", aTower)
+check_owner("Fuse_1_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
+check_owner("Fuse_1_1/Modified_Face_1&Extrusion_3_1/To_Face_1_1", "edge", aTower)
# check the connected topology method: solid is not a compound of connected topology
assert(aFuse.firstResult().shape().isConnectedTopology() == False)
Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1")])
Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face_1"), 0, model.selection(), 0)
Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Boolean_1_1"), model.selection("SOLID", "Boolean_2_1"), model.selection("FACE", "Face_1_1")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")])
Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
Remove_SubShapes_1.setSubShapesToKeep([model.selection("COMPSOLID", "Partition_1_1_1")])
model.end()