]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
clean source
authorJérôme <jerome.lucas@cesgenslab.fr>
Thu, 12 Nov 2020 10:06:46 +0000 (11:06 +0100)
committerJérôme <jerome.lucas@cesgenslab.fr>
Thu, 12 Nov 2020 10:06:46 +0000 (11:06 +0100)
20 files changed:
src/ConnectorAPI/Test/TestExportSTL.py [deleted file]
src/ConnectorAPI/Test/TestImportSTEP.py [deleted file]
src/ExchangeAPI/CMakeLists.txt
src/ExchangeAPI/ExchangeAPI_Export.cpp
src/ExchangeAPI/ExchangeAPI_Export.h
src/ExchangeAPI/ExchangeAPI_Import.cpp
src/ExchangeAPI/ExchangeAPI_Import.h
src/ExchangePlugin/CMakeLists.txt
src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp
src/ExchangePlugin/ExchangePlugin_ExportFeature.h
src/ExchangePlugin/ExchangePlugin_Import.cpp
src/ExchangePlugin/ExchangePlugin_Import.h
src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp
src/ExchangePlugin/ExchangePlugin_ImportFeature.h
src/ExchangePlugin/ExchangePlugin_msg_fr.ts
src/ExchangePlugin/doc/importFeature.rst
src/ExchangePlugin/export_widget.xml
src/ExchangePlugin/plugin-Exchange.xml
src/FeaturesAPI/FeaturesAPI_Fillet.cpp
src/FeaturesAPI/FeaturesAPI_Fillet.h

diff --git a/src/ConnectorAPI/Test/TestExportSTL.py b/src/ConnectorAPI/Test/TestExportSTL.py
deleted file mode 100644 (file)
index edc7eaf..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-# Copyright (C) 2014-2020  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
-#
-
-"""
-      TestExport.py
-      Unit test of ExchangePlugin_TestExport class
-"""
-#=========================================================================
-# Initialization of the test
-#=========================================================================
-
-import salome
-
-import os
-import math
-from tempfile import TemporaryDirectory
-
-import GEOM
-
-from ModelAPI import *
-
-from salome.shaper import model
-
-from salome.geom import geomBuilder
-
-from GeomAlgoAPI import *
-
-__updated__ = "2015-05-22"
-
-salome.salome_init(1)
-geompy = geomBuilder.New()
-
-#=========================================================================
-# Help functions
-#=========================================================================
-def removeFile(theFileName):
-    try: os.remove(theFileName)
-    except OSError: pass
-    assert not os.path.exists(theFileName), \
-            "Can not remove file {0}".format(theFileName)
-
-#=========================================================================
-# test Export STL 
-#=========================================================================
-def testExportSTL(theFile, theDelta, theErrorExpected = False):
-
-    model.begin()
-    partSet = model.moduleDocument()
-    Part_1 = model.addPart(partSet)
-    Part_1_doc = Part_1.document()
-    Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-    Box_2 = model.addBox(Part_1_doc, 20, 20, 20)
-    model.do()
-
-    # First export to GEOM
-    model.exportToGEOM(Part_1_doc)
-    model.end()
-
-    theSurface = 600
-
-    print("theFile=",theFile)
-
-    # deflection relative 0.0001 et Ascii 
-    model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID","Box_1_1"),0.0001, 0.5, True,False)
-
- #==   assert os.path.exists(theFile)
-        
-    # Check results
-    test_stl_1 = geompy.ImportSTL(theFile)
-    Props = geompy.BasicProperties(test_stl_1)
-    print("\nBasic Properties:")
-    print(" Wires length: ", Props[0])
-    print(" Surface area: ", Props[1])
-    print(" Volume      : ", Props[2])
-
-    aRefSurface = theSurface
-    aResSurface = Props[1]
-    assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface)
-    
-    removeFile(theFile)
-
-    theSurface =  600
-    # deflection relative 0.0001 et binaire
-    model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID", "Box_1_1" ),0.0001, 0.5, True,True)
-
-    # Check results
-    test_stl_1 = geompy.ImportSTL(theFile)
-    Props = geompy.BasicProperties(test_stl_1)
-    print("\nBasic Properties:")
-    print(" Wires length: ", Props[0])
-    print(" Surface area: ", Props[1])
-    print(" Volume      : ", Props[2])
-
-    aRefSurface = theSurface
-    aResSurface = Props[1]
-    assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface)
-    
-    removeFile(theFile)
-
-    theSurface =  600
-    # deflection absolue et AScii
-    model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID", "Box_1_1" ),0.0001, 0.5, False, False)
-
-    # Check results
-    test_stl_1 = geompy.ImportSTL(theFile)
-    Props = geompy.BasicProperties(test_stl_1)
-    print("\nBasic Properties:")
-    print(" Wires length: ", Props[0])
-    print(" Surface area: ", Props[1])
-    print(" Volume      : ", Props[2])
-
-    aRefSurface = theSurface
-    aResSurface = Props[1]
-    assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface)
-
-    theSurface =  600
-    # deflection absolue et binaire
-    model.exportToSTL(Part_1_doc, theFile, model.selection("SOLID", "Box_1_1" ),0.0001, 0.5, False,True)
-
-    # Check results
-    test_stl_1 = geompy.ImportSTL(theFile)
-    Props = geompy.BasicProperties(test_stl_1)
-    print("\nBasic Properties:")
-    print(" Wires length: ", Props[0])
-    print(" Surface area: ", Props[1])
-    print(" Volume      : ", Props[2])
-
-    aRefSurface = theSurface
-    aResSurface = Props[1]
-    assert (math.fabs(aResSurface - aRefSurface) < theDelta), "The volume is wrong: expected = {0}, real = {1}".format(aRefSurface, aResSurface)
-
-    model.end()
-
-if __name__ == '__main__':
-    with TemporaryDirectory() as tmp_dir:
-        aRealSurface = 0.00192878
-        #=========================================================================
-        # Export a shape into STL
-        #=========================================================================
-        testExportSTL(os.path.join(tmp_dir, "export.stl"), 10 ** -5, True)
-        #=========================================================================
-        # End of test
-        #=========================================================================
diff --git a/src/ConnectorAPI/Test/TestImportSTEP.py b/src/ConnectorAPI/Test/TestImportSTEP.py
deleted file mode 100644 (file)
index f6094c1..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright (C) 2014-2020  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
-#
-
-"""
-      TestImportStep.py
-      Unit test of ExchangePlugin_ImportFeature class for STEP 
-"""
-#=========================================================================
-# Initialization of the test
-#=========================================================================
-
-import salome
-
-import os
-import math
-from tempfile import TemporaryDirectory
-
-import GEOM
-
-from ModelAPI import *
-
-from salome.shaper import model
-
-from salome.geom import geomBuilder
-
-from GeomAPI import GeomAPI_Shape
-
-from GeomAlgoAPI import *
-
-__updated__ = "2015-05-22"
-
-salome.salome_init(1)
-geompy = geomBuilder.New()
-
-#=========================================================================
-# Help functions
-#=========================================================================
-def removeFile(theFileName):
-    try: os.remove(theFileName)
-    except OSError: pass
-    assert not os.path.exists(theFileName), \
-            "Can not remove file {0}".format(theFileName)
-
-#=========================================================================
-# test Import STEP 
-#=========================================================================
-def testImportSTEP():
-
-    model.begin()
-    partSet = model.moduleDocument()
-    Part_1 = model.addPart(partSet)
-    Part_1_doc = Part_1.document()
-    aShapePath = os.path.join(os.getenv("DATA_DIR"), "Shapes", "Step", "black_and_white.step")
-    print("aShapePath=",aShapePath)
-    Import_1 = model.addImportStep(Part_1_doc,aShapePath, True, True, True)
-
-    model.do()
-
-    # Check results
-    Import_1_Feature = Import_1.feature()
-    assert Import_1_Feature.error() == ''
-    assert Import_1_Feature.name() == "black_and_white"
-    assert len(Import_1_Feature.results()) == 1
-    model.testNbSubShapes(Import_1, GeomAPI_Shape.SOLID, [2])
-
-    aCompositeFeature = featureToCompositeFeature(Import_1_Feature)
-    assert aCompositeFeature.numberOfSubs(False) == 2
-
-    aFeature1 = aCompositeFeature.subFeature(0, False)
-    assert aFeature1.getKind() == "Group"
-    assert aFeature1.name() == "Color_1"
-
-    aSelectionList = aFeature1.selectionList("group_list")
-    assert aSelectionList.size() == 1
-
-    aFeature1 = aCompositeFeature.subFeature(1, False)
-    assert aFeature1.getKind() == "Group"
-    assert aFeature1.name() == "Color_2"
-
-    aSelectionList = aFeature1.selectionList("group_list")
-    assert aSelectionList.size() == 1
-
-    aFeature1 = aCompositeFeature.subFeature(2, False)
-    assert aFeature1.getKind() == "Group"
-    assert aFeature1.name() == "Material_black"
-
-    aSelectionList = aFeature1.selectionList("group_list")
-    assert aSelectionList.size() == 1
-
-
-    aFeature1 = aCompositeFeature.subFeature(3, False)
-    assert aFeature1.getKind() == "Group"
-    assert aFeature1.name() == "Material_white"
-
-    aSelectionList = aFeature1.selectionList("group_list")
-    assert aSelectionList.size() == 1
-
-    model.end()
-
-if __name__ == '__main__':
-    with TemporaryDirectory() as tmp_dir:
-        #=========================================================================
-        # Export a shape into STL
-        #=========================================================================
-        testImportSTEP()
-        #=========================================================================
-        # End of test
-        #=========================================================================
index b61f22ce9a20a675cce9f89aa4cca82e82da9b13..bdf5bcb345ffd454bd8bde502f7e3765f6bacb81 100644 (file)
@@ -33,14 +33,12 @@ SET(PROJECT_SOURCES
 SET(PROJECT_LIBRARIES
   ModelAPI
   ModelHighAPI
-  GeomAlgoAPI
 )
 
 INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/Events
   ${PROJECT_SOURCE_DIR}/src/ModelAPI
   ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
-  ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
 )
 
 # Plugin headers dependency
index 4e9b4b9c3a179b7483b33ff121301d5f3690df0e..000e178abdc874dff99814310bae3a905abbb4c6 100644 (file)
@@ -53,51 +53,6 @@ ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>&
   apply(); // finish operation to make sure the export is done on the current state of the history
 }
 
-// Constructor with values for STL of selected result export.
-ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                       const std::string & theFilePath,
-                                       const ModelHighAPI_Selection& theSelectedShape,
-                                       double aDeflectionRelative,
-                                       double aDeflectionAbsolute,
-                                       const bool anIsRelative, 
-                                       const bool anIsASCII)
-  : ModelHighAPI_Interface(theFeature)
-{
-  initialize();
-  fillAttribute("STL", theFeature->string(ExchangePlugin_ExportFeature::EXPORT_TYPE_ID()));
-  fillAttribute(theFilePath, theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID()));
-   
-  if (anIsRelative) {
-    fillAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(), 
-      theFeature->string(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE()) );
-    fillAttribute(aDeflectionRelative, 
-      theFeature->real(ExchangePlugin_ExportFeature::STL_RELATIVE()) ); 
-  }
-  else {
-    fillAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(), 
-      theFeature->string(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE()) );
-    fillAttribute(aDeflectionAbsolute, 
-      theFeature->real(ExchangePlugin_ExportFeature::STL_ABSOLUTE()) );
-  }
-
-  if(anIsASCII){
-    fillAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE_ASCII(), 
-      theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_TYPE()));
-  }
-  else
-  {
-    fillAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY(), 
-      theFeature->string(ExchangePlugin_ExportFeature::STL_FILE_TYPE()));
-  }
-  
-  fillAttribute(theSelectedShape,theFeature->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED()));
-  fillAttribute("STL", theFeature->string(ExchangePlugin_ExportFeature::FILE_FORMAT_ID()));
-  execute();
-  apply(); // finish operation to make sure the export is done on the current state of the history
-}
-
-
-
 ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const std::string & theFilePath, const ModelHighAPI_Selection& theResult,
   const std::string & theAuthor, const std::string & theGeometryName)
@@ -119,7 +74,6 @@ ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>&
 }
 
 
-
 /// Constructor with values for export in other formats than XAO.
 ExchangeAPI_Export::ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                               const std::string & theFilePath,
@@ -190,33 +144,6 @@ void ExchangeAPI_Export::dump(ModelHighAPI_Dumper& theDumper) const
       theDumper << ", '" << theGeometryName << "'";
     theDumper << ")" << std::endl;
   }
-  else if (exportType == "STL") {
-    std::string aTmpSTLFile =
-                aBase->string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())->value();
-    correctSeparators(aTmpSTLFile);
-    theDumper << "exportToSTL(" << aDocName << ", '" << aTmpSTLFile << "'" ;
-    AttributeSelectionPtr aShapeSelected =
-      aBase->selection(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED());
-
-    theDumper<<","<< aShapeSelected;
-    
-    theDumper <<","<<  stlabsolute() <<","<< stlrelative();
-
-    if (stldeflectionType()->value() == ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE()) {
-      theDumper <<","<< "True";
-    }
-    else {
-      theDumper <<","<< "False";
-    }
-    
-    if (stlfileType()->value() == ExchangePlugin_ExportFeature::STL_FILE_TYPE_BINARY()) {
-      theDumper << "False";
-    }
-    else {
-      theDumper <<  "True";
-    }
-    theDumper << ")" << std::endl;
-  }
   else {
     std::string aFilePath = aBase->string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->value();
     correctSeparators(aFilePath);
@@ -252,27 +179,6 @@ ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
   return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theAuthor, theGeometryName));
 }
 
-ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
-      const std::string & theFilePath,
-      const ModelHighAPI_Selection& theSelectedShape,
-      double  aDeflectionRelative,
-      double  aDeflectionAbsolute,
-      const bool anIsRelative, 
-      const bool anIsASCII)
-{
-  apply(); // finish previous operation to make sure all previous operations are done
-  std::shared_ptr<ModelAPI_Feature> aFeature =
-    thePart->addFeature(ExchangePlugin_ExportFeature::ID());
-
-  return ExportPtr(new ExchangeAPI_Export(aFeature,
-                                          theFilePath,
-                                          theSelectedShape,
-                                          aDeflectionRelative,
-                                          aDeflectionAbsolute,
-                                          anIsRelative,
-                                          anIsASCII));                                    
-}
-
 ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
   const std::string & theFilePath, const ModelHighAPI_Selection& theSelectedShape,
   const std::string & /*theAuthor*/, const std::string & /*theGeometryName*/)
index d867da1bff66feaacdbbcc285e2b00458078122d..24211c9fa7d154b784ed2cc7fe2ca4541d8f1510 100644 (file)
@@ -51,16 +51,6 @@ public:
                               const std::string & theFilePath,
                               const std::string & theAuthor = std::string(),
                               const std::string & theGeometryName = std::string());
-  
-  /// Constructor with values for STL of selected result export.
-  EXCHANGEAPI_EXPORT
-    explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                const std::string & theFilePath,
-                                const ModelHighAPI_Selection& theSelectedShape,
-                                double  aDeflectionRelative ,
-                                double  aDeflectionAbsolute,
-                                const bool anIsRelative, 
-                                const bool anIsASCII);
 
   /// Constructor with values for XAO of selected result export.
   EXCHANGEAPI_EXPORT
@@ -81,7 +71,7 @@ public:
   EXCHANGEAPI_EXPORT
   virtual ~ExchangeAPI_Export();
 
-  INTERFACE_15(ExchangePlugin_ExportFeature::ID(),
+  INTERFACE_7(ExchangePlugin_ExportFeature::ID(),
              exportType, ExchangePlugin_ExportFeature::EXPORT_TYPE_ID(),
              ModelAPI_AttributeString, /** ExportType */,
              filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(),
@@ -95,23 +85,7 @@ public:
              xaoAuthor, ExchangePlugin_ExportFeature::XAO_AUTHOR_ID(),
              ModelAPI_AttributeString, /** xao author */,
              xaoGeometryName, ExchangePlugin_ExportFeature::XAO_GEOMETRY_NAME_ID(),
-             ModelAPI_AttributeString, /** xao geometry name */,
-             stlFilePath, ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
-             ModelAPI_AttributeString, /** stl_file_path */,
-             stlobjectselected, ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(),
-             ModelAPI_AttributeSelection, /** Object selected to export in stl file*/,
-             stldeflectionType, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
-             ModelAPI_AttributeString, /** Type of the defelection */,
-             stlrelative, ExchangePlugin_ExportFeature::STL_RELATIVE(),
-             ModelAPI_AttributeDouble, /** Relative*/,
-             stlabsolute, ExchangePlugin_ExportFeature::STL_ABSOLUTE(),
-             ModelAPI_AttributeDouble, /** Absolute */,
-             stlfileType, ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
-             ModelAPI_AttributeString, /** Type of the stl file*/,
-             stldeflectionTypeabsolute, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_ABSOLUTE(),
-             ModelAPI_AttributeString, /** Type of the defelection */,
-             stldeflectionTyperelative, ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE_RELATIVE(),
-             ModelAPI_AttributeString, /** Type of the defelection */)
+             ModelAPI_AttributeString, /** xao geometry name */)
 
   /// Dump wrapped feature
   EXCHANGEAPI_EXPORT
@@ -139,18 +113,6 @@ ExportPtr exportToXAO(const std::shared_ptr<ModelAPI_Document> & thePart,
                  const std::string & theAuthor = std::string(),
                  const std::string & theGeometryName = std::string());
 
-/**\ingroup CPPHighAPI
- * \brief Exports to STL file the result of the current document
- */
-EXCHANGEAPI_EXPORT
-ExportPtr exportToSTL(const std::shared_ptr<ModelAPI_Document> & thePart,
-      const std::string & theFilePath,
-      const ModelHighAPI_Selection& theSelectedShape,
-      double  aDeflectionRelative,
-      double  aDeflectionAbsolute,
-      const bool anIsRelative, 
-      const bool anIsASCII);
-
 /**\ingroup CPPHighAPI
 * \brief Exports to XAO file the selected result with groups parts related to it only.
 */
index d5d7ea2a98206757dbdcfb2793f0e2ede05d1c05..b1a6c832d0cee6027f99b2ae059de409be245b16 100644 (file)
@@ -28,8 +28,6 @@
 #include <ModelAPI_AttributeStringArray.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Tools.h>
-#include <GeomAlgoAPI_Tools.h>
-
 //--------------------------------------------------------------------------------------
 #include <algorithm>
 
@@ -49,43 +47,16 @@ ExchangeAPI_Import::ExchangeAPI_Import(
     setFilePath(theFilePath);
 }
 
-ExchangeAPI_Import::ExchangeAPI_Import(
-    const std::shared_ptr<ModelAPI_Feature> & theFeature,
-    const std::string & theFilePath,
-    const bool  anScalInterUnits,
-    const bool  anMaterials,
-    const bool  anColor)
-: ModelHighAPI_Interface(theFeature)
-{
-  if (initialize())
-    setParameters(theFilePath,anScalInterUnits,anMaterials,anColor);
-}
-
 ExchangeAPI_Import::~ExchangeAPI_Import()
 {
 
 }
 
-//--------------------------------------------------------------------------------------
-void ExchangeAPI_Import::setParameters(const std::string & theFilePath, 
-                                       const bool  anScalInterUnits,
-                                       const bool  anMaterials,
-                                       const bool  anColor)
-{
-  fillAttribute(theFilePath, mystepfilePath);
-  fillAttribute("STEP", feature()->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()));
-  fillAttribute(anScalInterUnits, feature()->boolean(ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID()));
-  fillAttribute(anMaterials, feature()->boolean(ExchangePlugin_ImportFeature::STEP_MATERIALS_ID()));
-  fillAttribute(anColor, feature()->boolean(ExchangePlugin_ImportFeature::STEP_COLORS_ID()));
-  execute();
-}
-
 //--------------------------------------------------------------------------------------
 void ExchangeAPI_Import::setFilePath(const std::string & theFilePath)
 {
   fillAttribute(theFilePath, myfilePath);
-  std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFilePath);
-  fillAttribute(anExtension, feature()->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID()));
+
   execute();
 }
 
@@ -95,16 +66,7 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const
   FeaturePtr aBase = feature();
   std::string aPartName = theDumper.name(aBase->document());
 
-  AttributeStringPtr aImportTypeAttr = aBase->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID());
-  std::string aFormat = aImportTypeAttr->value();
-  std::string aFilePath;
-  if (aFormat == "STEP" || aFormat == "STP")
-  {
-    aFilePath = aBase->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID())->value();
-  }else{
-    aFilePath = aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID())->value();
-  }
-
+  std::string aFilePath = aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID())->value();
   std::string aFrom = "\\";
   std::string aTo = "\\\\";
   for(std::size_t aPos = aFilePath.find(aFrom);
@@ -113,19 +75,9 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const
     aFilePath.replace(aPos, aFrom.size(), aTo);
     aPos += aTo.size();
   }
-  std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath);
-  if( anExtension == "STP" || anExtension == "STEP"){
-      theDumper << aBase << " = model.addImportStep(" << aPartName << ", \""
-                << aFilePath << "\"" ;
-
-      theDumper << ", " << scalinterunits()->value() 
-                << ", " << materials()->value()
-                << ", " << colors()->value() << ")"<< std::endl;
-  }else{
-      theDumper << aBase << " = model.addImport(" << aPartName << ", \""
-            << aFilePath << "\")" << std::endl;
-  }
 
+  theDumper << aBase << " = model.addImport(" << aPartName << ", \""
+            << aFilePath << "\")" << std::endl;
   // to make import have results
   theDumper << "model.do()" << std::endl;
 
@@ -150,18 +102,6 @@ ImportPtr addImport(
   return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath));
 }
 
-ImportPtr addImportStep(
-    const std::shared_ptr<ModelAPI_Document> & thePart,
-    const std::string & theFilePath,
-    const bool  anScalInterUnits,
-    const bool  anMaterials,
-    const bool  anColor )
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Import::ID());
-  return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath,
-                                          anScalInterUnits, anMaterials, anColor));
-}
-
 void importPart(const std::shared_ptr<ModelAPI_Document> & thePart,
                 const std::string & theFilePath,
                 const ModelHighAPI_Reference & theAfterThis)
index d95a453895a69fab6d627c18f79e17493085cbc6..f38db9bbba537c85166dbb7494e83f8461e54094 100644 (file)
@@ -46,43 +46,18 @@ public:
   EXCHANGEAPI_EXPORT
   ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
                      const std::string & theFilePath);
-
-  /// Constructor with values for Step file
-  EXCHANGEAPI_EXPORT
-  ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
-                     const std::string & theFilePath,
-                     const bool  anScalInterUnits,
-                     const bool  anMaterials,
-                     const bool  anColor);
-                     
   /// Destructor
   EXCHANGEAPI_EXPORT
   virtual ~ExchangeAPI_Import();
 
-  INTERFACE_6(ExchangePlugin_ImportFeature::ID(),
+  INTERFACE_1(ExchangePlugin_ImportFeature::ID(),
               filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(),
-              ModelAPI_AttributeString, /** File path */,
-              stepimporttype, ExchangePlugin_ImportFeature::IMPORT_TYPE_ID(),
-              ModelAPI_AttributeString, /**import type */,
-              stepfilePath, ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID(),
-              ModelAPI_AttributeString, /**step File path */,
-              scalinterunits, ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID(),
-              ModelAPI_AttributeBoolean, /** Scale internationals units */,
-              materials, ExchangePlugin_ImportFeature::STEP_MATERIALS_ID(),
-              ModelAPI_AttributeBoolean, /** Materials */,
-              colors, ExchangePlugin_ImportFeature::STEP_COLORS_ID(),
-              ModelAPI_AttributeBoolean, /** Colors */
+              ModelAPI_AttributeString, /** File path */
   )
 
   /// Set point values
   EXCHANGEAPI_EXPORT
   void setFilePath(const std::string & theFilePath);
-  
-  EXCHANGEAPI_EXPORT
-  void setParameters(const std::string & theFilePath, 
-                     const bool  anScalInterUnits,
-                     const bool  anMaterials,
-                     const bool  anColor);
 
   /// Dump wrapped feature
   EXCHANGEAPI_EXPORT
@@ -99,16 +74,6 @@ EXCHANGEAPI_EXPORT
 ImportPtr addImport(const std::shared_ptr<ModelAPI_Document> & thePart,
                     const std::string & theFilePath);
 
-/**\ingroup CPPHighAPI
- * \brief Create Import Step feature
- */
-EXCHANGEAPI_EXPORT
-ImportPtr addImportStep(const std::shared_ptr<ModelAPI_Document> & thePart,
-                        const std::string & theFilePath,
-                        const bool  anScalInterUnits,
-                        const bool  anMaterials,
-                        const bool  anColor);
-                    
 /** \ingroup CPPHighAPI
  *  \brief Import features from the file to the document after the current feature (or to the end).
  */
index 3df98beceac4beaa7da4148038a009671167d085..67880c8e64ff524ad3394591e577cbc9ae9a4117 100644 (file)
@@ -31,7 +31,6 @@ INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/Events
                     ${PROJECT_SOURCE_DIR}/src/XAO
                     ${PROJECT_SOURCE_DIR}/src/ConstructionPlugin
                     ${PROJECT_SOURCE_DIR}/src/PartSetPlugin
-                    ${OpenCASCADE_INCLUDE_DIR}
 )
 
 SET(PROJECT_HEADERS
index 6a8f36cb1792a0fc7ee3e13bcf1bd6ae4a08d8dc..d898a08e5dd8895c829986908eed8143629eae56 100644 (file)
@@ -27,7 +27,6 @@
 #include <ostream>
 #endif
 
-
 #include <Config_Common.h>
 #include <Config_PropManager.h>
 
@@ -35,7 +34,6 @@
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_IGESExport.h>
 #include <GeomAlgoAPI_STEPExport.h>
-#include <GeomAlgoAPI_STLExport.h>
 #include <GeomAlgoAPI_Tools.h>
 #include <GeomAlgoAPI_XAOExport.h>
 
@@ -50,7 +48,6 @@
 #include <ModelAPI_AttributeStringArray.h>
 #include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_AttributeTables.h>
-#include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Object.h>
@@ -71,8 +68,6 @@
 
 #include <ExchangePlugin_Tools.h>
 
-#include <ModelAPI_ResultConstruction.h>
-
 ExchangePlugin_ExportFeature::ExchangePlugin_ExportFeature()
 {
 }
@@ -103,27 +98,9 @@ void ExchangePlugin_ExportFeature::initAttributes()
     ModelAPI_AttributeString::typeId());
   data()->addAttribute(ExchangePlugin_ExportFeature::XAO_SELECTION_LIST_ID(),
     ModelAPI_AttributeSelectionList::typeId());
-  data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID(),
-    ModelAPI_AttributeString::typeId());
-  data()->addAttribute(ExchangePlugin_ExportFeature::STL_OBJECT_SELECTED(), 
-    ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(ExchangePlugin_ExportFeature::STL_DEFLECTION_TYPE(),
-   ModelAPI_AttributeString::typeId());
-  data()->addAttribute(ExchangePlugin_ExportFeature::STL_RELATIVE(), 
-    ModelAPI_AttributeDouble::typeId());
-   
-  double defelection = Config_PropManager::real("Visualization", "body_deflection");
-  real(ExchangePlugin_ExportFeature::STL_RELATIVE())->setValue(defelection);
-
-  data()->addAttribute(ExchangePlugin_ExportFeature::STL_ABSOLUTE(), 
-    ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(ExchangePlugin_ExportFeature::STL_FILE_TYPE(),
-   ModelAPI_AttributeString::typeId());
 
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
     ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
-    ExchangePlugin_ExportFeature::STL_FILE_PATH_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
     ExchangePlugin_ExportFeature::XAO_AUTHOR_ID());
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
@@ -151,11 +128,6 @@ void ExchangePlugin_ExportFeature::attributeChanged(const std::string& theID)
     string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
       string(ExchangePlugin_ExportFeature::XAO_FILE_PATH_ID())->value());
   }
-  else if (theID == STL_FILE_PATH_ID()) {
-    string(ExchangePlugin_ExportFeature::FILE_PATH_ID())->setValue(
-      string(ExchangePlugin_ExportFeature::STL_FILE_PATH_ID())->value());
-  }
-
 }
 
 /*
@@ -198,9 +170,6 @@ void ExchangePlugin_ExportFeature::exportFile(const std::string& theFileName,
   if (aFormatName == "XAO") {
     exportXAO(theFileName);
     return;
-  }else if (aFormatName == "STL") {
-    exportSTL(theFileName);
-    return;
   }
 
   // make shape for export from selected shapes
@@ -347,49 +316,6 @@ static bool isInResults(AttributeSelectionListPtr theSelection,
   return false;
 }
 
-void ExchangePlugin_ExportFeature::exportSTL(const std::string& theFileName)
-{
-  // Get shape.
-  AttributeSelectionPtr aSelection = selection(STL_OBJECT_SELECTED());
-  GeomShapePtr aShape = aSelection->value();
-  if (!aShape.get()) {
-    aShape = aSelection->context()->shape();
-  }
-
-  // Get relative value and percent flag.
-  double aValue;
-  bool anIsRelative = false;
-  bool anIsASCII = false;
-
-  if (string(STL_DEFLECTION_TYPE())->value() == STL_DEFLECTION_TYPE_RELATIVE()) {
-    aValue = real(STL_RELATIVE())->value();
-    anIsRelative = true;
-  } else {
-    aValue = real(STL_ABSOLUTE())->value();
-  }
-
-  if (string(STL_FILE_TYPE())->value() == STL_FILE_TYPE_ASCII()) {
-    anIsASCII = true;
-  }            
-  // Perform the export
-  std::string anError;
-  bool aResult = false;
-
-  aResult = STLExport(theFileName,
-                      "STL",
-                      aShape,
-                      aValue,
-                      anIsRelative, 
-                      anIsASCII,
-                      anError);
-
-  if (!aResult || !anError.empty()) {
-    setError("An error occurred while exporting " + theFileName + ": " + anError);
-    return;
-  }
-}
-
-
 void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
 {
   try {
index bc975ea5b7de9c76f8e22458a706fb66301e7bbc..1067d99af198ae4e40eb110cb456af766e0fa68c 100644 (file)
@@ -60,66 +60,6 @@ public:
     static const std::string MY_XAO_FILE_PATH_ID("xao_file_path");
     return MY_XAO_FILE_PATH_ID;
   }
-  /// attribute name of stl file path
-  inline static const std::string& STL_FILE_PATH_ID()
-  {
-    static const std::string MY_STL_FILE_PATH_ID("stl_file_path");
-    return MY_STL_FILE_PATH_ID;
-  }
-  /// Attribute name for selected object to export in stl file path.
-  inline static const std::string& STL_OBJECT_SELECTED()
-  {
-    static const std::string ATTR_ID("stl_object_selected");
-    return ATTR_ID;
-  }
-  /// Attribute name for deflection type.
-  inline static const std::string& STL_DEFLECTION_TYPE()
-  {
-    static const std::string ATTR_ID("stl_deflection_type");
-    return ATTR_ID;
-  }
-  /// Attribute name for deflection type relative.
-  inline static const std::string& STL_DEFLECTION_TYPE_RELATIVE()
-  {
-    static const std::string ATTR_ID("stl_deflection_type_relative");
-    return ATTR_ID;
-  }
-  /// Attribute name for deflection type absolute.
-  inline static const std::string& STL_DEFLECTION_TYPE_ABSOLUTE()
-  {
-    static const std::string ATTR_ID("stl_deflection_type_absolute");
-    return ATTR_ID;
-  }
-  /// Attribute name for relative.
-  inline static const std::string& STL_RELATIVE()
-  {
-    static const std::string ATTR_ID("stl_relative");
-    return ATTR_ID;
-  }
-  /// Attribute name for absolute.
-  inline static const std::string& STL_ABSOLUTE()
-  {
-    static const std::string ATTR_ID("stl_absolute");
-    return ATTR_ID;
-  }
-  /// Attribute name for stl file type.
-  inline static const std::string& STL_FILE_TYPE()
-  {
-    static const std::string ATTR_ID("stl_file_type");
-    return ATTR_ID;
-  }
-  /// Attribute name for stl file type ascii.
-  inline static const std::string& STL_FILE_TYPE_ASCII()
-  {
-    static const std::string ATTR_ID("stl_file_type_acii");
-    return ATTR_ID;
-  }
-  /// Attribute name for stl file type binary.
-  inline static const std::string& STL_FILE_TYPE_BINARY()
-  {
-    static const std::string ATTR_ID("stl_file_type_binary");
-    return ATTR_ID;
-  }
   /// attribute name of file format
   inline static const std::string& FILE_FORMAT_ID()
   {
@@ -189,9 +129,6 @@ protected:
 
   /// Performs export to XAO file
   EXCHANGEPLUGIN_EXPORT void exportXAO(const std::string& theFileName);
-
-  /// Performs export to STL file
-  EXCHANGEPLUGIN_EXPORT void exportSTL(const std::string& theFileName);
 };
 
 #endif /* EXPORT_EXPORTFEATURE_H_ */
index 304d456d56f2e717157ad259f4e10e4c3b9e214a..b5a51ff08fa248e1e6fec471595c98dd08c62bc1 100644 (file)
@@ -27,7 +27,6 @@
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_AttributeStringArray.h>
-#include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ResultPart.h>
 #include <ModelAPI_Tools.h>
@@ -82,15 +81,8 @@ ExchangePlugin_Import::~ExchangePlugin_Import()
 void ExchangePlugin_Import::initAttributes()
 {
   data()->addAttribute(FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
-  data()->addAttribute(STEP_FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
-  data()->addAttribute(IMPORT_TYPE_ID(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(TARGET_PART_ID(), ModelAPI_AttributeInteger::typeId());
   data()->addAttribute(TARGET_PARTS_LIST_ID(), ModelAPI_AttributeStringArray::typeId());
-  data()->addAttribute(STEP_TARGET_PART_ID(), ModelAPI_AttributeInteger::typeId());
-  data()->addAttribute(STEP_TARGET_PARTS_LIST_ID(), ModelAPI_AttributeStringArray::typeId());
-  data()->addAttribute(STEP_MATERIALS_ID(), ModelAPI_AttributeBoolean::typeId());
-  data()->addAttribute(STEP_COLORS_ID(), ModelAPI_AttributeBoolean::typeId());
-  data()->addAttribute(STEP_SCALE_INTER_UNITS_ID(), ModelAPI_AttributeBoolean::typeId());
 }
 
 /*
@@ -98,61 +90,26 @@ void ExchangePlugin_Import::initAttributes()
  */
 void ExchangePlugin_Import::execute()
 {
-  AttributeStringPtr aFormatAttr =
-      this->string(ExchangePlugin_Import::IMPORT_TYPE_ID());
-  std::string aFormat = aFormatAttr->value();
-
-  AttributeStringPtr aFilePathAttr;
-  std::string aFilePath;
-  AttributeStringArrayPtr aPartsAttr;
-  AttributeIntegerPtr aTargetAttr;
-  if (aFormat == "STEP" || aFormat == "STP")
-  {
-    aFilePathAttr = string(ExchangePlugin_Import::STEP_FILE_PATH_ID());
-    aFilePath = aFilePathAttr->value();    
-    // get the document where to import
-    aPartsAttr = stringArray(STEP_TARGET_PARTS_LIST_ID());
-    aTargetAttr = integer(STEP_TARGET_PART_ID());
-  }else{
-    aFilePathAttr = string(ExchangePlugin_Import::FILE_PATH_ID());
-    aFilePath = aFilePathAttr->value();
-    // get the document where to import
-    aPartsAttr = stringArray(TARGET_PARTS_LIST_ID());
-    aTargetAttr = integer(TARGET_PART_ID());
-  }
-
+  AttributeStringPtr aFilePathAttr = string(ExchangePlugin_Import::FILE_PATH_ID());
+  std::string aFilePath = aFilePathAttr->value();
   if (aFilePath.empty()) {
-      setError("File path is empty.");
-      return;
+    setError("File path is empty.");
+    return;
   }
+
+  // get the document where to import
+  AttributeStringArrayPtr aPartsAttr = stringArray(TARGET_PARTS_LIST_ID());
+  AttributeIntegerPtr aTargetAttr = integer(TARGET_PART_ID());
   SessionPtr aSession = ModelAPI_Session::get();
-  DocumentPtr aDoc = findDocument(aSession->moduleDocument(),
+  DocumentPtr aDoc =
+    findDocument(aSession->moduleDocument(),
       Locale::Convert::toWString(aPartsAttr->value(aTargetAttr->value())));
 
   if (aDoc.get()) {
     FeaturePtr aImportFeature = aDoc->addFeature(ExchangePlugin_ImportFeature::ID());
     DataPtr aData = aImportFeature->data();
-    AttributeStringPtr aPathAttr;
-    if (aFormat == "STEP" || aFormat == "STP")
-    {
-      aPathAttr = aData->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID());
-    }else
-    {
-      aPathAttr = aData->string(ExchangePlugin_ImportFeature::FILE_PATH_ID());
-    }
-    
-    AttributeStringPtr aImportTypeAttr = aData->string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID());
-
-    aData->boolean(ExchangePlugin_ImportFeature::STEP_MATERIALS_ID())
-         ->setValue(boolean(ExchangePlugin_Import::STEP_MATERIALS_ID())->value());
-    aData->boolean(ExchangePlugin_ImportFeature::STEP_COLORS_ID())
-         ->setValue(boolean(ExchangePlugin_Import::STEP_COLORS_ID())->value());
-    aData->boolean(ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID())
-         ->setValue(boolean(ExchangePlugin_Import::STEP_SCALE_INTER_UNITS_ID())->value());
-
+    AttributeStringPtr aPathAttr = aData->string(ExchangePlugin_ImportFeature::FILE_PATH_ID());
     aPathAttr->setValue(aFilePathAttr->value());
-    aImportTypeAttr->setValue(aFormat);
-
     aImportFeature->execute();
   }
 }
@@ -160,31 +117,14 @@ void ExchangePlugin_Import::execute()
 
 void ExchangePlugin_Import::attributeChanged(const std::string& theID)
 {
-  AttributeStringPtr aFilePathAttr;
-  AttributeStringArrayPtr aPartsAttr;
-  AttributeIntegerPtr aTargetAttr;
-
-  if (theID == FILE_PATH_ID() ||theID == STEP_FILE_PATH_ID() ) {
-    aFilePathAttr = string(FILE_PATH_ID());
-    if (theID == FILE_PATH_ID() && aFilePathAttr->value().empty())
+  if (theID == FILE_PATH_ID()) {
+    AttributeStringPtr aFilePathAttr = string(FILE_PATH_ID());
+    if (aFilePathAttr->value().empty())
       return;
-    aPartsAttr = stringArray(TARGET_PARTS_LIST_ID());
-    aTargetAttr = integer(TARGET_PART_ID());
-
-    updatePart(aPartsAttr, aTargetAttr);
 
-    aFilePathAttr = string(STEP_FILE_PATH_ID());
-    if (theID == STEP_FILE_PATH_ID() && aFilePathAttr->value().empty())
-      return;
+    AttributeStringArrayPtr aPartsAttr = stringArray(TARGET_PARTS_LIST_ID());
+    AttributeIntegerPtr aTargetAttr = integer(TARGET_PART_ID());
 
-    aPartsAttr = stringArray(STEP_TARGET_PARTS_LIST_ID());
-    aTargetAttr = integer(STEP_TARGET_PART_ID());
-    updatePart(aPartsAttr, aTargetAttr);
-   } 
-}
-
-void ExchangePlugin_Import::updatePart(AttributeStringArrayPtr &aPartsAttr, AttributeIntegerPtr &aTargetAttr)
-{
     // update the list of target parts
     SessionPtr aSession = ModelAPI_Session::get();
     DocumentPtr aDoc = document();
@@ -219,4 +159,5 @@ void ExchangePlugin_Import::updatePart(AttributeStringArrayPtr &aPartsAttr, Attr
         aTargetAttr->setValue(0);
       }
     }
+  }
 }
index 38d3e05e7b2e2dc48a87b9047c58f44c4decacb1..c09b3ebab9b353b758199118d8768ace211621f9 100644 (file)
@@ -24,8 +24,6 @@
 
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_Result.h>
-#include <ModelAPI_AttributeInteger.h>
-#include <ModelAPI_AttributeStringArray.h>
 
 #include <map>
 
@@ -45,12 +43,6 @@ class ExchangePlugin_Import : public ModelAPI_Feature
     static const std::string MY_IMPORT_ID("ImportMacro");
     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;
-  }
   /// attribute name of file path
   inline static const std::string& FILE_PATH_ID()
   {
@@ -69,42 +61,6 @@ class ExchangePlugin_Import : public ModelAPI_Feature
     static const std::string MY_TARGET_PARTS_LIST_ID("target_parts_list");
     return MY_TARGET_PARTS_LIST_ID;
   }
-  /// attribute name of step file path
-  inline static const std::string& STEP_FILE_PATH_ID()
-  {
-    static const std::string MY_STEP_FILE_PATH_ID("step_file_path");
-    return MY_STEP_FILE_PATH_ID;
-  }
-  /// attribute name of step target part
-  inline static const std::string& STEP_TARGET_PART_ID()
-  {
-    static const std::string MY_STEP_TARGET_PART_ID("step_target_part");
-    return MY_STEP_TARGET_PART_ID;
-  }
-  /// attribute name of list ofstep target parts
-  inline static const std::string& STEP_TARGET_PARTS_LIST_ID()
-  {
-    static const std::string MY_STEP_TARGET_PARTS_LIST_ID("step_target_parts_list");
-    return MY_STEP_TARGET_PARTS_LIST_ID;
-  }
-  /// attribute name of step Scale to International System Units
-  inline static const std::string& STEP_SCALE_INTER_UNITS_ID()
-  {
-    static const std::string MY_STEP_SCALE_INTER_UNITS_ID("step_scale_inter_units");
-    return MY_STEP_SCALE_INTER_UNITS_ID;
-  }
-  /// attribute name of step materiels
-  inline static const std::string& STEP_MATERIALS_ID()
-  {
-    static const std::string MY_STEP_MATERIALS_ID("step_materials");
-    return MY_STEP_MATERIALS_ID;
-  }
-  /// attribute name of step colors
-  inline static const std::string& STEP_COLORS_ID()
-  {
-    static const std::string MY_STEP_COLORS_ID("step_colours");
-    return MY_STEP_COLORS_ID;
-  }
   /// Default constructor
   EXCHANGEPLUGIN_EXPORT ExchangePlugin_Import();
   /// Default destructor
@@ -123,9 +79,6 @@ class ExchangePlugin_Import : public ModelAPI_Feature
   /// \param theID identifier of changed attribute
   EXCHANGEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
 
-  EXCHANGEPLUGIN_EXPORT
-  void updatePart(AttributeStringArrayPtr &aPartsAttr, AttributeIntegerPtr &aTargetAttr);
-
   /// Computes or recomputes the results
   EXCHANGEPLUGIN_EXPORT virtual void execute();
 
index 402b660e9721b7aa56b5d7e36938a24b0b4b7805..ade0a3115974fde390294daf839f71047207af17 100644 (file)
@@ -32,7 +32,6 @@
 #include <GeomAlgoAPI_XAOImport.h>
 
 #include <GeomAPI_Shape.h>
-#include <GeomAPI_Face.h>
 #include <GeomAPI_ShapeExplorer.h>
 
 #include <Locale_Convert.h>
@@ -43,8 +42,6 @@
 #include <ModelAPI_AttributeStringArray.h>
 #include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_AttributeTables.h>
-#include <ModelAPI_AttributeBoolean.h>
-#include <ModelAPI_AttributeInteger.h>
 #include <ModelAPI_BodyBuilder.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 
 #include <ExchangePlugin_Tools.h>
 
-#include <TopExp_Explorer.hxx>
-#include <OSD_Exception.hxx>
-
-
 ExchangePlugin_ImportFeature::ExchangePlugin_ImportFeature()
 {
 }
@@ -84,16 +77,10 @@ void ExchangePlugin_ImportFeature::initAttributes()
   data()->addAttribute(ExchangePlugin_ImportFeature::FILE_PATH_ID(),
                        ModelAPI_AttributeString::typeId());
   AttributePtr aFeaturesAttribute =
-  data()->addAttribute(ExchangePlugin_ImportFeature::FEATURES_ID(),
+    data()->addAttribute(ExchangePlugin_ImportFeature::FEATURES_ID(),
                          ModelAPI_AttributeRefList::typeId());
-  data()->addAttribute(STEP_FILE_PATH_ID(), ModelAPI_AttributeString::typeId());
-  data()->addAttribute(IMPORT_TYPE_ID(), ModelAPI_AttributeString::typeId());
-  data()->addAttribute(STEP_MATERIALS_ID(), ModelAPI_AttributeBoolean::typeId());
-  data()->addAttribute(STEP_COLORS_ID(), ModelAPI_AttributeBoolean::typeId());
-  data()->addAttribute(STEP_SCALE_INTER_UNITS_ID(), ModelAPI_AttributeBoolean::typeId());
-
   aFeaturesAttribute->setIsArgument(false);
-  
+
   ModelAPI_Session::get()->validators()->registerNotObligatory(
       getKind(), ExchangePlugin_ImportFeature::FEATURES_ID());
 }
@@ -103,15 +90,7 @@ void ExchangePlugin_ImportFeature::initAttributes()
  */
 void ExchangePlugin_ImportFeature::execute()
 {
-  AttributeStringPtr aImportTypeAttr = string(ExchangePlugin_ImportFeature::IMPORT_TYPE_ID());
-  std::string aFormat = aImportTypeAttr->value();
-  AttributeStringPtr aFilePathAttr;
-  if (aFormat == "STEP" || aFormat == "STP")
-  {
-    aFilePathAttr = string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID());
-  }else{
-    aFilePathAttr = string(ExchangePlugin_ImportFeature::FILE_PATH_ID());
-  }
+  AttributeStringPtr aFilePathAttr = string(ExchangePlugin_ImportFeature::FILE_PATH_ID());
   std::string aFilePath = aFilePathAttr->value();
   if (aFilePath.empty()) {
     setError("File path is empty.");
@@ -122,7 +101,7 @@ void ExchangePlugin_ImportFeature::execute()
 }
 
 std::shared_ptr<ModelAPI_ResultBody> ExchangePlugin_ImportFeature::createResultBody(
-                        std::shared_ptr<GeomAPI_Shape> aGeomShape)
+    std::shared_ptr<GeomAPI_Shape> aGeomShape)
 {
   std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
   //LoadNamingDS of the imported shape
@@ -143,47 +122,10 @@ void ExchangePlugin_ImportFeature::importFile(const std::string& theFileName)
   // Perform the import
   std::string anError;
   std::shared_ptr<GeomAPI_Shape> aGeomShape;
-
-  std::map< std::wstring, std::list<std::wstring>> theMaterialShape;
-
-  std::string anObjectName = GeomAlgoAPI_Tools::File_Tools::name(theFileName);
-  data()->setName(Locale::Convert::toWString(anObjectName));
-
-  ResultBodyPtr result = document()->createBody(data());
-
-  bool anColorGroupSelected = boolean(ExchangePlugin_ImportFeature::STEP_COLORS_ID())->value();
-  bool anMaterialsGroupSelected = boolean(ExchangePlugin_ImportFeature::STEP_MATERIALS_ID())->value();
-
   if (anExtension == "BREP" || anExtension == "BRP") {
     aGeomShape = BREPImport(theFileName, anExtension, anError);
   } else if (anExtension == "STEP" || anExtension == "STP") {
-    bool anScalInterUnits = boolean(ExchangePlugin_ImportFeature::STEP_SCALE_INTER_UNITS_ID())->value();
-    
-
-    try{
-
-      result->clearShapeNameAndColor();
-      // Process groups/fields
-      std::shared_ptr<ModelAPI_AttributeRefList> aRefListOfGroups =
-      std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(data()->attribute(FEATURES_ID()));
-
-      // Remove previous groups/fields stored in RefList
-      std::list<ObjectPtr> anGroupList = aRefListOfGroups->list();
-      std::list<ObjectPtr>::iterator anGroupIt = anGroupList.begin();
-      for (; anGroupIt != anGroupList.end(); ++anGroupIt) {
-        std::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_Feature::feature(*anGroupIt);
-        if (aFeature)
-        document()->removeFeature(aFeature);
-      }
-      
-      aGeomShape = STEPImportAttributs(theFileName, result, anScalInterUnits,
-                                       anMaterialsGroupSelected, anColorGroupSelected,theMaterialShape,anError);
-      
-    }
-    catch (OSD_Exception& e) {
-        //Try to load STEP file without colors...
-        aGeomShape = STEPImport(theFileName, anExtension,anScalInterUnits,anError);
-    }
+    aGeomShape = STEPImport(theFileName, anExtension, anError);
   } else if (anExtension == "IGES" || anExtension == "IGS") {
     aGeomShape = IGESImport(theFileName, anExtension, anError);
   } else {
@@ -197,138 +139,12 @@ void ExchangePlugin_ImportFeature::importFile(const std::string& theFileName)
   }
 
   // Pass the results into the model
+  std::string anObjectName = GeomAlgoAPI_Tools::File_Tools::name(theFileName);
+  data()->setName(Locale::Convert::toWString(anObjectName));
 
-  loadNamingDS(aGeomShape, result);
-
-  // create color group
-  if (anColorGroupSelected) 
-  {
-    setColorGroups(result);
-  }
-
-  // create Materiel group
-  if (anMaterialsGroupSelected){
-    setMaterielGroup(result,theMaterialShape);
-  }
-
-  setResult(result); 
-
-}
-
-void ExchangePlugin_ImportFeature::setColorGroups(std::shared_ptr<ModelAPI_ResultBody> theResultBody)
-{
-  std::vector<int> aColor;
-  int indice = 1; 
-  std::list< std::vector<int> > aColorsRead; 
-
-
-  ModelAPI_Tools::getColor(theResultBody, aColor);
-  if (!aColor.empty() ){
-    std::wstringstream colorName;
-    colorName<<L"Color_"<<indice;
-    setColorGroup( theResultBody, aColor, colorName.str());
-    indice++;
-    aColorsRead.push_back(aColor);
-  }
-
-  std::list<ResultPtr> allRes;
-  ModelAPI_Tools::allSubs(theResultBody, allRes);
-  for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); ++aRes) {
-    ModelAPI_Tools::getColor(*aRes, aColor);
-    if (!aColor.empty() ){
-        auto it = std::find(aColorsRead.begin(), aColorsRead.end(), aColor);
-        if ( it == aColorsRead.end() ){
-             std::wstringstream colorName;
-            colorName<<L"Color_"<<indice;
-            setColorGroup( theResultBody, aColor, colorName.str() ); 
-            indice++;
-            aColorsRead.push_back(aColor);
-        }
-    }
-  }
-}
-
-void ExchangePlugin_ImportFeature::setColorGroup(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                                 std::vector<int> &theColor,
-                                                 const std::wstring& theName )
-{
-  std::vector<int> aColor;
-  std::shared_ptr<ModelAPI_Feature> aGroupFeature = addFeature("Group");
-
-   // group name
-  aGroupFeature->data()->setName(theName);
-
-  // fill selection
-  AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list");
-
-  ModelAPI_Tools::getColor(theResultBody, aColor);
-  if (!aColor.empty() ){
-    if( aColor == theColor ) {
-      GeomShapePtr aShape = theResultBody->shape();
-      aSelectionList->setSelectionType(aShape->shapeTypeStr() );
-      aSelectionList->append(theResultBody,aShape);
-    }  
-  }
-  // add element with the same color 
-  std::list<ResultPtr> allRes;
-  ModelAPI_Tools::allSubs(theResultBody, allRes);
-  for(std::list<ResultPtr>::iterator aRes = allRes.begin(); 
-      aRes != allRes.end(); ++aRes) {
-    ModelAPI_Tools::getColor(*aRes, aColor);
-    GeomShapePtr aShape = (*aRes)->shape();
-
-    if (!aColor.empty() ){
-      if( aRes->get() &&  aColor == theColor ) {
-          aSelectionList->setSelectionType(aShape->shapeTypeStr() );
-          aSelectionList->append(theResultBody,aShape);
-      }
-    }
-  }
-
-  if (aSelectionList->size() == 0 ){
-    document()->removeFeature(aGroupFeature);
-  }
+  setResult(createResultBody(aGeomShape));
 }
 
-void ExchangePlugin_ImportFeature::setMaterielGroup(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                                    std::map< std::wstring, std::list<std::wstring>> &theMaterialShape)
-{
-  int indice = 1; 
-  std::map< std::wstring, std::list<std::wstring>>::iterator it; 
-  for( it = theMaterialShape.begin(); it != theMaterialShape.end(); ++it) {
-      
-    std::shared_ptr<ModelAPI_Feature> aGroupFeature = addFeature("Group");
-    // group name
-    aGroupFeature->data()->setName((*it).first);
-
-    // fill selection
-    AttributeSelectionListPtr aSelectionList = aGroupFeature->selectionList("group_list");
-    std::string aSelectionType =  "solid" ;
-    aSelectionList->setSelectionType(aSelectionType);
-    GeomShapePtr aShape = theResultBody->shape();
-    
-    std::list<ResultPtr> allRes;
-    ModelAPI_Tools::allSubs(theResultBody, allRes);
-    for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); ++aRes) {
-      
-      GeomShapePtr aShape = (*aRes)->shape();
-      for(std::list<std::wstring>::iterator aResMat = it->second.begin();
-                                 aResMat != it->second.end(); ++aResMat) {
-        if( aRes->get() && ((*aRes)->data()->name() == (*aResMat)))
-        {  
-          aSelectionList->append(theResultBody,aShape);
-          break;
-        }
-      }
-    }
-    if (aSelectionList->size() == 0){
-      document()->removeFeature(aGroupFeature);
-    }
-  }
-} 
-
-
-
 void ExchangePlugin_ImportFeature::importXAO(const std::string& theFileName)
 {
   try {
@@ -599,6 +415,7 @@ void ExchangePlugin_ImportFeature::loadNamingDS(
 {
   //load result
   theResultBody->store(theGeomShape);
+
   std::string aNameMS = "Shape";
   theResultBody->loadFirstLevel(theGeomShape, aNameMS);
 }
index 2875d83abf4cc007cc4c9da019320e378682699c..c087af2ab9e21284e96dad63ca8a4ff6da4bc5aa 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_Result.h>
-#include <GeomAPI_Shape.h>
 
 #include <map>
 
@@ -44,48 +43,18 @@ class ExchangePlugin_ImportFeature : public ModelAPI_CompositeFeature
     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;
-  }
   /// attribute name of file path
   inline static const std::string& FILE_PATH_ID()
   {
     static const std::string MY_FILE_PATH_ID("file_path");
     return MY_FILE_PATH_ID;
   }
-  /// attribute name of file path
-  inline static const std::string& STEP_FILE_PATH_ID()
-  {
-    static const std::string MY_STEP_FILE_PATH_ID("step_file_path");
-    return MY_STEP_FILE_PATH_ID;
-  }
   /// All features (list of references)
   inline static const std::string& FEATURES_ID()
   {
     static const std::string MY_FEATURES_ID("Features");
     return MY_FEATURES_ID;
   }
-  /// attribute name of step Scale to International System Units
-  inline static const std::string& STEP_SCALE_INTER_UNITS_ID()
-  {
-    static const std::string MY_STEP_SCALE_INTER_UNITS_ID("step_scale_inter_units");
-    return MY_STEP_SCALE_INTER_UNITS_ID;
-  }
-  /// attribute name of step materiels
-  inline static const std::string& STEP_MATERIALS_ID()
-  {
-    static const std::string MY_STEP_MATERIALS_ID("step_materials");
-    return MY_STEP_MATERIALS_ID;
-  }
-  /// attribute name of step colors
-  inline static const std::string& STEP_COLORS_ID()
-  {
-    static const std::string MY_STEP_COLORS_ID("step_colours");
-    return MY_STEP_COLORS_ID;
-  }
   /// Default constructor
   EXCHANGEPLUGIN_EXPORT ExchangePlugin_ImportFeature();
   /// Default destructor
@@ -139,19 +108,6 @@ private:
   /// Loads Naming data structure to the document
   void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
                     std::shared_ptr<ModelAPI_ResultBody> theResultBody);
-  // Set groups of color 
-  void setColorGroups(std::shared_ptr<ModelAPI_ResultBody> theResultBody);
-
-  // set a group of color
-  void setColorGroup(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                     std::vector<int> &aColor,
-                     const std::wstring& theName );
-
-  // set Materiel group of color
-  void setMaterielGroup(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
-                        std::map< std::wstring, std::list<std::wstring>> &theMaterialShape);
-
 };
 
 #endif /* IMPORT_IMPORTFEATURE_H_ */
index 110053a1d346ca8ad671f596bbdff6134f0b117b..3e4061b1efb7e0646c9def66f02abfd314d487a9 100644 (file)
       <source>XAO</source>
       <translation>XAO</translation>
     </message>
-    <message>
-      <source>STL</source>
-      <translation>STL</translation>
-    </message>
   </context>
   <context>
     <name>Export:file_path</name>
       <translation>Veuillez saisir le nom de la géométrie</translation>
     </message>
   </context>
-  <context>
-    <name>Export:stl_file_path</name>
-    <message>
-      <source>Export file</source>
-      <translation>Fichier d&apos;export</translation>
-    </message>
-  </context>
-  <context>
-    <name>Export:stl_file_path:ExchangePlugin_ExportFormat</name>
-    <message>
-      <source>%1 is not initialized.</source>
-      <translation>%1 n&apos;est pas initialisé.</translation>
-    </message>
-    <message>
-      <source>File name is empty.</source>
-      <translation>Le nom du fichier est vide.</translation>
-    </message>
-  </context>
-  <context>
-    <name>Export:stl_object_selected</name>
-    <message>
-      <source>Object</source>
-      <translation>Objet</translation>
-    </message>
-    <message>
-      <source>Object to export.</source>
-      <translation>Objet à exporter.</translation>
-    </message>
-  </context>
-  <context>
-    <name>Export:stl_file_type</name> 
-    <message>
-      <source>File type</source>
-      <translation>type du fichier</translation>
-    </message>
-    <message>
-      <source>Binary</source>
-      <translation>Binaire</translation>
-    </message>
-    <message>
-      <source>ASCII</source>
-      <translation>ASCII</translation>
-    </message>
-  </context>
-  <context>
-    <name>Export:Deflection</name>
-    <message>
-      <source>Deflection</source>
-      <translation>Déflection</translation>
-    </message>
-    <message>
-      <source>Relative</source>
-      <translation>Relative</translation>
-    </message>
-    <message>
-      <source>Relative value.</source>
-      <translation>Valeur relative</translation>
-    </message>
-    <message>
-      <source>Calculate by size of shape</source>
-      <translation>Calcul par rapport à la taille de la shape</translation>
-    </message>
-    <message>
-      <source>Absolute</source>
-      <translation>Absolue</translation>
-    </message>
-    <message>
-      <source>Value indicate by user</source>
-      <translation>Valeur indiquée par l&apos;utilisateur</translation>
-    </message>
-    <message>
-      <source>Absolute value.</source>
-      <translation>Valeur absolue.</translation>
-    </message>
-  </context>
 
   <!-- Import -->
   <context>
index 4692ec6690d7e14f34ec1133dd4559b28a62f482..49436c043ffd1a1d226d1e4b27adca80d9371bf3 100644 (file)
@@ -97,4 +97,4 @@ The Result of the operation depends on the imported file content.
 
    Import of BREP file.
 
-**See Also** a sample TUI Script of :ref:`tui_import_file` operation.
+**See Also** a sample TUI Script of :ref:`tui_import_file` operation.
\ No newline at end of file
index d77786ee58dd10b5d03c32907c74c23260c0f9e0..9e134b805c32601d268fc1ce6e73a25e165e2a50 100644 (file)
                    placeholder="Please input the geometry name">
       </stringvalue>
     </case>
-    <case id="STL" title="STL">
-      <export_file_selector id="stl_file_path"
-                            type="save"
-                            title="Export file"
-                            path="">
-        <validator id="ExchangePlugin_ExportFormat"
-                   parameters="stl:STL" />
-      </export_file_selector>
-      <shape_selector id="stl_object_selected"
-                          label="Object"
-                          tooltip="Object to export."
-                          shape_types="vertices edges wires faces shells solids compsolids compounds">
-            <validator id="GeomValidators_Finite"/>
-      </shape_selector>
-      <groupbox title="Deflection">
-        <radiobox id="stl_deflection_type">
-          <radio id="stl_deflection_type_relative"
-              title="Relative"
-              tooltip="Calculate by size of shape">
-            <doublevalue id="stl_relative"
-              tooltip="Relative value."
-              min="0.0"
-              step="0.001"
-              default="0.001">
-            </doublevalue>
-          </radio>
-          <radio id="stl_deflection_type_absolute"
-              title="Absolute"
-              tooltip="Value indicate by user">
-            <doublevalue id="stl_absolute"
-              tooltip="Absolute value."
-              min="0.0"
-              max="1.0"
-              step="0.1"
-              default="0.5">
-            </doublevalue>
-          </radio>
-        </radiobox>
-      </groupbox >
-      <groupbox title="File type">
-        <radiobox id="stl_file_type">
-          <radio id="stl_file_type_binary"
-              title="Binary">
-          </radio>
-          <radio id="stl_file_type_acii"
-              title="ASCII">
-          </radio>
-        </radiobox>
-      </groupbox >
-      <!--stringvalue id="xao_author"
-                   label="Author"
-                   placeholder="Please input the author">
-      </stringvalue>
-      <stringvalue id="xao_geometry_name"
-                   label="Geometry name"
-                   placeholder="Please input the geometry name">
-      </stringvalue-->
-    </case>
   </switch>
 </source>
index 275ceb69b6bd113c6fe5d631875189d48d51eadf..7f240ba69c9701cf2dfd59fcbdaf181bda666b8e 100644 (file)
@@ -4,70 +4,19 @@
       <feature id="ImportMacro" title="Import" tooltip="Import a file" icon="icons/Exchange/import.png"
                helpfile="importFeature.html"
                internal="1">
-      <switch id="ImportType">
-        <case id="Regular" title="BREP, XAO, IGES">
-          <file_selector id="file_path" title="Import file" path="">
-              <validator id="ExchangePlugin_ImportFormat" parameters="BREP|BRP:BREP,IGES|IGS:IGES,XAO:XAO" />
-          </file_selector>
+        <file_selector id="file_path" title="Import file" path="">
+          <validator id="ExchangePlugin_ImportFormat" parameters="BREP|BRP:BREP,STEP|STP:STEP,IGES|IGS:IGES,XAO:XAO" />
+        </file_selector>
         <choice id="target_part"
                 string_list_attribute="target_parts_list"
                 label="Import to"
                 tooltip="Select the part to import the document" />
-        </case>
-        <case id="STEP" title="STEP">
-            <file_selector id="step_file_path" title="Import file" path="">
-              <validator id="ExchangePlugin_ImportFormat" parameters="STEP|STP:STEP" />
-            </file_selector>
-            <choice id="step_target_part"
-                string_list_attribute="step_target_parts_list"
-                label="Import to"
-                tooltip="Select the part to import the document" /> 
-            <groupbox title="STEP options">
-              <boolvalue id="step_scale_inter_units"
-                        label="Scale to International System of Units"
-                        default="true"/>
-              <groupbox title="Create groups from">
-                <boolvalue id="step_materials"
-                          label="Materials"
-                          default="false"/>
-                <boolvalue id="step_colours"
-                          label="Colours"
-                          default="false"/>
-              </groupbox>
-            </groupbox>
-          </case>
-        </switch>
       </feature>
       <feature id="Import" title="Import" tooltip="Import a file" icon="icons/Exchange/import.png"
                helpfile="importFeature.html" internal="1">
-        <!--file_selector id="file_path" title="Import file" path="">
+        <file_selector id="file_path" title="Import file" path="">
           <validator id="ExchangePlugin_ImportFormat" parameters="BREP|BRP:BREP,STEP|STP:STEP,IGES|IGS:IGES,XAO:XAO" />
-        </file_selector-->
-        <switch id="ImportType">
-        <case id="Regular" title="BREP, XAO, IGES">
-          <file_selector id="file_path" title="Import file" path="">
-              <validator id="ExchangePlugin_ImportFormat" parameters="BREP|BRP:BREP,IGES|IGS:IGES,XAO:XAO" />
-          </file_selector>
-        </case>
-        <case id="STEP" title="STEP">
-            <file_selector id="step_file_path" title="Import file" path="">
-              <validator id="ExchangePlugin_ImportFormat" parameters="STEP|STP:STEP" />
-            </file_selector>
-            <groupbox title="STEP options">
-              <boolvalue id="step_scale_inter_units"
-                        label="Scale to International System of Units"
-                        default="true"/>
-              <groupbox title="Create groups from">
-                <boolvalue id="step_materials"
-                          label="Materials"
-                          default="false"/>
-                <boolvalue id="step_colours"
-                          label="Colours"
-                          default="false"/>
-              </groupbox>
-            </groupbox>
-          </case>
-        </switch>
+        </file_selector>
       </feature>
       <feature id="Export" title="Export" tooltip="Export to file" icon="icons/Exchange/export.png"
                helpfile="exportFeature.html" internal="1">
index 9d41827881318fba4830bceda573497209d10017..332b5820878c9eb63c6d4ae8dddb8db63edaf8e2 100644 (file)
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Selection.h>
 #include <ModelHighAPI_Tools.h>
-#include <GeomAlgoAPI_PointBuilder.h>
-#include <GeomAPI_Edge.h>
-#include <GeomAPI_Pnt.h>
-#include <GeomAPI_Curve.h>
 
 static GeomAPI_Shape::ShapeType typeOfSelection(
     const std::list<ModelHighAPI_Selection>& theBaseObjects)
@@ -156,92 +152,6 @@ FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Featur
   }
 }
 
-
-FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                           const ModelHighAPI_Selection & theedgeselected,
-                                           const std::list<ModelHighAPI_Selection>& thepoint,
-                                           const std::list<ModelHighAPI_Double>& theRadius)
-  : FeaturesAPI_Fillet(theFeature)
-{
-  if (initialize()) {
-    fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
-    fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_BY_POINTS(), mycreationMethodmulti);
-    fillAttribute(theedgeselected, edgeselected());
-    fillAttribute(thepoint, myarraypointradiusbypoint);
-
-    GeomEdgePtr anEdge = GeomEdgePtr(new GeomAPI_Edge( edgeselected()->value()));
-    GeomPointPtr first =  anEdge->firstPoint();
-    GeomPointPtr last  =  anEdge->lastPoint();
-    double taille = first->distance(last);
-
-    std::shared_ptr<GeomAPI_Curve> aCurve(new GeomAPI_Curve(edgeselected()->value()));
-
-    ListOfShape aPoints;
-    std::set<GeomShapePtr> aContexts;
-    for (int anIndex = 0; anIndex < myarraypointradiusbypoint->size(); ++anIndex) {
-        AttributeSelectionPtr aSelection = myarraypointradiusbypoint->value(anIndex);
-        GeomShapePtr aShape = aSelection->value();
-        ResultPtr aContext = aSelection->context();
-        aContexts.insert(aContext->shape());
-
-        if (!aShape.get()) {
-          aShape = aContext->shape();
-        } 
-        aPoints.push_back(aShape);
-    }
-    std::list<ModelHighAPI_Double>::const_iterator aRowsRadiusIter = theRadius.begin();
-    ModelAPI_AttributeTables::Value aVal; 
-    aVal.myDouble = 0.0;
-    myvaluescurv()->setValue(aVal, 0, 0 );
-    aVal.myDouble = aRowsRadiusIter->value(); 
-    myvaluescurv()->setValue(aVal, 0, 1 );
-    aRowsRadiusIter++;
-    int aRowIndex = 1;
-    ListOfShape::const_iterator aPointsIt = aPoints.begin();
-    for (; aPointsIt != aPoints.end(); ++aPointsIt, aRowsRadiusIter++) {
-      std::shared_ptr<GeomAPI_Pnt> aPnt = GeomAlgoAPI_PointBuilder::point(*aPointsIt);
-      std::shared_ptr<GeomAPI_Pnt> aPntCurv = aCurve->project(aPnt);
-      double res = (aPntCurv->distance(first) / taille);
-       aVal.myDouble = res;
-      myvaluescurv()->setValue(aVal, aRowIndex, 0 );
-      aVal.myDouble = aRowsRadiusIter->value(); 
-      myvaluescurv()->setValue(aVal, aRowIndex, 1 );
-      aRowIndex++;
-    }
-    aVal.myDouble = 1.0;
-    myvaluescurv()->setValue(aVal, aRowIndex, 0 );
-    aVal.myDouble = aRowsRadiusIter->value(); 
-    myvaluescurv()->setValue(aVal, aRowIndex, 1 );
-    execIfBaseNotEmpty();
-  }
-}
-
-FeaturesAPI_Fillet2D::FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                           const ModelHighAPI_Selection & theedgeselected,
-                                           const std::list<ModelHighAPI_Double>& thepointCurvCood,
-                                           const std::list<ModelHighAPI_Double>& theRadius)
-  : FeaturesAPI_Fillet(theFeature)
-{
-  if (initialize()) {
-    fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(), mycreationMethod);
-    fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_BY_CURVILEAR_ABSCISSA(), mycreationMethodmulti);
-    fillAttribute(theedgeselected, edgeselected());
-
-    int aRowIndex = 0; 
-    myvaluescurv()->setSize( thepointCurvCood.size(), 2 );  
-    std::list<ModelHighAPI_Double>::const_iterator aRowsCoodIter = thepointCurvCood.begin(); 
-    std::list<ModelHighAPI_Double>::const_iterator aRowsRadiusIter = theRadius.begin(); 
-    for(; aRowsCoodIter != thepointCurvCood.end(); aRowsCoodIter++, aRowsRadiusIter++, aRowIndex++) { 
-      ModelAPI_AttributeTables::Value aVal; 
-      aVal.myDouble = aRowsCoodIter->value();
-      myvaluescurv()->setValue(aVal, aRowIndex, 0 );
-      aVal.myDouble = aRowsRadiusIter->value(); 
-      myvaluescurv()->setValue(aVal, aRowIndex, 1 );
-    } 
-    execIfBaseNotEmpty();
-  }
-}
-
 FeaturesAPI_Fillet2D::~FeaturesAPI_Fillet2D()
 {
 }
@@ -255,7 +165,7 @@ void FeaturesAPI_Fillet2D::setBase(const std::list<ModelHighAPI_Selection>& theB
 }
 
 void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double& theRadius)
-{ 
+{
   fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS(), mycreationMethod);
   fillAttribute(theRadius, myradius);
 
@@ -264,7 +174,7 @@ void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double& theRadius)
 
 void FeaturesAPI_Fillet2D::setRadius(const ModelHighAPI_Double& theRadius1,
                                      const ModelHighAPI_Double& theRadius2)
-{ 
+{
   fillAttribute(FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS(), mycreationMethod);
   fillAttribute(theRadius1, mystartRadius);
   fillAttribute(theRadius2, myendRadius);
@@ -279,64 +189,18 @@ void FeaturesAPI_Fillet2D::dump(ModelHighAPI_Dumper& theDumper) const
 
   AttributeSelectionListPtr anAttrObjects =
     aBase->selectionList(FeaturesPlugin_Fillet::OBJECT_LIST_ID());
-  
-
-  if ( aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value() 
-        == FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES() )
-  {
-    AttributeSelectionPtr anAttrEdgeSelec =
-    aBase->selection(FeaturesPlugin_Fillet::EDGE_SELECTED_ID());
-
-    if( aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES())->value() 
-          == FeaturesPlugin_Fillet::CREATION_METHOD_BY_POINTS() )
-    {        
-      AttributeSelectionListPtr anAttrPoint =
-          aBase->selectionList(FeaturesPlugin_Fillet::ARRAY_POINT_RADIUS_BY_POINTS());
-      AttributeTablesPtr anAttrTable = 
-          aBase->tables(FeaturesPlugin_Fillet::VALUES_ID());
-      theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrEdgeSelec;
-      theDumper << ", " << anAttrPoint << ", ";
-      theDumper<<", [";
-      for(int aRow = 0; aRow < myvalues()->rows(); aRow++) {
-        if (aRow != 0)
-          theDumper<<", ";
-        theDumper<<myvalues()->value(aRow, 1).myDouble;
-      }
-      theDumper<<"]";
-
-    }else{
-      AttributeTablesPtr anAttrTable = 
-          aBase->tables(FeaturesPlugin_Fillet::VALUES_CURV_ID());
-      theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrEdgeSelec;
-      theDumper << ", ";
-      theDumper<<"[";
-      for(int aRow = 1; aRow < myvalues()->rows()-1; aRow++) {
-        if (aRow != 1)
-          theDumper<<", ";
-        theDumper<<myvalues()->value(aRow, 0).myDouble;
-      }
-      theDumper<<"],";
-      theDumper<<"[";
-      for(int aRow = 0; aRow < myvalues()->rows(); aRow++) {
-        if (aRow != 0)
-          theDumper<<", ";
-        theDumper<<myvalues()->value(aRow, 1).myDouble;
-      }
-      theDumper<<"]";
-    }
-  }else
-  {  theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrObjects;
-
-    std::string aCreationMethod = aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value();
-
-    if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS()) {
-      AttributeDoublePtr anAttrRadius = aBase->real(FeaturesPlugin_Fillet::RADIUS_ID());
-      theDumper << ", " << anAttrRadius;
-    } else if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS()) {
-      AttributeDoublePtr anAttrRadius1 = aBase->real(FeaturesPlugin_Fillet::START_RADIUS_ID());
-      AttributeDoublePtr anAttrRadius2 = aBase->real(FeaturesPlugin_Fillet::END_RADIUS_ID());
-      theDumper << ", " << anAttrRadius1 << ", " << anAttrRadius2;
-    }
+
+  theDumper << aBase << " = model.addFillet(" << aDocName << ", " << anAttrObjects;
+
+  std::string aCreationMethod = aBase->string(FeaturesPlugin_Fillet::CREATION_METHOD())->value();
+
+  if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_SINGLE_RADIUS()) {
+    AttributeDoublePtr anAttrRadius = aBase->real(FeaturesPlugin_Fillet::RADIUS_ID());
+    theDumper << ", " << anAttrRadius;
+  } else if(aCreationMethod == FeaturesPlugin_Fillet::CREATION_METHOD_VARYING_RADIUS()) {
+    AttributeDoublePtr anAttrRadius1 = aBase->real(FeaturesPlugin_Fillet::START_RADIUS_ID());
+    AttributeDoublePtr anAttrRadius2 = aBase->real(FeaturesPlugin_Fillet::END_RADIUS_ID());
+    theDumper << ", " << anAttrRadius1 << ", " << anAttrRadius2;
   }
 
   if (!aBase->data()->version().empty())
@@ -377,39 +241,3 @@ FilletPtr addFillet(const std::shared_ptr<ModelAPI_Document>& thePart,
     aFillet.reset(new FeaturesAPI_Fillet2D(aFeature, theBaseObjects, theRadius1, theRadius2));
   return aFillet;
 }
-
-FilletPtr addFillet(const std::shared_ptr<ModelAPI_Document>& thePart,
-                    const ModelHighAPI_Selection & theedgeselected,
-                    const std::list<ModelHighAPI_Selection>& thepoint,
-                    const std::list<ModelHighAPI_Double>& theRadius,
-                    const bool keepSubResults)
-{
-
-  FeaturePtr aFeature = thePart->addFeature(FeaturesAPI_Fillet2D::ID());
-  if (!keepSubResults)
-    aFeature->data()->setVersion("");
-
-  FilletPtr aFillet;
-
-  aFillet.reset(new FeaturesAPI_Fillet2D(aFeature, theedgeselected, thepoint, theRadius));
-
-  return aFillet;
-}
-
-FilletPtr addFillet(const std::shared_ptr<ModelAPI_Document>& thePart,
-                    const ModelHighAPI_Selection & theedgeselected,
-                    const std::list<ModelHighAPI_Double>& thepointCurvCood,
-                    const std::list<ModelHighAPI_Double>& theRadius,
-                    const bool keepSubResults)
-{
-
-  FeaturePtr aFeature = thePart->addFeature(FeaturesAPI_Fillet2D::ID());
-  if (!keepSubResults)
-    aFeature->data()->setVersion("");
-
-  FilletPtr aFillet;
-
-  aFillet.reset(new FeaturesAPI_Fillet2D(aFeature, theedgeselected, thepointCurvCood, theRadius));
-
-  return aFillet;
-}
\ No newline at end of file
index 258d6e8ee59376f1206a7889bb58258fb91c9d5e..7eac5d6c882c3bfd2f71a69bea4e4e62f8a6b48c 100644 (file)
@@ -28,7 +28,6 @@
 #include <ModelHighAPI_Double.h>
 #include <ModelHighAPI_Interface.h>
 #include <ModelHighAPI_Macro.h>
-#include <ModelAPI_AttributeDoubleArray.h>
 
 class ModelHighAPI_Selection;
 
@@ -131,45 +130,17 @@ public:
                                 const ModelHighAPI_Double& theRadius1,
                                 const ModelHighAPI_Double& theRadius2);
 
-  /// Constructor with values.
-  FEATURESAPI_EXPORT
-  explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                const ModelHighAPI_Selection& theedgeselected,
-                                const std::list<ModelHighAPI_Selection>& thepoint,
-                                const std::list<ModelHighAPI_Double>& theRadius);
-  
-  /// Constructor with values.
-  FEATURESAPI_EXPORT
-  explicit FeaturesAPI_Fillet2D(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                const ModelHighAPI_Selection& theedgeselected,
-                                const std::list<ModelHighAPI_Double>& thepointCurvCood,
-                                const std::list<ModelHighAPI_Double>& theRadius);
   /// Destructor.
   FEATURESAPI_EXPORT
   virtual ~FeaturesAPI_Fillet2D();
 
-  INTERFACE_10(FeaturesPlugin_Fillet::ID(),
+  INTERFACE_5(FeaturesPlugin_Fillet::ID(),
               creationMethod, FeaturesPlugin_Fillet::CREATION_METHOD(),
                               ModelAPI_AttributeString,
                               /** Creation method */,
-              creationMethodmulti, FeaturesPlugin_Fillet::CREATION_METHOD_MULTIPLES_RADIUSES(),
-                              ModelAPI_AttributeString,
-                              /** Creation method */,
               baseObjects, FeaturesPlugin_Fillet::OBJECT_LIST_ID(),
                            ModelAPI_AttributeSelectionList,
                            /** Base objects */,
-              edgeselected, FeaturesPlugin_Fillet::EDGE_SELECTED_ID(),
-                           ModelAPI_AttributeSelection,
-                           /** Base objects */,
-              arraypointradiusbypoint, FeaturesPlugin_Fillet::ARRAY_POINT_RADIUS_BY_POINTS(),
-                           ModelAPI_AttributeSelectionList,
-                           /** Base objects */, 
-              myvalues, FeaturesPlugin_Fillet::VALUES_ID(),
-                           ModelAPI_AttributeTables,
-                           /** table for methode multi-radiuses by point */,
-              myvaluescurv, FeaturesPlugin_Fillet::VALUES_CURV_ID(),
-                           ModelAPI_AttributeTables,
-                           /** table for methode multi-radiuses by curviliean coodinate */,              
               radius, FeaturesPlugin_Fillet::RADIUS_ID(),
                       ModelAPI_AttributeDouble,
                       /** Value of the fixed radius fillet */,
@@ -210,23 +181,4 @@ FilletPtr addFillet(const std::shared_ptr<ModelAPI_Document>& thePart,
                     const ModelHighAPI_Double& theRadius2 = ModelHighAPI_Double(-1.0),
                     const bool keepSubResults = false);
 
-/// \ingroup CPPHighAPI
-/// \brief Create Fillet feature.
-FEATURESAPI_EXPORT
-FilletPtr addFillet(const std::shared_ptr<ModelAPI_Document>& thePart,
-                    const ModelHighAPI_Selection & theedgeselected,
-                    const std::list<ModelHighAPI_Selection>& thepoint,
-                    const std::list<ModelHighAPI_Double>& theRadius,
-                    const bool keepSubResults= false);
-
-
-/// \ingroup CPPHighAPI
-/// \brief Create Fillet feature.
-FEATURESAPI_EXPORT
-FilletPtr addFillet( const std::shared_ptr<ModelAPI_Document>& thePart,
-                     const ModelHighAPI_Selection & theedgeselected,
-                     const std::list<ModelHighAPI_Double>& thepointCurvCood,
-                     const std::list<ModelHighAPI_Double>& theRadius,
-                     const bool keepSubResults= false);
-  
 #endif // FeaturesAPI_Fillet_H_