@SET OCC_LIB_PREFIX=d
call env_Salome.bat d
+rem Variable which is necessary for launching SALOME
+SET SALOME_PLEASE_SETUP_ENVIRONMENT_AS_BEFORE=1
+
@SET SHAPER_ROOT_DIR=%ROOT_DIR%\install
@SET SalomeAppConfig=%SHAPER_ROOT_DIR%\share\salome\resources\shaper;%GUI_ROOT_DIR%\share\salome\resources\gui
call env_Salome.bat
+rem Variable which is necessary for launching SALOME
+SET SALOME_PLEASE_SETUP_ENVIRONMENT_AS_BEFORE=1
+
@SET SHAPER_ROOT_DIR=%ROOT_DIR%\install
@SET SalomeAppConfig=%SHAPER_ROOT_DIR%\share\salome\resources\shaper;%GUI_ROOT_DIR%\share\salome\resources\gui
ShortcutTree,
BiColor,
Background,
- Directory
+ Directory,
+ Cursor
+ };
+
+ enum CursorType
+ {
+ ArrowCursor,
+ CrossCursor,
+ HandCursor
};
/**
Config_Prop::DblSpin, "1.0");
Config_PropManager::registerProp(SKETCH_TAB_NAME, "rotate_to_plane",
"Rotate to plane when selected", Config_Prop::Boolean, "false");
+ Config_PropManager::registerProp(SKETCH_TAB_NAME, "operation_cursor",
+ "Cursor for Sketch operation", Config_Prop::Cursor, "0");
// register this plugin
ModelAPI_Session::get()->registerPlugin(this);
FeaturesAPI_Union.h
FeaturesAPI_FusionFaces.h
FeaturesAPI_Copy.h
+ FeaturesAPI_ImportResult.h
)
SET(PROJECT_SOURCES
FeaturesAPI_Union.cpp
FeaturesAPI_FusionFaces.cpp
FeaturesAPI_Copy.cpp
+ FeaturesAPI_ImportResult.cpp
)
SET(PROJECT_LIBRARIES
%shared_ptr(FeaturesAPI_FusionFaces)
%shared_ptr(FeaturesAPI_RemoveResults)
%shared_ptr(FeaturesAPI_Copy)
+%shared_ptr(FeaturesAPI_ImportResult)
%typecheck(SWIG_TYPECHECK_POINTER) std::pair<std::list<ModelHighAPI_Selection>, bool>, const std::pair<std::list<ModelHighAPI_Selection>, bool> & {
%include "FeaturesAPI_FusionFaces.h"
%include "FeaturesAPI_RemoveResults.h"
%include "FeaturesAPI_Copy.h"
+%include "FeaturesAPI_ImportResult.h"
FEATURESAPI_EXPORT
explicit FeaturesAPI_Copy(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<ModelHighAPI_Selection>& theBaseObjects,
- const int theVersion = 0);
+ const int theNumber);
/// Destructor.
FEATURESAPI_EXPORT virtual ~FeaturesAPI_Copy();
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#include "FeaturesAPI_ImportResult.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Tools.h>
+
+//================================================================================================
+FeaturesAPI_ImportResult::FeaturesAPI_ImportResult(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature) : ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//================================================================================================
+FeaturesAPI_ImportResult::FeaturesAPI_ImportResult(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects) : ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setObjects(theObjects);
+ }
+}
+
+//=================================================================================================
+FeaturesAPI_ImportResult::~FeaturesAPI_ImportResult() {}
+
+//=================================================================================================
+void FeaturesAPI_ImportResult::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ fillAttribute(theObjects, myobjects);
+ execute();
+}
+
+//=================================================================================================
+void FeaturesAPI_ImportResult::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+ AttributeSelectionListPtr anObjects =
+ aBase->selectionList(FeaturesPlugin_ImportResult::OBJECTS());
+
+ theDumper << aBase << " = model.addImportResult("
+ << aDocName << ", " << anObjects << ")" << std::endl;
+}
+
+//=================================================================================================
+ImportResultPtr addImportResult(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_ImportResult::ID());
+ return ImportResultPtr(new FeaturesAPI_ImportResult(aFeature, theObjects));
+}
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#ifndef FeaturesAPI_ImportResult_H_
+#define FeaturesAPI_ImportResult_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_ImportResult.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Dumper;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_ImportResult
+/// \ingroup CPPHighAPI
+/// \brief Interface for ImportResult feature.
+class FeaturesAPI_ImportResult: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ImportResult(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ImportResult(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT virtual ~FeaturesAPI_ImportResult();
+
+ INTERFACE_1(FeaturesPlugin_ImportResult::ID(),
+ objects, FeaturesPlugin_ImportResult::OBJECTS(),
+ ModelAPI_AttributeSelectionList, /** Source objects */)
+
+ /// Modify objects attribute of the feature.
+ FEATURESAPI_EXPORT void setObjects(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on ImportResult object.
+typedef std::shared_ptr<FeaturesAPI_ImportResult> ImportResultPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create ImportResult feature.
+FEATURESAPI_EXPORT
+ImportResultPtr addImportResult(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects);
+
+#endif // FeaturesAPI_ImportResult_H_
#include "FeaturesAPI_FusionFaces.h"
#include "FeaturesAPI_RemoveResults.h"
#include "FeaturesAPI_Copy.h"
+ #include "FeaturesAPI_ImportResult.h"
#endif // FeaturesAPI_swig_H_
FeaturesPlugin_RemoveResults.h
FeaturesPlugin_Chamfer.h
FeaturesPlugin_Copy.h
+ FeaturesPlugin_ImportResult.h
)
SET(PROJECT_SOURCES
FeaturesPlugin_RemoveResults.cpp
FeaturesPlugin_Chamfer.cpp
FeaturesPlugin_Copy.cpp
+ FeaturesPlugin_ImportResult.cpp
)
SET(XML_RESOURCES
fusion_faces_widget.xml
chamfer_widget.xml
copy_widget.xml
+ import_result_widget.xml
)
SET(TEXT_RESOURCES
TestCopyNames.py
TestCopySubShapes.py
TestCopyWholeFeature.py
+ TestImportResult.py
)
--- /dev/null
+// Copyright (C) 2017-2019 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
+//
+
+#include "FeaturesPlugin_ImportResult.h"
+
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_ResultPart.h>
+#include <Events_InfoMessage.h>
+
+void FeaturesPlugin_ImportResult::initAttributes()
+{
+ data()->addAttribute(OBJECTS(), ModelAPI_AttributeSelectionList::typeId());
+}
+
+void FeaturesPlugin_ImportResult::execute()
+{
+ AttributeSelectionListPtr aList = selectionList(OBJECTS());
+ int aResultIndex = 0;
+ for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) {
+ AttributeSelectionPtr aSel = aList->value(aSelIndex);
+ ResultPtr aContext = aSel->context();
+ if (!aContext.get())
+ continue;
+ GeomShapePtr aShape = aContext->shape();
+ if (!aShape.get() || aShape->isNull())
+ continue;
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
+ aResultBody->store(aShape);
+ aResultBody->loadFirstLevel(aShape, "ImportResult");
+ setResult(aResultBody, aResultIndex++);
+ }
+ removeResults(aResultIndex);
+}
+
+bool FeaturesPlugin_ValidatorImportResults::isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>&, Events_InfoMessage& theError) const
+{
+ AttributeSelectionListPtr aList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ if (aList->size() == 0) {
+ // LCOV_EXCL_START
+ theError = "Please select sources.";
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ // store documents in the Part-fesatures in order to check
+ // the selection is located in the previous documents
+ std::map<DocumentPtr, int> aDocIndices;
+ DocumentPtr aRoot = ModelAPI_Session::get()->moduleDocument();
+ int aNum = aRoot->size(ModelAPI_Feature::group());
+ for (int a = 0; a < aNum; a++) {
+ FeaturePtr aFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(
+ aRoot->object(ModelAPI_Feature::group(), a));
+ if (aFeat.get() && aFeat->data() && aFeat->data()->isValid() && aFeat->getKind() == "Part" &&
+ aFeat->results().size()) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFeat->firstResult());
+ if (aPart.get() && aPart->partDoc()) {
+ aDocIndices[aPart->partDoc()] = a;
+ }
+ }
+ }
+ int aThisIndex = aDocIndices[aList->owner()->document()];
+ for (int aSelIndex = 0; aSelIndex < aList->size(); aSelIndex++) {
+ AttributeSelectionPtr aSel = aList->value(aSelIndex);
+ ResultPtr aContext = aSel->context();
+ if (!aContext.get()) {
+ // LCOV_EXCL_START
+ theError = "Empty context.";
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ GeomShapePtr aShape = aSel->value();
+ if (aShape.get() && !aShape->isNull() && !aShape->isSame(aContext->shape())) {
+ // LCOV_EXCL_START
+ theError = "Import results does not support selection of sub-shapes";
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aContext);
+ if (!aBody.get()) {
+ // LCOV_EXCL_START
+ theError = "Only results may be selected.";
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ if (!aBody->shape()) {
+ // LCOV_EXCL_START
+ theError = "Result is empty.";
+ return false;
+ // LCOV_EXCL_STOP
+ }
+ int aBodyIndex = aDocIndices[aBody->document()];
+ if (aBodyIndex >= aThisIndex) {
+ theError = "The selected result must be located in earlier part.";
+ return false;
+ }
+ }
+ return true;
+}
--- /dev/null
+// Copyright (C) 2017-2019 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
+//
+
+#ifndef FeaturesPlugin_ImportResult_H_
+#define FeaturesPlugin_ImportResult_H_
+
+#include "FeaturesPlugin.h"
+
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_AttributeValidator.h>
+
+/// \class FeaturesPlugin_ImportResult
+/// \ingroup Plugins
+/// \brief The Import Result feature allows the user to import one or several results
+/// from another Part.
+
+class FeaturesPlugin_ImportResult : public ModelAPI_Feature
+{
+public:
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("ImportResult");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_ImportResult::ID();
+ return MY_KIND;
+ }
+
+ /// Selection list attribute that contains all copied shapes selection.
+ inline static const std::string& OBJECTS()
+ {
+ static const std::string MY_OBJECTS("objects");
+ return MY_OBJECTS;
+ }
+
+ /// Performs the algorithm and stores results it in the data structure.
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes.
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation.
+ FeaturesPlugin_ImportResult() {}
+};
+
+/// \class FeaturesPlugin_ValidatorImportResults
+/// \ingroup Validators
+/// \brief A validator for selection of objects that may be imported:
+/// from another part, result bodies.
+class FeaturesPlugin_ValidatorImportResults : public ModelAPI_AttributeValidator
+{
+public:
+ //! \return True if selection is valid.
+ //! \param[in] theAttribute the checked attribute.
+ //! \param[in] theArguments arguments of the attribute.
+ //! \param[out] theError error message.
+ virtual bool isValid(const AttributePtr& theAttribute,
+ const std::list<std::string>& theArguments, Events_InfoMessage& theError) const;
+};
+
+#endif
#include <FeaturesPlugin_FusionFaces.h>
#include <FeaturesPlugin_RemoveResults.h>
#include <FeaturesPlugin_Copy.h>
+#include <FeaturesPlugin_ImportResult.h>
#include <FeaturesPlugin_ValidatorTransform.h>
#include <FeaturesPlugin_Validators.h>
new FeaturesPlugin_ValidatorBooleanCommonSelection);
aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanCommonArguments",
new FeaturesPlugin_ValidatorBooleanCommonArguments);
+ aFactory->registerValidator("FeaturesPlugin_ValidatorImportResults",
+ new FeaturesPlugin_ValidatorImportResults);
// register this plugin
ModelAPI_Session::get()->registerPlugin(this);
return FeaturePtr(new FeaturesPlugin_Chamfer);
} else if (theFeatureID == FeaturesPlugin_Copy::ID()) {
return FeaturePtr(new FeaturesPlugin_Copy);
+ } else if (theFeatureID == FeaturesPlugin_ImportResult::ID()) {
+ return FeaturePtr(new FeaturesPlugin_ImportResult);
}
<source>Copy</source>
<translation>Copie</translation>
</message>
+ <message>
+ <source>Import Result</source>
+ <translation>Importer le résultat</translation>
+ </message>
<message>
<source>Remove Sub-Shapes</source>
<translation>Supprimer les sous-formes</translation>
</message>
</context>
+ <!-- Import result -->
+ <context>
+ <name>ImportResult</name>
+ <message>
+ <source>ImportResult</source>
+ <translation>Importer le résultat</translation>
+ </message>
+ <message>
+ <source>Copies results from other parts</source>
+ <translation>Copie les résultats d'autres pièces</translation>
+ </message>
+ </context>
+ <context>
+ <name>ImportResult:objects</name>
+ <message>
+ <source>Sources:</source>
+ <translation>Sources:</translation>
+ </message>
+ <message>
+ <source>Select copied results</source>
+ <translation>Sélectionnez les résultats copiés</translation>
+ </message>
+ </context>
+
<!-- Remove_SubShapes -->
<context>
<name>Remove_SubShapes</name>
--- /dev/null
+# Copyright (C) 2014-2019 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
+#
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(15, 13, 11)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+model.do()
+
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("XOZ"))
+SketchCircle_2 = Sketch_2.addCircle(-13, -9, 5)
+model.do()
+Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Extrusion_1_1")])
+model.do()
+
+Part_3 = model.addPart(partSet)
+Part_3_doc = Part_3.document()
+Extrusion_3 = model.addExtrusion(Part_3_doc, [], model.selection(), 1, 0)
+Sketch_3 = model.addSketch(Part_3_doc, model.defaultPlane("XOZ"))
+SketchCircle_3 = Sketch_3.addCircle(-4, 2, 5)
+Extrusion_3.setNestedSketch(Sketch_3)
+model.do()
+
+model.end()
+
+# check Part_2 is ok and contains 2 solids in result
+assert(Part_2.feature().results().size() == 1)
+aPartShape = Part_2.feature().firstResult().shape()
+assert(aPartShape.shapeTypeStr() == "COMPOUND")
+aShapeExplorer = GeomAPI_ShapeExplorer(aPartShape, GeomAPI_Shape.SOLID)
+assert(aShapeExplorer.more())
+aShapeExplorer.next()
+assert(aShapeExplorer.more())
+
+# check that selection of this part and the lower part is impossible (by validator)
+model.begin()
+aSel = ImportResult_1.feature().selectionList("objects").value(0)
+aSel.selectSubShape("SOLID", "Part_2/Extrusion_1_1")
+model.end()
+aFactory = ModelAPI_Session.get().validators()
+assert(not aFactory.validate(ImportResult_1.feature()))
+
+model.begin()
+aSel = ImportResult_1.feature().selectionList("objects").value(0)
+aSel.selectSubShape("SOLID", "Part_3/Extrusion_1_1")
+model.end()
+assert(not aFactory.validate(ImportResult_1.feature()))
+
+# back to correct value
+model.begin()
+aSel = ImportResult_1.feature().selectionList("objects").value(0)
+aSel.selectSubShape("SOLID", "Part_1/Extrusion_1_1")
+model.end()
+assert(aFactory.validate(ImportResult_1.feature()))
+
+# TODO: implement for GEOMOETRICAL also
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
filletFeature.rst
fuseFeature.rst
fuseFeatureFaces.rst
+ importResult.rst
intersectionFeature.rst
linearCopyFeature.rst
measurementFeature.rst
--- /dev/null
+
+ .. _tui_create_import_result:
+
+Create Import Result
+============
+
+.. literalinclude:: examples/import_result.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/import_result.py>`
+
--- /dev/null
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(21, 16, 6)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+model.do()
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+ImportResult_1 = model.addImportResult(Part_2_doc, [model.selection("SOLID", "Part_1/Extrusion_1_1")])
+model.end()
--- /dev/null
+.. |import_result_btn.icon| image:: images/import_result_btn.png
+
+Import Result
+=====
+
+The Import Result feature allows the user to import one or several results from another Part. If the result of the source-part is
+changed, the part and part result that contains the copy-results will be updated. The feature keeps the
+copy-shape, so, even the document was opened and the source-part was not activated (loaded), the part with copy-feature works well
+with this result-shape.
+
+It may be necessary for the user to load the other parts before using this feature otherwise the content of the **Results** folders will be empty.
+
+To create a Copy in the active part:
+
+#. select in the Main Menu *Features - > Import Result* item or
+#. click |import_result_btn.icon| **Import Result** button in the toolbar
+
+
+The following property panel will be opened:
+
+.. image:: images/ImportResult.png
+ :align: center
+
+.. centered::
+ **Import result operation**
+
+Here it is necessary to select one or several objects. It is only possible to import results from Parts placed before the
+current Part where the import is done. Only results from the **Results** folder of previously created parts may be selected.
+
+
+**Apply** button creates a copy.
+
+**Cancel** button cancels the operation.
+
+**TUI Command**:
+
+.. py:function:: model.addImportResult(Part_doc, results)
+
+ :param part: The current part object.
+ :param results: A list of results from another part.
+ :return: Result feature Import Result.
+
+Result
+""""""
+
+The Result of the operation will be copy of one or several results selected in another part located in the same place:
+
+.. image:: images/CreatedImportResult.png
+ :align: center
+
+.. centered::
+ **Import result created**
+
+**See Also** a sample TUI Script of :ref:`tui_create_import_result` operation.
--- /dev/null
+<source>
+ <multi_selector id="objects"
+ label="Sources:"
+ tooltip="Select copied results"
+ shape_types="objects"
+ use_choice="false"
+ concealment="false"
+ allow_parts_content="true">
+ <validator id="FeaturesPlugin_ValidatorImportResults"/>
+ </multi_selector>
+</source>
helpfile="copyFeature.html">
<source path="copy_widget.xml"/>
</feature>
+ <feature id="ImportResult"
+ title="Import Result"
+ tooltip="Copies results from other parts"
+ icon="icons/Features/import_result.png"
+ helpfile="importResultFeature.html">
+ <source path="import_result_widget.xml"/>
+ </feature>
<feature id="RemoveResults" title="Remove results" tooltip="Internal feature for results removal" internal="1">
<multi_selector id="results" concealment="true"/>
</feature>
#include <GeomAlgoAPI_DFLoader.h>
#include <GeomAlgoAPI_ShapeTools.h>
-#include <ShapeUpgrade_UnifySameDomain.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
#include <Precision.hxx>
#include <TopoDS_Edge.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
+#include <ShapeUpgrade_UnifySameDomain.hxx>
//==================================================================================================
GeomAlgoAPI_UnifySameDomain::GeomAlgoAPI_UnifySameDomain(const ListOfShape& theShapes)
Handle(TDataStd_AsciiString) anEntry;
if (myRef->Label().FindAttribute(TDataStd_AsciiString::GetID(), anEntry)) {
std::shared_ptr<Model_Document> aDR = std::dynamic_pointer_cast<Model_Document>(aRefDoc);
- TDF_Label aRefLab;
- TDF_Tool::Label(aDR->objects()->featuresLabel().Data(),
- anEntry->Get().ToCString(), aRefLab);
- if (!aRefLab.IsNull()) {
- return aDR->objects()->object(aRefLab);
+ if (aDR.get() && aDR->objects()) {
+ TDF_Label aRefLab;
+ TDF_Tool::Label(aDR->objects()->featuresLabel().Data(),
+ anEntry->Get().ToCString(), aRefLab);
+ if (!aRefLab.IsNull()) {
+ return aDR->objects()->object(aRefLab);
+ }
}
}
}
if (aPartName == aRootDoc->kind()) {
aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
aSubShapeName = aSubShapeName.substr(aPartEnd + 1);
- } else {
+ }
+ else {
ObjectPtr aFound =
owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName);
if (aFound.get()) { // found such part, so asking it for the name
continue;
std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aSelected));
setValueCenter(aPart, aSelectedEdge, aCenterType);
- } else
+ }
+ else
setValue(aPart, aSelected);
TDataStd_Integer::Set(selectionLabel(), anIndex);
return;
}
+ } else { // for the ImportResult feature Objects widget this may be a result in other part
+ // result may be hidden (like, tranlsatiomn of part) in PartSet, so iterate Part-features
+ int aNum = aRootDoc->size(ModelAPI_Feature::group());
+ for (int a = 0; a < aNum; a++) {
+ FeaturePtr aFeat = std::dynamic_pointer_cast<ModelAPI_Feature>(
+ aRootDoc->object(ModelAPI_Feature::group(), a));
+ if (aFeat.get() && aFeat->data() && aFeat->data()->isValid() &&
+ aFeat->getKind() == "Part" && aFeat->results().size()) {
+ ResultPartPtr aPart =
+ std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFeat->firstResult());
+ if (aPart.get() && aPart->partDoc().get() && aPart->data()->name() == aPartName) {
+ aDoc = std::dynamic_pointer_cast<Model_Document>(aPart->partDoc());
+ aSubShapeName = aSubShapeName.substr(aPartEnd + 1);
+ }
+ }
+ }
}
}
}
return; // null shape inside
if(!theIsStoreSameShapes) {
- Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShape, aShapeLab);
+ Handle(TNaming_NamedShape) aNS;
+ if (TNaming_Tool::HasLabel(aShapeLab, aShape))
+ aNS = TNaming_Tool::NamedShape(aShape, aShapeLab);
// the last condition is for the issue 2751 : existing shape may be found in compound-NS
if(!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) {
// This shape is already in document, store reference instead of shape;
if (aData.get()) {
TDF_Label aShapeLab = aData->shapeLab();
TopoDS_Shape aShapeNew = theNewShape->impl<TopoDS_Shape>();
- Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab);
+ Handle(TNaming_NamedShape) aNS;
+ if (TNaming_Tool::HasLabel(aShapeLab, aShapeNew))
+ aNS = TNaming_Tool::NamedShape(aShapeNew, aShapeLab);
// the last condition is for the issue 2751 : existing shape may be found in compound-NS
if (!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShapeNew)) {
// This shape is already in document, store reference instead of shape;
for (int i = 0; i < theSize; ++i) {
if (i > 0)
theOutput << " ";
- theOutput << std::fixed << setprecision(thePrecision)
+ theOutput << std::fixed << std::setprecision(thePrecision)
<< (fabs(theArray[i]) < TOLERANCE ? 0.0 : theArray[i]);
}
}
aResult<<"Volume: ";
// volumes of too huge shapes write in the scientific format
if (aVolume >= 1.e5)
- aResult<<std::scientific<<setprecision(7);
+ aResult<<std::scientific<<std::setprecision(7);
else
- aResult<<std::fixed<<setprecision(3);
+ aResult<<std::fixed<<std::setprecision(3);
aResult<<aVolume<<std::endl;
}
std::shared_ptr<GeomAPI_Pnt> aCenter = GeomAlgoAPI_ShapeTools::centreOfMass(theShape);
myFeatureId = theData->featureId();
myIsInternal = theData->getBooleanAttribute(ATTR_INTERNAL, false);
+ myUseExternalParts = theData->getBooleanAttribute("allow_parts_content", false);
myIsModifiedInEdit = theData->getProperty(ATTR_MODIFIED_IN_EDIT);
virtual bool isReadOnly() const { return !isEnabled(); }
+ /// Returns true if the widget should have access to external parts
+ bool canUseExternalParts() const { return myUseExternalParts; }
+
signals:
/// The signal about widget values are to be changed
void beforeValuesChanged();
bool myFlushUpdateBlocked;
bool myUpdateVisualAttributes;
+
+ /// A flag which indicates that current widget should have access to external parts
+ bool myUseExternalParts;
};
#endif
// Add item
if (aProp->type() != Config_Prop::Disabled) {
SUIT_PreferenceMgr::PrefItemType aPrefType = SUIT_PreferenceMgr::Auto;
- if (aProp->type() == Config_Prop::Directory) {
+ switch (aProp->type()) {
+ case Config_Prop::Directory:
aPrefType = SUIT_PreferenceMgr::File;
- } else {
+ break;
+ case Config_Prop::Cursor:
+ aPrefType = SUIT_PreferenceMgr::Selector;
+ break;
+ default:
aPrefType = (SUIT_PreferenceMgr::PrefItemType) aProp->type();
}
+
int anId = thePref->addPreference(QObject::tr(aProp->title().c_str()), aTab, aPrefType,
QString::fromStdString(aProp->section()),
QString::fromStdString(aProp->name()));
- if(aProp->type() == Config_Prop::Directory) {
+
+ switch (aProp->type()) {
+ case Config_Prop::Directory:
thePref->setItemProperty("path_type", Qtx::PT_Directory, anId);
- }
- if (aPrefType == SUIT_PreferenceMgr::DblSpin) {
+ break;
+ case SUIT_PreferenceMgr::DblSpin:
if (aProp->min() != "") {
double aMin = QString(aProp->min().c_str()).toDouble();
thePref->setItemProperty("min", aMin, anId);
double aMax = QString(aProp->max().c_str()).toDouble();
thePref->setItemProperty("max", aMax, anId);
}
- }
- if (aPrefType == SUIT_PreferenceMgr::IntSpin) {
+ break;
+ case SUIT_PreferenceMgr::IntSpin:
if (aProp->min() != "") {
int aMin = QString(aProp->min().c_str()).toInt();
thePref->setItemProperty("min", aMin, anId);
int aMax = QString(aProp->max().c_str()).toInt();
thePref->setItemProperty("max", aMax, anId);
}
+ break;
+ case Config_Prop::Cursor:
+ {
+ QList<QVariant> aIndicesList;
+ QList<QVariant> aIconsList;
+ aIndicesList << 0 << 1 << 2;
+ aIconsList << QPixmap(":pictures/ArrowCursor.png") <<
+ QPixmap(":pictures/CrossCursor.png") <<
+ QPixmap(":pictures/HandCursor.png");
+
+ thePref->setItemProperty("indexes", aIndicesList, anId);
+ thePref->setItemProperty("icons", aIconsList, anId);
+ }
+ break;
}
}
}
//
#include "ModuleBase_ResultPrs.h"
+#include "ModuleBase_IViewer.h"
#include <GeomAPI_PlanarEdges.h>
new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1);
aDrawer->SetFreeBoundaryAspect(aFreeBndAspect);
+ aDrawer->VIsoAspect()->SetNumber(0);
+ aDrawer->UIsoAspect()->SetNumber(0);
+
if (aDrawer->HasOwnPointAspect())
aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
else
aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.));
+ aDrawer = DynamicHilightAttributes();
+ if (aDrawer.IsNull()) {
+ if (!ModuleBase_IViewer::DefaultHighlightDrawer.IsNull()) {
+ aDrawer = new Prs3d_Drawer(*ModuleBase_IViewer::DefaultHighlightDrawer);
+ aDrawer->VIsoAspect()->SetNumber(0);
+ aDrawer->UIsoAspect()->SetNumber(0);
+ SetDynamicHilightAttributes(aDrawer);
+ }
+ } else {
+ aDrawer->VIsoAspect()->SetNumber(0);
+ aDrawer->UIsoAspect()->SetNumber(0);
+ }
myHiddenSubShapesDrawer = new AIS_ColoredDrawer(myDrawer);
Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect();
aShadingAspect->SetMaterial(Graphic3d_NOM_BRASS); //default value of context material
#include "ModuleBase_ViewerFilters.h"
#include "ModuleBase_IWorkshop.h"
#include "ModuleBase_IModule.h"
+#include "ModuleBase_Operation.h"
+#include "ModuleBase_IPropertyPanel.h"
+#include "ModuleBase_ModelWidget.h"
#include <ModelAPI_Session.h>
#include <ModelAPI_Document.h>
if (aObj) {
DocumentPtr aDoc = aObj->document();
SessionPtr aMgr = ModelAPI_Session::get();
- aValid = (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument());
+
+ ModuleBase_ModelWidget* aWidget = anOperation->propertyPanel()->activeWidget();
+ if (aWidget && aWidget->canUseExternalParts())
+ aValid = Standard_True;
+ else
+ aValid = (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument());
}
else {
// This object is not controlled by the filter
#include <ModuleBase_Operation.h>
#include <ModuleBase_OperationFeature.h>
#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_IViewer.h>
#include <ModuleBase_Tools.h>
#include <XGUI_ModuleConnector.h>
aMgr->finishOperation();
myModule->workshop()->updateCommandStatus();
+ myModule->workshop()->viewer()->update();
}
void PartSet_MenuMgr::grantedOperationIds(ModuleBase_Operation* theOperation,
}
// It is switched off because of
// Task #3067: 5.2.2 Drawing in the sketcher: change the mouse cursor arrow
- //else if (sketchMgr()->isNestedSketchOperation(theOperation)) {
- // mySketchMgr->startNestedSketch(theOperation);
- //}
+ else if (sketchMgr()->isNestedSketchOperation(theOperation)) {
+ mySketchMgr->startNestedSketch(theOperation);
+ }
}
//******************************************************
// It is switched off because of
// Task #3067: 5.2.2 Drawing in the sketcher: change the mouse cursor arrow
- // if (canChangeCursor(getCurrentOperation())) {
- // QCursor* aCurrentCursor = QApplication::overrideCursor();
- // if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
- // QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
+ if (canChangeCursor(getCurrentOperation())) {
+ QCursor* aCurrentCursor = QApplication::overrideCursor();
+ if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
+ QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor());
//#ifdef DEBUG_CURSOR
// qDebug("onEnterViewPort() : Qt::CrossCursor");
//#endif
- // }
- // }
+ }
+ }
if (!isNestedCreateOperation(getCurrentOperation(), activeSketch()))
return;
return;
#endif
-// if (canChangeCursor(getCurrentOperation())) {
-// QApplication::restoreOverrideCursor();
+ if (canChangeCursor(getCurrentOperation())) {
+ QApplication::restoreOverrideCursor();
//#ifdef DEBUG_CURSOR
// qDebug("onLeaveViewPort() : None");
//#endif
-// }
+ }
if (!isNestedCreateOperation(getCurrentOperation(), activeSketch()))
return;
}
}
}
- else
- isRelaunchEditing = !myCurrentSelection.contains(aSPFeature);
-
+ else {
+ if (myCurrentSelection.size() > 1)
+ isRelaunchEditing = !myCurrentSelection.contains(aSPFeature);
+ }
if (isRelaunchEditing)
aFOperation->commit();
workshop()->viewer()->set2dMode(false);
}
-//void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
-//{
-// if (canChangeCursor(theOperation) && myIsMouseOverWindow) {
-// QCursor* aCurrentCursor = QApplication::overrideCursor();
-// if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
-// QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));
+void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation)
+{
+ if (canChangeCursor(theOperation) && myIsMouseOverWindow) {
+ QCursor* aCurrentCursor = QApplication::overrideCursor();
+ if (!aCurrentCursor || aCurrentCursor->shape() != Qt::CrossCursor) {
+ QApplication::setOverrideCursor(PartSet_Tools::getOperationCursor());
//#ifdef DEBUG_CURSOR
// qDebug("startNestedSketch() : Qt::CrossCursor");
//#endif
-// }
-// }
-//}
+ }
+ }
+}
void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation)
{
myIsMouseOverViewProcessed = true;
operationMgr()->onValidateOperation();
// when sketch nested operation is stopped the cursor should be restored unconditionally
- //if (canChangeCursor(theOperation)) {
- //QApplication::restoreOverrideCursor();
+ if (canChangeCursor(theOperation)) {
+ QApplication::restoreOverrideCursor();
#ifdef DEBUG_CURSOR
qDebug("stopNestedSketch() : None");
#endif
- //}
+ }
/// improvement to deselect automatically all eventual selected objects, when
// returning to the neutral point of the Sketcher
bool isClearSelectionPossible = true;
if (aShapeType != 6/*an edge*/ && aShapeType != 7/*a vertex*/ && aShapeType != 0/*compound*/)
return;
+ int aWidth = Config_PropManager::integer("Visualization", "sketch_line_width");
if (isExternal(aFeature)) {
- thePrs->setWidth(1);
+ thePrs->setWidth(isIncludeToResult(aFeature)? aWidth : 1);
return;
}
std::string aKind = aFeature->getKind();
thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE_AUXILIARY());
}
else {
- int aWidth = Config_PropManager::integer("Visualization", "sketch_line_width");
thePrs->setWidth(aWidth);
thePrs->setLineStyle(SketchPlugin_SketchEntity::SKETCH_LINE_STYLE());
}
/// Starts sketch operation, connects to the opeation property panel
/// \param theOperation a committed operation
- //void startNestedSketch(ModuleBase_Operation* theOperation);
+ void startNestedSketch(ModuleBase_Operation* theOperation);
/// Stop sketch operation, disconnects from the opeation property panel
/// \param theOperation a stopped operation
{
return Config_PropManager::integer("Visualization", "shaper_default_transparency") / 100.;
}
+
+QCursor PartSet_Tools::getOperationCursor()
+{
+ int aId = Config_PropManager::integer(SKETCH_TAB_NAME, "operation_cursor");
+ switch (aId) {
+ case 0:
+ return QCursor(Qt::ArrowCursor);
+ case 1:
+ return QCursor(Qt::CrossCursor);
+ case 2:
+ return QCursor(Qt::PointingHandCursor);
+ }
+ return QCursor();
+}
#include <QPoint>
#include <QList>
+#include <QCursor>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Object.h>
* Returns default transparency value
*/
static double getDefaultTransparency();
+
+ /**
+ * Returns cursor according to (SKETCH_TAB_NAME, "operation_cursor") property value
+ */
+ static QCursor getOperationCursor();
};
#endif
GeomShapePtr anEmptyShape;
aSelAttr->setValue(anEmptyResult, anEmptyShape);
}
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
+ aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+ anOrigin->reset();
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+ aNormal->reset();
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
+ aDirX->reset();
}
bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
from FeaturesAPI import addFusionFaces
from FeaturesAPI import measureLength, measureDistance, measureRadius, measureAngle
from FeaturesAPI import addRemoveResults
-from FeaturesAPI import addCopy
+from FeaturesAPI import addCopy, addImportResult
#include <QMenu>
#include <QToolBar>
-#define SALOME_PATCH_FOR_CTRL_WHEEL
+#if OCC_VERSION_HEX < 0x070400
+ #define SALOME_PATCH_FOR_CTRL_WHEEL
+#endif
extern "C" {
SHAPERGUI_EXPORT CAM_Module* createModule()
//}
myWorkshop->displayer()->setSelectionColor(myOldSelectionColor);
myProxyViewer->setSelector(0);
+
+ LightApp_SelectionMgr* aMgr = getApp()->selectionMgr();
+ QList<SUIT_Selector*> aList;
+ aMgr->selectors(aList);
+ foreach(SUIT_Selector* aSel, aList) {
+ aSel->setEnabled(aSel != mySelector);
+ }
+
delete mySelector;
mySelector = 0;
}
#include <QMouseEvent>
#include <QContextMenuEvent>
-#define SALOME_PATCH_FOR_CTRL_WHEEL
+#if OCC_VERSION_HEX < 0x070400
+ #define SALOME_PATCH_FOR_CTRL_WHEEL
+#endif
SHAPERGUI_SalomeView::SHAPERGUI_SalomeView(OCCViewer_Viewer* theViewer)
: ModuleBase_IViewWindow(), myCurrentView(0)
aView3d->SetProj(theX, theY, theZ);
aView3d->SetTwist( theTwist );
aView3d->FitAll(0.01, false);
- aView3d->SetZSize(0.);
+ //aView3d->SetZSize(0.);
if (aView3d->Depth() < 0.1)
aView3d->DepthFitAll();
}
<translation>Type d'angle</translation>
</message>
<message>
- <source>Complementary</source>
- <translation>Complémentaire</translation>
+ <source>Supplementary</source>
+ <translation>Supplémentaire</translation>
</message>
<message>
<source>Direct</source>
buttons_dir="horizontal"
label="Angle type"
tooltip="Type of angle"
- string_list="Direct Complementary Additional"
+ string_list="Direct Supplementary Additional"
icons_list="icons/Sketch/angle_direct.png icons/Sketch/angle_complementary.png icons/Sketch/angle_backward.png"
default="0"
/>
//
#include "SketcherPrs_SensitivePoint.h"
+#include "SketcherPrs_SymbolPrs.h"
#include <Graphic3d_ArrayOfPoints.hxx>
-#include "SketcherPrs_SymbolPrs.h"
+#include <Standard_Version.hxx>
#define DEBUG_SENSITIVE_TO_BE_CORRECTED
Standard_Boolean SketcherPrs_SensitivePoint::Matches(SelectBasics_SelectingVolumeManager& theMgr,
SelectBasics_PickResult& thePickResult)
{
- Standard_Real aDepth = RealLast();
- Standard_Real aDistToCOG = RealLast();
- gp_Pnt aPnt = Point();
- if (!theMgr.Overlaps (aPnt, aDepth))
- {
- thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
- return Standard_False;
- }
+#if OCC_VERSION_HEX < 0x070400
+ Standard_Real aDepth = RealLast();
+ Standard_Real aDistToCOG = RealLast();
+ gp_Pnt aPnt = Point();
+ if (!theMgr.Overlaps(aPnt, aDepth))
+ {
+ thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG);
+ return Standard_False;
+ }
- aDistToCOG = aDepth;
- thePickResult = SelectBasics_PickResult (aDepth, aDistToCOG);
- return Standard_True;
+ aDistToCOG = aDepth;
+ thePickResult = SelectBasics_PickResult(aDepth, aDistToCOG);
+ return Standard_True;
+#else
+ gp_Pnt aPnt = Point();
+ if (theMgr.Overlaps (aPnt, thePickResult))
+ return Standard_True;
+ return Standard_False;
+#endif
}
gp_Pnt SketcherPrs_SensitivePoint::Point() const
#ifndef SketcherPrs_SensitivePoint_H
#define SketcherPrs_SensitivePoint_H
+#include <SelectBasics_EntityOwner.hxx>
#include <Select3D_SensitiveEntity.hxx>
#include <Standard_DefineHandle.hxx>
}
// The icon for constraint is not found
static const char aMsg[] = "Error! constraint images are not found";
- cout<<aMsg<<endl;
+ std::cout<<aMsg<<std::endl;
Events_InfoMessage("SketcherPrs_SymbolPrs", aMsg).send();
myIconsMap[iconName()] = Handle(Image_AlienPixMap)();
return Handle(Image_AlienPixMap)();
void displayedObjects(const Handle(AIS_InteractiveContext)& theAIS, AIS_ListOfInteractive& theList)
{
// Get from null point
- theAIS->DisplayedObjects(theList, true);
+#if OCC_VERSION_HEX < 0x070400
+ theAIS->DisplayedObjects(theList, true);
+#else
+ theAIS->DisplayedObjects(theList);
+#endif
}
QString qIntListInfo(const QIntList& theValues, const QString& theSeparator = QString(", "))
myContextId = aContext.get();
if (!myWorkshop->selectionActivate()->isTrihedronActive())
selectionActivate()->deactivateTrihedron(true);
- aContext->DefaultDrawer()->VIsoAspect()->SetNumber(0);
- aContext->DefaultDrawer()->UIsoAspect()->SetNumber(0);
+ // Do not modify default drawer. The same is done in ModuleBase_ResultPrs
+ //aContext->DefaultDrawer()->VIsoAspect()->SetNumber(0);
+ //aContext->DefaultDrawer()->UIsoAspect()->SetNumber(0);
//Handle(AIS_Trihedron) aTrihedron = myWorkshop->viewer()->trihedron();
//aTrihedron->getHighlightPointAspect()->SetScale(2.0);
//aTrihedron->getHighlightPointAspect()->SetTypeOfMarker(Aspect_TOM_O_STAR);
// Commented out according to discussion in bug #2825
- //ModuleBase_IViewer::DefaultHighlightDrawer = aContext->HighlightStyle();
+ ModuleBase_IViewer::DefaultHighlightDrawer = aContext->HighlightStyle();
//Handle(Prs3d_Drawer) aSelStyle = aContext->SelectionStyle();
//double aDeflection =
// QString(ModelAPI_ResultConstruction::DEFAULT_DEFLECTION().c_str()).toDouble();
aView3d->SetProj(theX, theY, theZ);
aView3d->SetTwist( theTwist );
aView3d->FitAll(0.01, false);
- aView3d->SetZSize(0.);
+ //aView3d->SetZSize(0.);
if (aView3d->Depth() < 0.1)
aView3d->DepthFitAll();
}
<file>pictures/normal-view.png</file>
<file>pictures/move_to_end.png</file>
<file>pictures/move_to_end_split.png</file>
+ <file>pictures/ArrowCursor.png</file>
+ <file>pictures/CrossCursor.png</file>
+ <file>pictures/HandCursor.png</file>
</qresource>
</RCC>