From: Artem Zhidkov Date: Fri, 2 Apr 2021 06:25:58 +0000 (+0300) Subject: Merge branch 'csgroup_IS2' X-Git-Tag: V9_7_0a1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1fd15bed1c62f994a3438bc4a12f44d0361f98c9;p=modules%2Fshaper.git Merge branch 'csgroup_IS2' --- 1fd15bed1c62f994a3438bc4a12f44d0361f98c9 diff --cc src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index 5c21259db,a5d8ed26e..8da67a31e --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@@ -90,8 -90,11 +90,11 @@@ class PublishToStudyFeature(ModelAPI.Mo # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added. aFeaturesIndices = {} for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody_group())): - aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId) + aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId) aRes = model.objectToResult(aResObject) + #do not export images + if aRes.hasTextureFile() is True: - continue ++ continue aResFeatureId = str(aPartDoc.feature(aRes).data().featureId()) if aResFeatureId in aFeaturesIndices: aFeaturesIndices[aResFeatureId] += 1 diff --cc src/ExchangeAPI/ExchangeAPI_Import.cpp index 50fcec253,eee356406..cee25a91a --- a/src/ExchangeAPI/ExchangeAPI_Import.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Import.cpp @@@ -205,3 -205,52 +205,51 @@@ void importPart(const std::shared_ptrsetCurrentFeature(aCurrentFeature, THE_VISIBLE_FEATURE); } + + //------------------------------------------------------------------------------------------------- + //------------------------------------------------------------------------------------------------- + + ExchangeAPI_Import_Image::ExchangeAPI_Import_Image( + const std::shared_ptr & theFeature) + : ModelHighAPI_Interface(theFeature) + { + initialize(); + } + + ExchangeAPI_Import_Image::ExchangeAPI_Import_Image( + const std::shared_ptr & theFeature, + const std::string & theFilePath) + : ModelHighAPI_Interface(theFeature) + { + if (initialize()) + setFilePath(theFilePath); + } + + void ExchangeAPI_Import_Image::setFilePath(const std::string & theFilePath) + { + fillAttribute(theFilePath, myfilePath); + execute(); + } + + ImportImagePtr addImportImage( + const std::shared_ptr & thePart, + const std::string & theFilePath) + { + std::shared_ptr aFeature = thePart->addFeature(ExchangeAPI_Import_Image::ID()); + return ImportImagePtr(new ExchangeAPI_Import_Image(aFeature, theFilePath)); + } + + void ExchangeAPI_Import_Image::dump(ModelHighAPI_Dumper& theDumper) const + { + FeaturePtr aBase = feature(); + std::string aPartName = theDumper.name(aBase->document()); + + std::string aFilePath = + aBase->string(ExchangePlugin_Import_ImageFeature::FILE_PATH_ID())->value(); + + theDumper << aBase << " = model.addImportImage(" << aPartName << ", \"" + << aFilePath << "\")" << std::endl; + + // to make import have results + theDumper << "model.do()" << std::endl; + } - diff --cc src/ExchangePlugin/ExchangePlugin_ImportFeature.h index 16b5c0158,37376e198..46618aba5 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h @@@ -35,21 -35,9 +35,9 @@@ * * The list of supported formats is defined in the configuration file. */ - class ExchangePlugin_ImportFeature : public ModelAPI_CompositeFeature + class ExchangePlugin_ImportFeatureBase : public ModelAPI_CompositeFeature { - public: - /// Feature kind - inline static const std::string& ID() - { - static const std::string MY_IMPORT_ID("Import"); - return MY_IMPORT_ID; - } - /// Feature kind - inline static const std::string& IMPORT_TYPE_ID() - { - static const std::string MY_IMPORT_TYPE_ID("ImportType"); - return MY_IMPORT_TYPE_ID; - } - public: ++public: /// attribute name of file path inline static const std::string& FILE_PATH_ID() { diff --cc src/ExchangePlugin/plugin-Exchange.xml index 8f2445633,c6f58a196..80f60a429 --- a/src/ExchangePlugin/plugin-Exchange.xml +++ b/src/ExchangePlugin/plugin-Exchange.xml @@@ -36,7 -36,18 +36,18 @@@ - + + + + + + + diff --cc src/PythonAddons/tests.set index ecda87d26,000000000..a71c23337 mode 100644,000000..100644 --- a/src/PythonAddons/tests.set +++ b/src/PythonAddons/tests.set @@@ -1,24 -1,0 +1,25 @@@ +# Copyright (C) 2021 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 +# + +SET(TEST_NAMES + TestRectangle.py ++ TestRectangleCentered.py + TestcompoundVertices.py + TestimportParameters.py +) diff --cc src/SketchPlugin/doc/examples/rectangle.py index 1795cf62c,c9f785103..81d8910ff --- a/src/SketchPlugin/doc/examples/rectangle.py +++ b/src/SketchPlugin/doc/examples/rectangle.py @@@ -6,5 -7,10 +7,10 @@@ Part_1 = model.addPart(partSet Part_1_doc = Part_1.document() Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) Rectangle_1 = Sketch_1.addRectangle(5.5, 8.5, 31.3, 78.9) -# rectangle from center and end points ++# rectangle from center and end points + center = geom.Pnt2d(10, 5) + corner = geom.Pnt2d(25, 75) + rectangle_2 = sketch.addRectangleCentered(center, corner) + model.do() model.end()