From 4e719545712bbeac49725c0ce02c2d20aa979e75 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me?= Date: Fri, 20 Nov 2020 16:31:56 +0100 Subject: [PATCH] Fix #20368 refactoring code --- src/ConnectorAPI/Test/TestImportSTEP.py | 2 +- src/ExchangeAPI/ExchangeAPI_Import.cpp | 16 +- src/ExchangeAPI/ExchangeAPI_Import.h | 2 +- src/ExchangePlugin/ExchangePlugin_Dump.cpp | 8 +- .../ExchangePlugin_ImportFeature.cpp | 28 +- .../ExchangePlugin_ImportFeature.h | 6 +- src/ExchangePlugin/Test/TestImportSTEP.py | 2 +- src/ExchangePlugin/doc/examples/importStep.py | 2 +- src/ExchangePlugin/doc/importFeature.rst | 2 +- src/ExchangePlugin/plugin-Exchange.xml | 15 +- src/FeaturesAPI/FeaturesAPI_ImportResult.cpp | 2 +- src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp | 43 +-- src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h | 16 +- .../GeomAlgoAPI_STEPImportXCAF.cpp | 262 ++++++++---------- src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h | 50 ++-- src/Model/Model_BodyBuilder.cpp | 31 +-- src/Model/Model_Objects.cpp | 4 +- src/Model/Model_Objects.h | 4 +- src/Model/Model_ResultBody.cpp | 55 ++-- src/Model/Model_ResultBody.h | 18 +- src/ModelAPI/ModelAPI_ResultBody.h | 25 +- src/PythonAPI/model/exchange/__init__.py | 2 +- 22 files changed, 262 insertions(+), 333 deletions(-) diff --git a/src/ConnectorAPI/Test/TestImportSTEP.py b/src/ConnectorAPI/Test/TestImportSTEP.py index f58393477..84b6d90ce 100644 --- a/src/ConnectorAPI/Test/TestImportSTEP.py +++ b/src/ConnectorAPI/Test/TestImportSTEP.py @@ -68,7 +68,7 @@ def testImportSTEP(): 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) + Import_1 = model.addImportSTEP(Part_1_doc,aShapePath, True, True, True) model.do() diff --git a/src/ExchangeAPI/ExchangeAPI_Import.cpp b/src/ExchangeAPI/ExchangeAPI_Import.cpp index 84a949a67..20b0b4209 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.cpp +++ b/src/ExchangeAPI/ExchangeAPI_Import.cpp @@ -82,11 +82,11 @@ void ExchangeAPI_Import::setParameters(const std::string & theFilePath, //-------------------------------------------------------------------------------------- void ExchangeAPI_Import::setFilePath(const std::string & theFilePath) { - + std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(theFilePath); if (anExtension == "STEP" || anExtension == "STP") { setParameters(theFilePath,true,false,false); - }else{ + } else { fillAttribute(theFilePath, myfilePath); fillAttribute(anExtension, myimportType); execute(); @@ -106,7 +106,7 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const if (aFormat == "STEP" || aFormat == "STP") { aFilePath = aBase->string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID())->value(); - }else{ + } else { aFilePath = aBase->string(ExchangePlugin_ImportFeature::FILE_PATH_ID())->value(); } @@ -119,14 +119,14 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const aPos += aTo.size(); } std::string anExtension = GeomAlgoAPI_Tools::File_Tools::extension(aFilePath); - if( anExtension == "STP" || anExtension == "STEP"){ - theDumper << aBase << " = model.addImportStep(" << aPartName << ", \"" + if (anExtension == "STP" || anExtension == "STEP"){ + theDumper << aBase << " = model.addImportSTEP(" << aPartName << ", \"" << aFilePath << "\"" ; theDumper << ", " << scalInterUnits()->value() << ", " << materials()->value() << ", " << colors()->value() << ")"<< std::endl; - }else{ + } else { theDumper << aBase << " = model.addImport(" << aPartName << ", \"" << aFilePath << "\")" << std::endl; } @@ -136,7 +136,7 @@ void ExchangeAPI_Import::dump(ModelHighAPI_Dumper& theDumper) const CompositeFeaturePtr aCompositeFeature = std::dynamic_pointer_cast(aBase); - if(aCompositeFeature.get()) { + if (aCompositeFeature.get()) { int aNbOfSubs = aCompositeFeature->numberOfSubs(); for(int anIndex = 0; anIndex < aNbOfSubs; ++anIndex) { std::string aSubFeatureGet = @@ -155,7 +155,7 @@ ImportPtr addImport( return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath)); } -ImportPtr addImportStep( +ImportPtr addImportSTEP( const std::shared_ptr & thePart, const std::string & theFilePath, const bool theScalInterUnits, diff --git a/src/ExchangeAPI/ExchangeAPI_Import.h b/src/ExchangeAPI/ExchangeAPI_Import.h index 302489918..b4439d2d3 100644 --- a/src/ExchangeAPI/ExchangeAPI_Import.h +++ b/src/ExchangeAPI/ExchangeAPI_Import.h @@ -103,7 +103,7 @@ ImportPtr addImport(const std::shared_ptr & thePart, * \brief Create Import Step feature */ EXCHANGEAPI_EXPORT -ImportPtr addImportStep(const std::shared_ptr & thePart, +ImportPtr addImportSTEP(const std::shared_ptr & thePart, const std::string & theFilePath, const bool anScalInterUnits, const bool anMaterials, diff --git a/src/ExchangePlugin/ExchangePlugin_Dump.cpp b/src/ExchangePlugin/ExchangePlugin_Dump.cpp index 0f751808d..3c86b8c3f 100644 --- a/src/ExchangePlugin/ExchangePlugin_Dump.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Dump.cpp @@ -93,10 +93,10 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) DocumentPtr aDoc = ModelAPI_Session::get()->moduleDocument(); int aFeaturesNb = aDoc->size(ModelAPI_Feature::group()); - if(aFeaturesNb > 1) { + if (aFeaturesNb > 1) { FeaturePtr aLastFeature = ModelAPI_Feature::feature(aDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); - if(aDoc->currentFeature(true) != aLastFeature) { + if (aDoc->currentFeature(true) != aLastFeature) { setError("Dump cannot be done. Please move the history line to the end before dumping."); return; } @@ -104,10 +104,10 @@ void ExchangePlugin_Dump::dump(const std::string& theFileName) DocumentPtr anActiveDoc = ModelAPI_Session::get()->activeDocument(); aFeaturesNb = anActiveDoc->size(ModelAPI_Feature::group()); - if(aFeaturesNb > 1) { + if (aFeaturesNb > 1) { FeaturePtr aLastFeature = ModelAPI_Feature::feature(anActiveDoc->object(ModelAPI_Feature::group(), aFeaturesNb - 1)); - if(anActiveDoc->currentFeature(true) != aLastFeature) { + if (anActiveDoc->currentFeature(true) != aLastFeature) { setError("Dump cannot be done. Please move the history line to the end before dumping."); return; } diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 0535c3888..158a1cc67 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -119,7 +119,7 @@ void ExchangePlugin_ImportFeature::execute() if (aFormat == "STEP" || aFormat == "STP") { aFilePathAttr = string(ExchangePlugin_ImportFeature::STEP_FILE_PATH_ID()); - }else{ + } else { aFilePathAttr = string(ExchangePlugin_ImportFeature::FILE_PATH_ID()); } std::string aFilePath = aFilePathAttr->value(); @@ -248,14 +248,14 @@ void ExchangePlugin_ImportFeature::setColorGroups( for(std::list::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 aColorName; - aColorName<shape(); aSelectionList->setSelectionType(aShape->shapeTypeStr() ); aSelectionList->append(theResultBody,aShape); @@ -291,9 +291,9 @@ void ExchangePlugin_ImportFeature::setColorGroup( GeomShapePtr aShape = (*aRes)->shape(); if (!aColor.empty() ){ - if( aRes->get() && aColor == theColor ) { - aSelectionList->setSelectionType(aShape->shapeTypeStr() ); - aSelectionList->append(theResultBody,aShape); + if (aRes->get() && aColor == theColor ) { + aSelectionList->setSelectionType(aShape->shapeTypeStr() ); + aSelectionList->append(theResultBody,aShape); } } } @@ -331,7 +331,7 @@ void ExchangePlugin_ImportFeature::setMaterielGroup( GeomShapePtr aShape = (*aRes)->shape(); for(std::list::iterator aResMat = anIt->second.begin(); aResMat != anIt->second.end(); ++aResMat) { - if( aRes->get() && ((*aRes)->data()->name() == (*aResMat))) + if (aRes->get() && ((*aRes)->data()->name() == (*aResMat))) { aSelectionList->append(theResultBody,aShape); aSelectionList->setSelectionType(aShape->shapeTypeStr() ); diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h index 93d551bf5..cd55564d3 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h @@ -139,15 +139,15 @@ private: /// Loads Naming data structure to the document void loadNamingDS(std::shared_ptr theGeomShape, std::shared_ptr theResultBody); - // Set groups of color + /// Set groups of color void setColorGroups(std::shared_ptr theResultBody); - // set a group of color + /// set a group of color void setColorGroup(std::shared_ptr theResultBody, std::vector &aColor, const std::wstring& theName ); - // set Materiel group of color + /// set Materiel group of color void setMaterielGroup(std::shared_ptr theResultBody, std::map< std::wstring, std::list> &theMaterialShape); diff --git a/src/ExchangePlugin/Test/TestImportSTEP.py b/src/ExchangePlugin/Test/TestImportSTEP.py index f58393477..84b6d90ce 100644 --- a/src/ExchangePlugin/Test/TestImportSTEP.py +++ b/src/ExchangePlugin/Test/TestImportSTEP.py @@ -68,7 +68,7 @@ def testImportSTEP(): 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) + Import_1 = model.addImportSTEP(Part_1_doc,aShapePath, True, True, True) model.do() diff --git a/src/ExchangePlugin/doc/examples/importStep.py b/src/ExchangePlugin/doc/examples/importStep.py index 54efab493..0adc73a7a 100644 --- a/src/ExchangePlugin/doc/examples/importStep.py +++ b/src/ExchangePlugin/doc/examples/importStep.py @@ -6,6 +6,6 @@ file_path = os.path.join(os.getenv("DATA_DIR"),"Shapes","Step","black_and_white. partSet = model.moduleDocument() Part_1 = model.addPart(partSet) Part_1_doc = Part_1.document() -Import_1 = model.addImportStep(Part_1_doc,file_path, True, True, True) +Import_1 = model.addImportSTEP(Part_1_doc,file_path, True, True, True) model.do() model.end() diff --git a/src/ExchangePlugin/doc/importFeature.rst b/src/ExchangePlugin/doc/importFeature.rst index 33706fb40..c68dcc778 100644 --- a/src/ExchangePlugin/doc/importFeature.rst +++ b/src/ExchangePlugin/doc/importFeature.rst @@ -127,7 +127,7 @@ The **Import to** combobox provides the list of destinations (one of existing Pa **TUI Command**: -.. py:function:: model.addImportStep(Part_doc, FileNameString,scalInterUnits,materials,colors) +.. py:function:: model.addImportSTEP(Part_doc, FileNameString,scalInterUnits,materials,colors) :param part: The current part object :param string: A file name string. diff --git a/src/ExchangePlugin/plugin-Exchange.xml b/src/ExchangePlugin/plugin-Exchange.xml index f015d8069..5fbe54f9f 100644 --- a/src/ExchangePlugin/plugin-Exchange.xml +++ b/src/ExchangePlugin/plugin-Exchange.xml @@ -40,16 +40,13 @@ - - - - - - - + + + + + + diff --git a/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp b/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp index 923b246ed..068730242 100644 --- a/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp +++ b/src/FeaturesAPI/FeaturesAPI_ImportResult.cpp @@ -34,7 +34,7 @@ FeaturesAPI_ImportResult::FeaturesAPI_ImportResult( const std::shared_ptr& theFeature, const std::list& theObjects) : ModelHighAPI_Interface(theFeature) { - if(initialize()) { + if (initialize()) { setObjects(theObjects); } } diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp index 5fdb7f687..a10212ec3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp @@ -18,6 +18,7 @@ // #include +#include #include #include @@ -31,6 +32,8 @@ #include #include #include + +#include #include #include #include @@ -55,25 +58,10 @@ #include #include -//JL_CGLB -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC -// ---------------------------------------------------------------------------- +//================================================================================================== std::shared_ptr STEPImport(const std::string& theFileName, const std::string& theFormatName, const bool theScalInterUnits, @@ -210,20 +198,20 @@ std::shared_ptr STEPImport(const std::string& theFileName, return aGeomShape; } - -std::shared_ptr STEPImportAttributs(const std::string& theFileName, - std::shared_ptr theResultBody, - const bool theScalInterUnits, - const bool theMaterials, - const bool theColor, - std::map< std::wstring, - std::list> &theMaterialShape, - std::string& theError) +//================================================================================================== +GeomShapePtr STEPImportAttributs(const std::string& theFileName, + std::shared_ptr theResultBody, + const bool theScalInterUnits, + const bool theMaterials, + const bool theColor, + std::map< std::wstring, + std::list> &theMaterialShape, + std::string& theError) { STEPControl_Reader aReader; std::shared_ptr aGeomShape(new GeomAPI_Shape); - //VSR: 16/09/09: Convert to METERS + Interface_Static::SetCVal("xstep.cascade.unit","M"); Interface_Static::SetIVal("read.step.ideas", 1); Interface_Static::SetIVal("read.step.nonmanifold", 1); @@ -292,5 +280,4 @@ std::shared_ptr STEPImportAttributs(const std::string& theFileNa theMaterials, theMaterialShape, theError); -} - +} \ No newline at end of file diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h index fd886993b..4d62ab6b6 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h @@ -37,13 +37,13 @@ std::shared_ptr STEPImport(const std::string& theFileName, /// Implementation of the import STEP files algorithms with Attributs (Name, Color, Materials) GEOMALGOAPI_EXPORT -std::shared_ptr STEPImportAttributs(const std::string& theFileName, - std::shared_ptr theResultBody, - const bool anScalInterUnits, - const bool anMaterials, - const bool anColor, - std::map< std::wstring, - std::list> &theMaterialShape, - std::string& theError); +GeomShapePtr STEPImportAttributs(const std::string& theFileName, + std::shared_ptr theResultBody, + const bool anScalInterUnits, + const bool anMaterials, + const bool anColor, + std::map< std::wstring, + std::list> &theMaterialShape, + std::string& theError); #endif /* GEOMALGOAPI_STEPIMPORT_H_ */ diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp index 8a465911d..4710b2668 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.cpp @@ -19,71 +19,38 @@ #include -#include -#include -#include -#include -#include -#include +#include -#include #include #include #include -#include -#include -#include -#include -#include -#include -#include + +#include + #include #include #include #include -#include -#include -#include -#include -#include - -#include +#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include #include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include -#include - -#include -#include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC - +#include //============================================================================= -/*! - * GetShape() - */ -//============================================================================= - TopoDS_Shape getShape(const Handle(Standard_Transient) &theEnti, const Handle(Transfer_TransientProcess) &theTP) { @@ -99,14 +66,12 @@ TopoDS_Shape getShape(const Handle(Standard_Transient) &theEnti, return aResult; } -// ---------------------------------------------------------------------------- - -std::shared_ptr readAttributes( - STEPCAFControl_Reader &theReader, - std::shared_ptr theResultBody, - const bool theIsMaterials, - std::map< std::wstring,std::list> &theMaterialShape, - std::string& theError) +//============================================================================= +std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, + std::shared_ptr theResultBody, + const bool theIsMaterials, + std::map< std::wstring,std::list> &theMaterialShape, + std::string& theError) { // dummy XCAF Application to handle the STEP XCAF Document Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication(); @@ -152,6 +117,7 @@ std::shared_ptr readAttributes( return ageom; } +//============================================================================= std::shared_ptr setgeom(const Handle(XCAFDoc_ShapeTool) &theShapeTool, const TDF_Label &theLabel, std::string& theError) @@ -180,13 +146,12 @@ std::shared_ptr setgeom(const Handle(XCAFDoc_ShapeTool) &theShape if (theShapeTool->IsFree(aLabel) ) { if (aS.IsNull()) { continue; - } - else { + } else { if (!theShapeTool->IsReference(aLabel) ){ for(TDF_ChildIterator anIt(aLabel); anIt.More(); anIt.Next()) { aB.Add(aCompound, theShapeTool->GetShape(anIt.Value()) ); } - }else{ + } else { aB.Add(aCompound, aS); } } @@ -208,7 +173,7 @@ std::shared_ptr setgeom(const Handle(XCAFDoc_ShapeTool) &theShape return aGeomShape; } } - +//============================================================================= void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, const Handle(XCAFDoc_ColorTool) &theColorTool, const Handle(XCAFDoc_MaterialTool) &theMaterialTool, @@ -221,7 +186,7 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, std::wstring aShapeName; Handle(TDataStd_Name) aN; - if(theLabel.FindAttribute(TDataStd_Name::GetID(), aN)) { + if (theLabel.FindAttribute(TDataStd_Name::GetID(), aN)) { TCollection_ExtendedString aName = aN->Get(); aShapeName = Locale::Convert::toWString(TCollection_AsciiString(aName).ToCString()) ; @@ -229,21 +194,21 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, TopLoc_Location aPartLoc = theLoc; Handle(XCAFDoc_Location) al; - if(theLabel.FindAttribute(XCAFDoc_Location::GetID(), al)) { - if(theIsRef) + if (theLabel.FindAttribute(XCAFDoc_Location::GetID(), al)) { + if (theIsRef) aPartLoc = aPartLoc * al->Get(); else aPartLoc = al->Get(); } TDF_Label aRef; - if(theShapeTool->IsReference(theLabel) && theShapeTool->GetReferredShape(theLabel, aRef)) { + if (theShapeTool->IsReference(theLabel) && theShapeTool->GetReferredShape(theLabel, aRef)) { setShapeAttributes( theShapeTool, theColorTool, theMaterialTool, aRef, aPartLoc,theResultBody,theMaterialShape,true); } - if( theShapeTool->IsSimpleShape(theLabel) && (theIsRef || theShapeTool->IsFree(theLabel))) { + if (theShapeTool->IsSimpleShape(theLabel) && (theIsRef || theShapeTool->IsFree(theLabel))) { TopoDS_Shape aShape = theShapeTool->GetShape(theLabel); @@ -270,7 +235,7 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, Handle(TCollection_HAsciiString) aMatDensName; Handle(TCollection_HAsciiString) aMatDensValType; - if(theMaterialTool->GetMaterial(theLabel, aMatName, aMatDescription, aMatDensity, + if (theMaterialTool->GetMaterial(theLabel, aMatName, aMatDescription, aMatDensity, aMatDensName, aMatDensValType)) { std::wstring aNameMaterial = Locale::Convert::toWString(aMatName->ToCString()); @@ -278,26 +243,24 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, } Quantity_Color aCol; - if(theColorTool->GetColor(theLabel, XCAFDoc_ColorGen, aCol)) { + if (theColorTool->GetColor(theLabel, XCAFDoc_ColorGen, aCol)) { double r = aCol.Red(), g = aCol.Green(), b = aCol.Blue(); std::vector ColRGB = {int(r*255),int(g*255),int(b*255)}; theResultBody->addShapeColor(aShapeName, ColRGB); - } - else if(theColorTool->GetColor(theLabel, XCAFDoc_ColorSurf, aCol)) { + } else if (theColorTool->GetColor(theLabel, XCAFDoc_ColorSurf, aCol)) { double r = aCol.Red(), g = aCol.Green(), b = aCol.Blue(); std::vector aColRGB = {int(r*255),int(g*255),int(b*255)}; theResultBody->addShapeColor(aShapeName, aColRGB); - } - else if(theColorTool->GetColor(theLabel, XCAFDoc_ColorCurv, aCol)) { + } else if (theColorTool->GetColor(theLabel, XCAFDoc_ColorCurv, aCol)) { double aR = aCol.Red(), aG = aCol.Green(), aB = aCol.Blue(); std::vector aColRGB = {int(aR*255),int(aG*255),int(aB*255)}; theResultBody->addShapeColor(aShapeName, aColRGB); } // check explicit coloring of boundary entities - if(aDim == 3) { + if (aDim == 3) { TopExp_Explorer aXp2(aShape, TopAbs_FACE); while(aXp2.More()) { - if(theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorGen, aCol) || + if (theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorGen, aCol) || theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorSurf, aCol) || theColorTool->GetColor(aXp2.Current(), XCAFDoc_ColorCurv, aCol)) { double aR = aCol.Red(), aG = aCol.Green(), aB = aCol.Blue(); @@ -315,10 +278,10 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, aXp2.Next(); } } - if(aDim == 2) { + if (aDim == 2) { TopExp_Explorer aXp1(aShape, TopAbs_EDGE); while(aXp1.More()) { - if(theColorTool->GetColor(aXp1.Current(), XCAFDoc_ColorGen, aCol) || + if (theColorTool->GetColor(aXp1.Current(), XCAFDoc_ColorGen, aCol) || theColorTool->GetColor(aXp1.Current(), XCAFDoc_ColorSurf, aCol) || theColorTool->GetColor(aXp1.Current(), XCAFDoc_ColorCurv, aCol)) { double aR = aCol.Red(), aG = aCol.Green(), aB = aCol.Blue(); @@ -332,8 +295,7 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, aXp1.Next(); } } - } - else { + } else { if (!theShapeTool->IsReference(theLabel) ){ TopoDS_Shape aShape = theShapeTool->GetShape(theLabel); @@ -352,91 +314,84 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, } } - //============================================================================= - /*! - * StoreMaterial() - */ - //============================================================================= - - void storeMaterial( std::shared_ptr theResultBody, - const Handle(Standard_Transient) &theEnti, - const TopTools_IndexedMapOfShape &theIndices, - const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &theShapeLabel, - std::map< std::wstring, std::list> &theMaterialShape ) - { - // Treat Product Definition Shape only. - Handle(StepRepr_ProductDefinitionShape) aPDS = - Handle(StepRepr_ProductDefinitionShape)::DownCast(theEnti); - Handle(StepBasic_ProductDefinition) aProdDef; - - if(aPDS.IsNull() == Standard_False) { - // Product Definition Shape ==> Product Definition - aProdDef = aPDS->Definition().ProductDefinition(); - } - - if (aProdDef.IsNull() == Standard_False) { - // Product Definition ==> Property Definition - const Interface_Graph &aGraph = theTP->Graph(); - Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef); - TopoDS_Shape aShape; - - for(aSubs.Start(); aSubs.More(); aSubs.Next()) { - Handle(StepRepr_PropertyDefinition) aPropD = - Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value()); - - if(aPropD.IsNull() == Standard_False) { - // Property Definition ==> Representation. - Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD); - - for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) { - Handle(StepRepr_PropertyDefinitionRepresentation) aPDR = - Handle(StepRepr_PropertyDefinitionRepresentation):: - DownCast(aSubs1.Value()); - - if(aPDR.IsNull() == Standard_False) { - // Property Definition ==> Material Name. - Handle(StepRepr_Representation) aRepr = aPDR->UsedRepresentation(); - - if(aRepr.IsNull() == Standard_False) { - Standard_Integer anIr; - - for(anIr = 1; anIr <= aRepr->NbItems(); anIr++) { - Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(anIr); - Handle(StepRepr_DescriptiveRepresentationItem) aDRI = - Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI); - - if(aDRI.IsNull() == Standard_False) { - // Get shape from Product Definition - Handle(TCollection_HAsciiString) aMatName = aDRI->Name(); - if(aMatName.IsNull() == Standard_False) { - TCollection_ExtendedString - aMatNameExt (aMatName->ToCString()); +void storeMaterial( std::shared_ptr theResultBody, + const Handle(Standard_Transient) &theEnti, + const TopTools_IndexedMapOfShape &theIndices, + const Handle(Transfer_TransientProcess) &theTP, + const TDF_Label &theShapeLabel, + std::map< std::wstring, std::list> &theMaterialShape ) +{ + // Treat Product Definition Shape only. + Handle(StepRepr_ProductDefinitionShape) aPDS = + Handle(StepRepr_ProductDefinitionShape)::DownCast(theEnti); + Handle(StepBasic_ProductDefinition) aProdDef; + + if (aPDS.IsNull() == Standard_False) { + // Product Definition Shape ==> Product Definition + aProdDef = aPDS->Definition().ProductDefinition(); + } + if (aProdDef.IsNull() == Standard_False) { + // Product Definition ==> Property Definition + const Interface_Graph &aGraph = theTP->Graph(); + Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef); + TopoDS_Shape aShape; + + for(aSubs.Start(); aSubs.More(); aSubs.Next()) { + Handle(StepRepr_PropertyDefinition) aPropD = + Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value()); + + if (aPropD.IsNull() == Standard_False) { + // Property Definition ==> Representation. + Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD); + + for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) { + Handle(StepRepr_PropertyDefinitionRepresentation) aPDR = + Handle(StepRepr_PropertyDefinitionRepresentation):: + DownCast(aSubs1.Value()); + + if (aPDR.IsNull() == Standard_False) { + // Property Definition ==> Material Name. + Handle(StepRepr_Representation) aRepr = aPDR->UsedRepresentation(); + + if (aRepr.IsNull() == Standard_False) { + Standard_Integer anIr; + + for(anIr = 1; anIr <= aRepr->NbItems(); anIr++) { + Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(anIr); + Handle(StepRepr_DescriptiveRepresentationItem) aDRI = + Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI); + + if (aDRI.IsNull() == Standard_False) { + // Get shape from Product Definition + Handle(TCollection_HAsciiString) aMatName = aDRI->Name(); + if (aMatName.IsNull() == Standard_False) { + TCollection_ExtendedString + aMatNameExt (aMatName->ToCString()); + + if (aShape.IsNull()) { + //Get the shape. + aShape = getShape(aProdDef, theTP); if (aShape.IsNull()) { - //Get the shape. - aShape = getShape(aProdDef, theTP); - if (aShape.IsNull()) { - return; - } + return; } + } - // as PRODUCT can be included in the main shape - // several times, we look here for all iclusions. - Standard_Integer anISub, aNbSubs = theIndices.Extent(); + // as PRODUCT can be included in the main shape + // several times, we look here for all iclusions. + Standard_Integer anISub, aNbSubs = theIndices.Extent(); - for (anISub = 1; anISub <= aNbSubs; anISub++) { - TopoDS_Shape aSub = theIndices.FindKey(anISub); + for (anISub = 1; anISub <= aNbSubs; anISub++) { + TopoDS_Shape aSub = theIndices.FindKey(anISub); - if (aSub.IsPartner(aShape)) { - std::shared_ptr aShapeGeom(new GeomAPI_Shape); - aShapeGeom->setImpl(new TopoDS_Shape(aSub)); - std::wstring aNom = theResultBody->findShapeName(aShapeGeom); - std::wstring aMName= Locale::Convert::toWString(aMatName->ToCString()); - theMaterialShape[aMName].push_back(aNom); + if (aSub.IsPartner(aShape)) { + std::shared_ptr aShapeGeom(new GeomAPI_Shape); + aShapeGeom->setImpl(new TopoDS_Shape(aSub)); + std::wstring aNom = theResultBody->findShapeName(aShapeGeom); + std::wstring aMName= Locale::Convert::toWString(aMatName->ToCString()); + theMaterialShape[aMName].push_back(aNom); - } } } } @@ -448,4 +403,5 @@ void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, } } } +} diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h index 04d4cb721..d43019068 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImportXCAF.h @@ -21,42 +21,32 @@ #define GEOMALGOAPI_STEPIMPORTXCAF_H_ #include -#include -#include -#include -#include -#include -#include #include -#include #include -#include -#include #include #include #include - // read Attributs of step file + /// read Attributs of step file GEOMALGOAPI_EXPORT - std::shared_ptr readAttributes( - STEPCAFControl_Reader &theReader, - std::shared_ptr theResultBody, - const bool theMaterials, - std::map< std::wstring,std::list> &theMaterialShape, - std::string& theError); -// read attributs for label + std::shared_ptr readAttributes(STEPCAFControl_Reader &theReader, + std::shared_ptr theResultBody, + const bool theMaterials, + std::map< std::wstring,std::list> &theMaterialShape, + std::string& theError); +/// read attributs for label GEOMALGOAPI_EXPORT void setShapeAttributes(const Handle(XCAFDoc_ShapeTool) &theShapeTool, - const Handle(XCAFDoc_ColorTool) &theColorTool, - const Handle(XCAFDoc_MaterialTool) &TheMaterialTool, - const TDF_Label &theLabel, - const TopLoc_Location &theLoc, - std::shared_ptr theResultBody, - std::map< std::wstring, std::list> &theMaterialShape, - bool theIsRef); + const Handle(XCAFDoc_ColorTool) &theColorTool, + const Handle(XCAFDoc_MaterialTool) &TheMaterialTool, + const TDF_Label &theLabel, + const TopLoc_Location &theLoc, + std::shared_ptr theResultBody, + std::map< std::wstring, std::list> &theMaterialShape, + bool theIsRef); // read geometry GEOMALGOAPI_EXPORT @@ -66,11 +56,11 @@ std::shared_ptr setgeom(const Handle(XCAFDoc_ShapeTool) &shapeToo // store Materiel for theShapeLabel in the map theMaterialShape GEOMALGOAPI_EXPORT -void storeMaterial( std::shared_ptr theResultBody, - const Handle(Standard_Transient) &theEnti, - const TopTools_IndexedMapOfShape &theIndices, - const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &theShapeLabel, - std::map< std::wstring, std::list> &theMaterialShape ); +void storeMaterial(std::shared_ptr theResultBody, + const Handle(Standard_Transient) &theEnti, + const TopTools_IndexedMapOfShape &theIndices, + const Handle(Transfer_TransientProcess) &theTP, + const TDF_Label &theShapeLabel, + std::map< std::wstring, std::list> &theMaterialShape); #endif /* GEOMALGOAPI_STEPIMPORTXCAF_H_ */ diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 6c3a491c5..ca53ccf86 100644 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -186,12 +186,12 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape, if (aShape.IsNull()) return; // null shape inside - if(!theIsStoreSameShapes) { + if (!theIsStoreSameShapes) { 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)) { + if (!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) { // This shape is already in document, store reference instead of shape; const TDF_Label aFoundLabel = aNS->Label(); TDF_Reference::Set(aShapeLab, aFoundLabel); @@ -203,11 +203,11 @@ void Model_BodyBuilder::store(const GeomShapePtr& theShape, aBuilder.Generated(aShape); // register name aShapeLab.ForgetAttribute(TDF_Reference::GetID()); - if(!aBuilder.NamedShape()->IsEmpty()) { + if (!aBuilder.NamedShape()->IsEmpty()) { Handle(TDataStd_Name) anAttr; - if(aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { + if (aBuilder.NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { std::wstring aName = Locale::Convert::toWString(anAttr->Get().ToExtString()); - if(!aName.empty()) { + if (!aName.empty()) { std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder.NamedShape()->Label(), aName); @@ -255,11 +255,11 @@ void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape, } // register name - if(!aBuilder->NamedShape()->IsEmpty()) { + if (!aBuilder->NamedShape()->IsEmpty()) { Handle(TDataStd_Name) anAttr; - if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { + if (aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(),anAttr)) { std::wstring aName = Locale::Convert::toWString(anAttr->Get().ToExtString()); - if(!aName.empty()) { + if (!aName.empty()) { std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder->NamedShape()->Label(), aName); @@ -369,11 +369,11 @@ void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape, storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label()); } - if(!aBuilder->NamedShape()->IsEmpty()) { + if (!aBuilder->NamedShape()->IsEmpty()) { Handle(TDataStd_Name) anAttr; - if(aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) { + if (aBuilder->NamedShape()->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) { std::wstring aName = Locale::Convert::toWString(anAttr->Get().ToExtString()); - if(!aName.empty()) { + if (!aName.empty()) { std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); aDoc->addNamingName(aBuilder->NamedShape()->Label(), aName); @@ -504,8 +504,7 @@ bool Model_BodyBuilder::generated(const GeomShapePtr& theNewShape, if (anIndexTags.index == 2) { buildName(anIndexTags.tags.front(), theName + "_1"); } - } - else { + } else { IndexTags anIndexTags; anIndexTags.index = 1; anIndexTags.tags.push_back(myFreePrimitiveTag); @@ -806,7 +805,7 @@ void loadGeneratedDangleShapes( void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, const std::string& theName) { - if(theShape->isNull()) return; + if (theShape->isNull()) return; TopoDS_Shape aShape = theShape->impl(); std::string aName; if (aShape.ShapeType() == TopAbs_SOLID) { @@ -850,7 +849,7 @@ void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape, TopTools_ListIteratorOfListOfShape anIter(aLL); const TopoDS_Face& aFace = TopoDS::Face(anIter.Value()); anIter.Next(); - if(aFace.IsEqual(anIter.Value())) { + if (aFace.IsEqual(anIter.Value())) { builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i)); TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1); aName = theName + "_" + aStr.ToCString(); @@ -994,7 +993,7 @@ void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& loadNextLevels(itrShape, theName); } TopTools_ListOfShape aList; - if(findAmbiguities(aShape, aList)) { + if (findAmbiguities(aShape, aList)) { TopTools_ListIteratorOfListOfShape it(aList); for (; it.More(); it.Next(), ++myFreePrimitiveTag) { builder(myFreePrimitiveTag)->Generated(it.Value()); diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index a5b5134ae..e8fbf563b 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -1241,9 +1241,9 @@ void Model_Objects::storeResult(std::shared_ptr theFeatureData, theResult->data()->setName(L""); } else { std::wstringstream aName; - if( theNameShape != L"" ){ + if ( theNameShape != L"" ){ aName << theNameShape; - }else{ + } else { aName << aNewName; // if there are several results (issue #899: any number of result), // add unique prefix starting from second diff --git a/src/Model/Model_Objects.h b/src/Model/Model_Objects.h index 49ba223b0..3ae6c713a 100644 --- a/src/Model/Model_Objects.h +++ b/src/Model/Model_Objects.h @@ -125,7 +125,7 @@ class Model_Objects /// Creates a body result std::shared_ptr createBody( const std::shared_ptr& theFeatureData, const int theIndex = 0, - const std::wstring& theNameShape = L""); + const std::wstring& theNameShape = L""); /// Creates a part result std::shared_ptr createPart( const std::shared_ptr& theFeatureData, const int theIndex = 0); @@ -221,7 +221,7 @@ class Model_Objects //! Initializes the data fields of the feature void initData(ObjectPtr theObj, TDF_Label theLab, const int theTag); - //! Allows to store the result in the data tree of the document + //! Allows to store the result in the data tree of the document //! (attaches 'data' of result to tree) void storeResult(std::shared_ptr theFeatureData, std::shared_ptr theResult, diff --git a/src/Model/Model_ResultBody.cpp b/src/Model/Model_ResultBody.cpp index f83c96fed..0595ba58e 100644 --- a/src/Model/Model_ResultBody.cpp +++ b/src/Model/Model_ResultBody.cpp @@ -237,49 +237,48 @@ void Model_ResultBody::updateConcealment() void Model_ResultBody::addShapeColor( const std::wstring& theName,std::vector& color) { - if( myColorsShape.find(theName) == myColorsShape.end()) + if (myColorsShape.find(theName) == myColorsShape.end()) myColorsShape[ theName ] = color; } std::wstring Model_ResultBody::addShapeName(std::shared_ptr theshape, const std::wstring& theName ){ - int indice = 1; - std::wstringstream aName; - aName << theName; - while(myNamesShape.find(aName.str()) != myNamesShape.end() ){ - aName.str(L""); - aName << theName << L"__" << indice; - indice++; - } - myNamesShape[ aName.str() ] = theshape; + int indice = 1; + std::wstringstream aName; + aName << theName; + while(myNamesShape.find(aName.str()) != myNamesShape.end() ){ + aName.str(L""); + aName << theName << L"__" << indice; + indice++; + } + myNamesShape[ aName.str() ] = theshape; - return aName.str(); + return aName.str(); } std::wstring Model_ResultBody::findShapeName(std::shared_ptr theshape){ - TopoDS_Shape aShape = theshape->impl(); - for (std::map< std::wstring, std::shared_ptr >::iterator it = - myNamesShape.begin(); - it != myNamesShape.end(); - ++it) - { - TopoDS_Shape curSelectedShape = (*it).second->impl(); - if( (aShape.IsSame(curSelectedShape))) { - return (*it).first; - } - } - return L"material not found" ; + TopoDS_Shape aShape = theshape->impl(); + for (std::map< std::wstring, std::shared_ptr >::iterator it = + myNamesShape.begin(); + it != myNamesShape.end(); + ++it) + { + TopoDS_Shape curSelectedShape = (*it).second->impl(); + if ((aShape.IsSame(curSelectedShape))) { + return (*it).first; + } + } + return L"material not found" ; } - void Model_ResultBody::setShapeName( std::map< std::wstring, std::shared_ptr > &theshapename, std::map< std::wstring, std::vector> & theColorsShape) { - myNamesShape = theshapename; - myColorsShape = theColorsShape; + myNamesShape = theshapename; + myColorsShape = theColorsShape; } void Model_ResultBody::clearShapeNameAndColor(){ @@ -323,7 +322,7 @@ void Model_ResultBody::updateSubs(const std::shared_ptr& theThisS ++it) { TopoDS_Shape curSelectedShape = (*it).second->impl(); - if( !(aShapesIter.Value().IsSame(curSelectedShape))) continue; + if (!(aShapesIter.Value().IsSame(curSelectedShape))) continue; thenameshape = (*it).first; break; } @@ -331,7 +330,7 @@ void Model_ResultBody::updateSubs(const std::shared_ptr& theThisS //finf color read std::map< std::wstring, std::vector>::iterator itColor = myColorsShape.find(thenameshape); - if(itColor != myColorsShape.end()){ + if (itColor != myColorsShape.end()){ ModelAPI_Tools::setColor(aSub,(*itColor).second); } aSub->setShapeName(myNamesShape,myColorsShape); diff --git a/src/Model/Model_ResultBody.h b/src/Model/Model_ResultBody.h index b23aa1ac4..35da37f99 100644 --- a/src/Model/Model_ResultBody.h +++ b/src/Model/Model_ResultBody.h @@ -117,7 +117,7 @@ protected: /// Makes a body on the given feature Model_ResultBody(); -/// Updates the sub-bodies if shape of this object is composite-solid + /// Updates the sub-bodies if shape of this object is composite-solid void updateSubs(const std::shared_ptr& theThisShape, const bool theShapeChanged = true); @@ -126,7 +126,7 @@ protected: const GeomShapePtr& theThisShape, const std::list& theOlds, const std::shared_ptr theMakeShape, const bool isGenerated); - // Checks the state of children and parents to send events of creation/erase when needed + /// Checks the state of children and parents to send events of creation/erase when needed void updateConcealment(); /// Adds to theOldForSub only old shapes that where used for theSub creation @@ -135,23 +135,23 @@ protected: friend class Model_Objects; - // Add shape Name for read shape in step file + /// Add shape Name for read shape in step file std::wstring addShapeName(std::shared_ptr,const std::wstring& theName) override; - // Add color for shape Name read shape in step file + /// Add color for shape Name read shape in step file void addShapeColor( const std::wstring& theName,std::vector& color) override; - // Set the map of name and color read shape in step file + /// Set the map of name and color read shape in step file void setShapeName(std::map< std::wstring, std::shared_ptr > &theshapename, std::map< std::wstring, std::vector> & theColorsShape) override; - // find the name of shapp read in step file + /// find the name of shapp read in step file std::wstring findShapeName(std::shared_ptr theshape) override; - // Clear the map of name and color read shape in step file + /// Clear the map of name and color read shape in step file void clearShapeNameAndColor() override; - // map with the name read in step file and shape + /// map with the name read in step file and shape std::map< std::wstring, std::shared_ptr > myNamesShape; - // map with the name contruct and color read + /// map with the name contruct and color read std::map< std::wstring, std::vector> myColorsShape; }; diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 11fdd2421..9f33c13b4 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -184,17 +184,20 @@ public: /// Cleans cash related to the already stored elements MODELAPI_EXPORT virtual void cleanCash() = 0; - - // Add shape Name for read shape in step file - MODELAPI_EXPORT virtual std::wstring addShapeName(std::shared_ptr,const std::wstring& theName) = 0; - // Add color for shape Name read shape in step file - MODELAPI_EXPORT virtual void addShapeColor(const std::wstring& theName,std::vector& color) = 0; - // Set the map of name and color read shape in step file - MODELAPI_EXPORT virtual void setShapeName(std::map< std::wstring, std::shared_ptr > &theshapename, - std::map< std::wstring, std::vector> & theColorsShape) = 0; - // Clear the map of name and color read shape in step file + + /// Add shape Name for read shape in step file + MODELAPI_EXPORT virtual std::wstring addShapeName + (std::shared_ptr,const std::wstring& theName) = 0; + /// Add color for shape Name read shape in step file + MODELAPI_EXPORT virtual void addShapeColor + (const std::wstring& theName,std::vector& color) = 0; + /// Set the map of name and color read shape in step file + MODELAPI_EXPORT virtual void setShapeName + (std::map< std::wstring, std::shared_ptr > &theshapename, + std::map< std::wstring, std::vector> & theColorsShape) = 0; + /// Clear the map of name and color read shape in step file MODELAPI_EXPORT virtual void clearShapeNameAndColor() = 0; - // find the name of shapp read in step file + /// find the name of shapp read in step file MODELAPI_EXPORT virtual std::wstring findShapeName(std::shared_ptr theshape) = 0; @@ -202,8 +205,6 @@ protected: /// Default constructor accessible only from Model_Objects MODELAPI_EXPORT ModelAPI_ResultBody(); - - }; //! Pointer on feature object diff --git a/src/PythonAPI/model/exchange/__init__.py b/src/PythonAPI/model/exchange/__init__.py index 84b62bcc3..800ab45f9 100644 --- a/src/PythonAPI/model/exchange/__init__.py +++ b/src/PythonAPI/model/exchange/__init__.py @@ -19,7 +19,7 @@ """Package for Exchange plugin for the Parametric Geometry API of the Modeler. """ -from ExchangeAPI import addImport, addImportStep, exportToFile, exportToXAO, exportToSTL +from ExchangeAPI import addImport, addImportSTEP, exportToFile, exportToXAO, exportToSTL from ExchangeAPI import exportPart, importPart from .tools import * -- 2.39.2