From 5737c25f53a7ef085ac3cc87a792d17113133036 Mon Sep 17 00:00:00 2001 From: ngo Date: Mon, 4 Feb 2013 12:57:57 +0000 Subject: [PATCH] Restart from scratch --- src/GEOMGUI/GEOM_images.ts | 12 ++ src/GEOMGUI/GEOM_msg_en.ts | 46 +++++ src/GEOMGUI/GeometryGUI.cxx | 10 +- src/GEOMGUI/GeometryGUI_Operations.h | 2 + src/GEOMImpl/GEOMImpl_ExportXAODriver.cxx | 120 ++++++++++++ src/GEOMImpl/GEOMImpl_ExportXAODriver.hxx | 121 ++++++++++++ src/GEOMImpl/GEOMImpl_Gen.cxx | 19 ++ src/GEOMImpl/GEOMImpl_Gen.hxx | 4 + src/GEOMImpl/GEOMImpl_IExportXAO.hxx | 53 +++++ .../GEOMImpl_IImportExportOperations.cxx | 183 ++++++++++++++++++ .../GEOMImpl_IImportExportOperations.hxx | 60 ++++++ src/GEOMImpl/GEOMImpl_Types.hxx | 2 + src/GEOMImpl/GUID.txt | 2 + src/GEOMImpl/Makefile.am | 8 + src/GEOM_I/GEOM_Gen_i.cc | 20 ++ src/GEOM_I/GEOM_Gen_i.hh | 5 + src/GEOM_I/GEOM_IImportExportOperations_i.cc | 103 ++++++++++ src/GEOM_I/GEOM_IImportExportOperations_i.hh | 52 +++++ src/GEOM_I/Makefile.am | 2 + src/GEOM_I_Superv/GEOM_Superv_i.cc | 38 ++++ src/GEOM_I_Superv/GEOM_Superv_i.hh | 5 + src/GEOM_SWIG/geompyDC.py | 17 ++ 22 files changed, 882 insertions(+), 2 deletions(-) create mode 100644 src/GEOMImpl/GEOMImpl_ExportXAODriver.cxx create mode 100644 src/GEOMImpl/GEOMImpl_ExportXAODriver.hxx create mode 100644 src/GEOMImpl/GEOMImpl_IExportXAO.hxx create mode 100644 src/GEOMImpl/GEOMImpl_IImportExportOperations.cxx create mode 100644 src/GEOMImpl/GEOMImpl_IImportExportOperations.hxx create mode 100644 src/GEOM_I/GEOM_IImportExportOperations_i.cc create mode 100644 src/GEOM_I/GEOM_IImportExportOperations_i.hh diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 9cd7e615e..44f455d71 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1336,6 +1336,18 @@ ICON_OBJBROWSER_ADVANCED_203 dividedcylinder.png + + ICON_DLG_EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS + exportxao_exportingshape_filename_lgroups_lfields.png + + + ICO_EXPORTXAO + exportxao.png + + + ICON_OBJBROWSER_IMPORTEXPORT_200 + tree_exportxao.png + diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index ed57921e0..e741c1392 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -5733,4 +5733,50 @@ Do you want to create new material? P&ublish And Close + + ImportExportGUI_ExportXAODlg + + GEOM_EXPORTXAO_TITLE + Export XAO + + + GEOM_EXPORTXAO + ExportXAO + + + GEOM_EXPORTXAO_EXPORTINGSHAPE + Exporting Shape + + + GEOM_EXPORTXAO_FILENAME + File Name + + + GEOM_EXPORTXAO_LGROUPS + List of groups + + + GEOM_EXPORTXAO_LFIELDS + List of fields + + + + @default + + TOP_EXPORTXAO + ExportXAO + + + MEN_EXPORTXAO + ExportXAO + + + STB_EXPORTXAO + ExportXAO + + + GEOM_IMPORTEXPORT_204 + ExportXAO + + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index d13a0fd99..37528db55 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -579,6 +579,9 @@ void GeometryGUI::OnGUIEvent( int id ) //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// libName = "AdvancedGUI"; break; + case GEOMOp::OpExportXAO: // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO + libName = "ImportExportGUI"; + break; default: break; } @@ -906,6 +909,7 @@ void GeometryGUI::initialize( CAM_Application* app ) // createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" ); createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" ); createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" ); + createGeomAction( GEOMOp::OpExportXAO, "EXPORTXAO" ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// // ---- create menus -------------------------- @@ -955,8 +959,9 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpPipePath, genId, -1 ); #endif -// int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 ); + int impexpId = createMenu( tr( "MEN_IMPORTEXPORT" ), newEntId, -1 ); + createMenu( GEOMOp::OpExportXAO, impexpId, -1 ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// createMenu( separator(), newEntId, -1 ); @@ -1227,8 +1232,9 @@ void GeometryGUI::initialize( CAM_Application* app ) createTool( GEOMOp::OpFeatureDetect, picturesTbId ); #endif -// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); + int impexpTbId = createTool( tr( "TOOL_IMPORTEXPORT" ) ); + createTool( GEOMOp::OpExportXAO, impexpTbId ); //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@// // ---- create popup menus -------------------------- diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index e17172e49..f08bb5653 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -192,6 +192,8 @@ namespace GEOMOp { //OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER + // ImportExport ----------------//-------------------------------- + OpExportXAO = 10005, // MENU NEW ENTITY - IMPORTEXPORT - EXPORTXAO //@@ insert new functions before this line @@ do not remove this line @@// }; } diff --git a/src/GEOMImpl/GEOMImpl_ExportXAODriver.cxx b/src/GEOMImpl/GEOMImpl_ExportXAODriver.cxx new file mode 100644 index 000000000..60cc8fcfa --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ExportXAODriver.cxx @@ -0,0 +1,120 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#include + +#include +#include +#include +#include + +#include +#include + +//@@ include required header files here @@// + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= +const Standard_GUID& GEOMImpl_ExportXAODriver::GetID() +{ + static Standard_GUID aGUID("FF1BBB71-5D14-4df2-980B-3A668264EA16"); + return aGUID; +} + +//======================================================================= +//function : GEOMImpl_ExportXAODriver +//purpose : +//======================================================================= +GEOMImpl_ExportXAODriver::GEOMImpl_ExportXAODriver() +{ +} + +//======================================================================= +//function : Execute +//purpose : +//======================================================================= +Standard_Integer GEOMImpl_ExportXAODriver::Execute(TFunction_Logbook& log) const +{ + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IExportXAO aData (aFunction); + Standard_Integer aType = aFunction->GetType(); + + TopoDS_Shape aShape; + + if (aType == EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS) { + //@@ add implementation of the operation driver here to initialize aShape variable @@// + //aShape = @...@ + } + else { + // other construction modes here + } + + if (aShape.IsNull()) return 0; + + aFunction->SetValue(aShape); + + log.SetTouched(Label()); + + return 1; +} + +//======================================================================= +//function : GEOMImpl_ExportXAODriver_Type_ +//purpose : +//======================================================================= +Standard_EXPORT Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_() +{ + static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); + static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ExportXAODriver", + sizeof(GEOMImpl_ExportXAODriver), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + return _aType; +} + +//======================================================================= +//function : DownCast +//purpose : +//======================================================================= +const Handle(GEOMImpl_ExportXAODriver) Handle(GEOMImpl_ExportXAODriver)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(GEOMImpl_ExportXAODriver) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ExportXAODriver))) { + _anOtherObject = Handle(GEOMImpl_ExportXAODriver)((Handle(GEOMImpl_ExportXAODriver)&)AnObject); + } + } + + return _anOtherObject; +} diff --git a/src/GEOMImpl/GEOMImpl_ExportXAODriver.hxx b/src/GEOMImpl/GEOMImpl_ExportXAODriver.hxx new file mode 100644 index 000000000..c0161f8da --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_ExportXAODriver.hxx @@ -0,0 +1,121 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMImpl_ExportXAODriver_HXX +#define _GEOMImpl_ExportXAODriver_HXX + +#include + +class Handle_Standard_Type; +class GEOMImpl_ExportXAODriver; + +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ExportXAODriver); + +class Handle(GEOMImpl_ExportXAODriver) : public Handle(TFunction_Driver) { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + Handle(GEOMImpl_ExportXAODriver)():Handle(TFunction_Driver)() {} + Handle(GEOMImpl_ExportXAODriver)(const Handle(GEOMImpl_ExportXAODriver)& aHandle) : Handle(TFunction_Driver)(aHandle) + {} + + Handle(GEOMImpl_ExportXAODriver)(const GEOMImpl_ExportXAODriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) + {} + + Handle(GEOMImpl_ExportXAODriver)& operator=(const Handle(GEOMImpl_ExportXAODriver)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(GEOMImpl_ExportXAODriver)& operator=(const GEOMImpl_ExportXAODriver* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + GEOMImpl_ExportXAODriver* operator->() + { + return (GEOMImpl_ExportXAODriver *)ControlAccess(); + } + + GEOMImpl_ExportXAODriver* operator->() const + { + return (GEOMImpl_ExportXAODriver *)ControlAccess(); + } + + Standard_EXPORT ~Handle(GEOMImpl_ExportXAODriver)() {}; + + Standard_EXPORT static const Handle(GEOMImpl_ExportXAODriver) DownCast(const Handle(Standard_Transient)& AnObject); +}; + +class GEOMImpl_ExportXAODriver : public TFunction_Driver { +public: + inline void* operator new(size_t,void* anAddress) + { + return anAddress; + } + inline void* operator new(size_t size) + { + return Standard::Allocate(size); + } + inline void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + // Methods PUBLIC + // + Standard_EXPORT GEOMImpl_ExportXAODriver(); + Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; + Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} + Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const + { + return Standard_True; + } + Standard_EXPORT static const Standard_GUID& GetID(); + Standard_EXPORT ~GEOMImpl_ExportXAODriver() {}; + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const + { + return STANDARD_TYPE(GEOMImpl_ExportXAODriver); + } + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const + { + return (STANDARD_TYPE(GEOMImpl_ExportXAODriver) == AType || TFunction_Driver::IsKind(AType)); + } +}; + +#endif // _GEOMImpl_ExportXAODriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx index f8f02247d..f45760687 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.cxx +++ b/src/GEOMImpl/GEOMImpl_Gen.cxx @@ -85,6 +85,7 @@ #include #include // #include +#include /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ //============================================================================= @@ -173,6 +174,10 @@ GEOMImpl_Gen::GEOMImpl_Gen() // TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), new GEOMImpl_DividedCylinderDriver()); /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + // ImportExport operations + TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ExportXAODriver::GetID(), new GEOMImpl_ExportXAODriver()); + /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + SetEngine(this); } @@ -417,3 +422,17 @@ GEOMImpl_IAdvancedOperations* GEOMImpl_Gen::GetIAdvancedOperations(int theDocID) return _mapOfAdvancedOperations[theDocID]; } +//============================================================================= +/*! + * GetIImportExportOperations + */ +//============================================================================= +GEOMImpl_IImportExportOperations* GEOMImpl_Gen::GetIImportExportOperations(int theDocID) +{ + if(_mapOfImportExportOperations.find(theDocID) == _mapOfImportExportOperations.end()) { + _mapOfImportExportOperations[theDocID] = new GEOMImpl_IImportExportOperations(this, theDocID); + } + + return _mapOfImportExportOperations[theDocID]; +} + diff --git a/src/GEOMImpl/GEOMImpl_Gen.hxx b/src/GEOMImpl/GEOMImpl_Gen.hxx index 8378dbe55..c59ef1e45 100644 --- a/src/GEOMImpl/GEOMImpl_Gen.hxx +++ b/src/GEOMImpl/GEOMImpl_Gen.hxx @@ -40,6 +40,7 @@ #include "GEOMImpl_IMeasureOperations.hxx" #include "GEOMImpl_IGroupOperations.hxx" #include "GEOMImpl_IAdvancedOperations.hxx" +#include "GEOMImpl_IImportExportOperations.hxx" #include "GEOM_Engine.hxx" class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine @@ -74,6 +75,8 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine GEOMImpl_IAdvancedOperations* GetIAdvancedOperations(int theDocID); + GEOMImpl_IImportExportOperations* GetIImportExportOperations(int theDocID); + private: std::map _mapOfBasicOperations; @@ -89,6 +92,7 @@ class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine std::map _mapOfMeasureOperations; std::map _mapOfGroupOperations; std::map _mapOfAdvancedOperations; + std::map _mapOfImportExportOperations; }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IExportXAO.hxx b/src/GEOMImpl/GEOMImpl_IExportXAO.hxx new file mode 100644 index 000000000..315fbe9a2 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IExportXAO.hxx @@ -0,0 +1,53 @@ +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + +#ifndef _GEOMImpl_IExportXAO_HXX_ +#define _GEOMImpl_IExportXAO_HXX_ + +#include "GEOM_Function.hxx" + +#define EXPORTXAO_ARG_EXPORTINGSHAPE 1 +#define EXPORTXAO_ARG_FILENAME 2 +#define EXPORTXAO_ARG_LGROUPS 3 +#define EXPORTXAO_ARG_LFIELDS 4 + +class GEOMImpl_IExportXAO +{ +public: + GEOMImpl_IExportXAO(Handle(GEOM_Function) theFunction): _func(theFunction) {} + + void SetExportingShape(Handle(GEOM_Function) theExportingShape) { _func->SetReference(EXPORTXAO_ARG_EXPORTINGSHAPE, theExportingShape); } + Handle(GEOM_Function) GetExportingShape() { return _func->GetReference(EXPORTXAO_ARG_EXPORTINGSHAPE); } + + void SetFileName(const TCollection_AsciiString& theFileName) { _func->SetString(EXPORTXAO_ARG_FILENAME, theFileName); } + const TCollection_AsciiString GetFileName() { return _func->GetString(EXPORTXAO_ARG_FILENAME); } + + void SetGroup(int theId, Handle(GEOM_Function) theGroup) { _func->SetReference(EXPORTXAO_ARG_LGROUPS+theId, theGroup); } + Handle(GEOM_Function) GetGroup(int theId) { return _func->GetReference(EXPORTXAO_ARG_LGROUPS+theId); } + + void SetField(int theId, Handle(GEOM_Function) theField) { _func->SetReference(EXPORTXAO_ARG_LFIELDS+theId, theField); } + Handle(GEOM_Function) GetField(int theId) { return _func->GetReference(EXPORTXAO_ARG_LFIELDS+theId); } + +private: + Handle(GEOM_Function) _func; +}; + +#endif // _GEOMImpl_IExportXAO_HXX_ diff --git a/src/GEOMImpl/GEOMImpl_IImportExportOperations.cxx b/src/GEOMImpl/GEOMImpl_IImportExportOperations.cxx new file mode 100644 index 000000000..bd49205f0 --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IImportExportOperations.cxx @@ -0,0 +1,183 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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. +// +// 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 +// +// File : GEOMImpl_IImportExportOperations.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#include + +#include "GEOMImpl_Types.hxx" +#include "GEOMImpl_IImportExportOperations.hxx" +#include "GEOMImpl_IBasicOperations.hxx" +#include "GEOMImpl_IBooleanOperations.hxx" +#include "GEOMImpl_IShapesOperations.hxx" +#include "GEOMImpl_ITransformOperations.hxx" +#include "GEOMImpl_IBlocksOperations.hxx" +#include "GEOMImpl_I3DPrimOperations.hxx" +#include "GEOMImpl_ILocalOperations.hxx" +#include "GEOMImpl_IHealingOperations.hxx" + +#include "GEOMImpl_Gen.hxx" + +#include + +#include +#include +#include + +#include "GEOM_Function.hxx" +#include "GEOM_PythonDump.hxx" + +#include +#include +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ + +#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 + +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations(GEOM_Engine* theEngine, int theDocID) : + GEOM_IOperations(theEngine, theDocID) +{ + MESSAGE("GEOMImpl_IImportExportOperations::GEOMImpl_IImportExportOperations"); + myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID()); + myBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID()); + myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID()); + myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID()); + myBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID()); + my3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID()); + myLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID()); + myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID()); +} + +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations() +{ + MESSAGE("GEOMImpl_IImportExportOperations::~GEOMImpl_IImportExportOperations"); + delete myBasicOperations; + delete myBooleanOperations; + delete myShapesOperations; + delete myTransformOperations; + delete myBlocksOperations; + delete my3DPrimOperations; + delete myLocalOperations; + delete myHealingOperations; +} + +//============================================================================= +/*! + * Export a shape to XAO Format + * \param theExportingShape Shape to export + * \param theFileName The name of the exported file + * \param thelGroups List of groups to export + * \param thelFields List of fields to export + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +bool GEOMImpl_IImportExportOperations::ExportXAO (Handle(GEOM_Object) theExportingShape, const std::string theFileName, std::list thelGroups, std::list thelFields) +{ + SetErrorCode(KO); + bool isGood = false; + + //Add a new shape function with parameters + Handle(GEOM_Function) aRefFunction = theExportingShape->GetLastFunction(); + if (aRefFunction.IsNull()) return false; + + //Add a new result object + Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT); + + //Add an Export function + Handle(GEOM_Function) aFunction = result->AddFunction(GEOMImpl_ExportXAODriver::GetID(), EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS); + if (aFunction.IsNull()) return false; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_ExportXAODriver::GetID()) return false; + + GEOMImpl_IExportXAO aData (aRefFunction); + + TCollection_AsciiString FileName = theFileName.c_str(); + aData.SetExportingShape(aRefFunction); + aData.SetFileName(FileName); + /* A MODIFIER aData.SetlGroups(thelGroups); + aData.SetlFields(thelFields);*/ + + //Compute the resulting value + try { +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("ExportXAO driver failed : Not enough space on disk, or you haven't permissions to write this directory"); + return false; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return false; + } + + //Make a Python command + GEOM::TPythonDump pd (aFunction); + std::list::iterator itG = thelGroups.begin(); + std::list::iterator itF = thelFields.begin(); + pd << /*isGood <<*/ " = geompy.ExportXAO(" << theExportingShape << ", " << FileName.ToCString() << ", ["; + //itG = thePoints.begin(); + pd << (*itG++); + while (itG != thelGroups.end()) { + pd << ", " << (*itG++); + } + pd << "], ["; + pd << (*itF++); + while (itF != thelFields.end()) { + pd << ", " << (*itF++); + } + pd << "])"; + + SetErrorCode(OK); + + return isGood; +} +/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/GEOMImpl_IImportExportOperations.hxx b/src/GEOMImpl/GEOMImpl_IImportExportOperations.hxx new file mode 100644 index 000000000..72328f4fd --- /dev/null +++ b/src/GEOMImpl/GEOMImpl_IImportExportOperations.hxx @@ -0,0 +1,60 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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. +// +// 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 +// +// File : GEOMImpl_IImportExportOperations.hxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) + +#ifndef _GEOMImpl_IImportExportOperations_HXX_ +#define _GEOMImpl_IImportExportOperations_HXX_ + +#include +#include "GEOM_IOperations.hxx" +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +#include + +class GEOMImpl_IBasicOperations; +class GEOMImpl_IBooleanOperations; +class GEOMImpl_IShapesOperations; +class GEOMImpl_ITransformOperations; +class GEOMImpl_IBlocksOperations; +class GEOMImpl_I3DPrimOperations; +class GEOMImpl_ILocalOperations; +class GEOMImpl_IHealingOperations; + +class GEOMImpl_IImportExportOperations: public GEOM_IOperations { + +private: + GEOMImpl_IBasicOperations* myBasicOperations; + GEOMImpl_IBooleanOperations* myBooleanOperations; + GEOMImpl_IShapesOperations* myShapesOperations; + GEOMImpl_ITransformOperations* myTransformOperations; + GEOMImpl_IBlocksOperations* myBlocksOperations; + GEOMImpl_I3DPrimOperations* my3DPrimOperations; + GEOMImpl_ILocalOperations* myLocalOperations; + GEOMImpl_IHealingOperations* myHealingOperations; + +public: + Standard_EXPORT GEOMImpl_IImportExportOperations(GEOM_Engine* theEngine, int theDocID); + Standard_EXPORT ~GEOMImpl_IImportExportOperations(); + + Standard_EXPORT bool ExportXAO (Handle(GEOM_Object) theExportingShape, const std::string theFileName, std::list thelGroups, std::list thelFields); + /*@@ insert new functions before this line @@ do not remove this line @@*/ +}; +#endif diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 4aeed6398..d69db7058 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -341,6 +341,7 @@ #define GEOM_TSHAPE 201 #define GEOM_DIVIDEDDISK 202 #define GEOM_DIVIDEDCYLINDER 203 +#define GEOM_EXPORTXAO 204 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ // Advanced functions sub-operations codes #define TSHAPE_BASIC 1 @@ -349,4 +350,5 @@ #define DIVIDEDDISK_R_RATIO 1 #define DIVIDEDDISK_R_VECTOR_PNT 2 #define DIVIDEDCYLINDER_R_H 1 +#define EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS 1 /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ diff --git a/src/GEOMImpl/GUID.txt b/src/GEOMImpl/GUID.txt index be669b2b6..ab0570273 100755 --- a/src/GEOMImpl/GUID.txt +++ b/src/GEOMImpl/GUID.txt @@ -72,3 +72,5 @@ FF1BBB69-5D14-4df2-980B-3A668264EA16 // Modify the Location FF1BBB70-5D14-4df2-980B-3A668264EA16 // Projection 1C3A0F3F-729D-4E83-8232-78E74FC5637C // Pipe T-Shape + +FF1BBB71-5D14-4df2-980B-3A668264EA16 // Export XAO diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am index 8ce12ca2e..8abb1c9be 100644 --- a/src/GEOMImpl/Makefile.am +++ b/src/GEOMImpl/Makefile.am @@ -43,6 +43,7 @@ salomeinclude_HEADERS = \ GEOMImpl_IMeasureOperations.hxx \ GEOMImpl_IGroupOperations.hxx \ GEOMImpl_IAdvancedOperations.hxx \ + GEOMImpl_IImportExportOperations.hxx \ GEOMImpl_IGlue.hxx \ GEOMImpl_PointDriver.hxx \ GEOMImpl_IPoint.hxx \ @@ -148,9 +149,12 @@ ADVANCED_INCLUDES = ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx ##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx +IMPORTEXPORT_INCLUDES = +IMPORTEXPORT_INCLUDES += GEOMImpl_IExportXAO.hxx GEOMImpl_ExportXAODriver.hxx ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## salomeinclude_HEADERS += $(ADVANCED_INCLUDES) +salomeinclude_HEADERS += $(IMPORTEXPORT_INCLUDES) dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_IBasicOperations.cxx \ @@ -166,6 +170,7 @@ dist_libGEOMimpl_la_SOURCES = \ GEOMImpl_IMeasureOperations.cxx \ GEOMImpl_IGroupOperations.cxx \ GEOMImpl_IAdvancedOperations.cxx \ + GEOMImpl_IImportExportOperations.cxx \ GEOMImpl_Gen.cxx \ GEOMImpl_PointDriver.cxx \ GEOMImpl_VectorDriver.cxx \ @@ -221,9 +226,12 @@ ADVANCED_SOURCES = ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx ##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx +IMPORTEXPORT_SOURCES = +IMPORTEXPORT_SOURCES += GEOMImpl_ExportXAODriver.cxx ##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@## dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES) +dist_libGEOMimpl_la_SOURCES += $(IMPORTEXPORT_SOURCES) # additional information to compile and link file diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 3dec74459..ccd876f74 100644 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -2303,6 +2303,26 @@ GEOM::GEOM_IAdvancedOperations_ptr GEOM_Gen_i::GetIAdvancedOperations(CORBA::Lon return operations._retn(); } +//============================================================================ +// function : GetIImportExportOperations +// purpose : +//============================================================================ +GEOM::GEOM_IImportExportOperations_ptr GEOM_Gen_i::GetIImportExportOperations(CORBA::Long theStudyID) + throw ( SALOME::SALOME_Exception ) +{ + Unexpect aCatch(SALOME_SalomeException); + MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" ); + + GEOM::GEOM_Gen_ptr engine = _this(); + + GEOM_IImportExportOperations_i* aServant = + new GEOM_IImportExportOperations_i(_poa, engine, _impl->GetIImportExportOperations(theStudyID)); + + // activate the CORBA servant + GEOM::GEOM_IImportExportOperations_var operations = aServant->_this(); + return operations._retn(); +} + //============================================================================= /*! * AddSubShape diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index 021ce1bcb..bb1cb6dc9 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -51,6 +51,7 @@ #include "GEOM_IMeasureOperations_i.hh" #include "GEOM_IGroupOperations_i.hh" #include "GEOM_IAdvancedOperations_i.hh" +#include "GEOM_IImportExportOperations_i.hh" #include @@ -241,6 +242,10 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi virtual GEOM::GEOM_IAdvancedOperations_ptr GetIAdvancedOperations (CORBA::Long theStudyID) throw (SALOME::SALOME_Exception); + //Returns a pointer to ImportExportOperations interface + virtual GEOM::GEOM_IImportExportOperations_ptr GetIImportExportOperations (CORBA::Long theStudyID) + throw (SALOME::SALOME_Exception); + //Adds a new sub-shape virtual GEOM::GEOM_Object_ptr AddSubShape (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfLong& theIndices); diff --git a/src/GEOM_I/GEOM_IImportExportOperations_i.cc b/src/GEOM_I/GEOM_IImportExportOperations_i.cc new file mode 100644 index 000000000..5621e006b --- /dev/null +++ b/src/GEOM_I/GEOM_IImportExportOperations_i.cc @@ -0,0 +1,103 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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. +// +// 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 +// + +// File : GEOM_IImportExportOperations.cc +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#include + +#include "GEOM_IImportExportOperations_i.hh" + +#include +#include +#include + +#include "GEOM_Engine.hxx" +#include "GEOM_Object.hxx" + +//============================================================================= +/*! + * constructor: + */ +//============================================================================= +GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IImportExportOperations* theImpl) +:GEOM_IOperations_i(thePOA, theEngine, theImpl) +{ + MESSAGE("GEOM_IImportExportOperations_i::GEOM_IImportExportOperations_i"); +} + +//============================================================================= +/*! + * destructor + */ +//============================================================================= +GEOM_IImportExportOperations_i::~GEOM_IImportExportOperations_i() +{ + MESSAGE("GEOM_IImportExportOperations_i::~GEOM_IImportExportOperations_i"); +} + +//============================================================================= +/*! + * Export a shape to XAO Format + * \param theExportingShape Shape to export + * \param theFileName The name of the exported file + * \param thelGroups List of groups to export + * \param thelFields List of fields to export + * \return New GEOM_Object, containing the created shape. + */ +//============================================================================= +CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, const GEOM::ListOfGO& thelGroups, const GEOM::ListOfGO& thelFields) +{ + bool isGood = false; + //Set a not done flag + GetOperations()->SetNotDone(); + + // Get the reference shape + Handle(GEOM_Object) aReference = GetObjectImpl(theExportingShape); + + //Get the reference groups + int ind = 0; + int aLenGroup = thelGroups.length(); + std::list aGroups; + for (; ind < aLenGroup; ind++) { + Handle(GEOM_Object) aGroup = GetObjectImpl(thelGroups[ind]); + if (aGroup.IsNull()) return false; + aGroups.push_back(aGroup); + } + + //Get the reference point + ind = 0; + int aLenField = thelFields.length(); + std::list aFields; + for (; ind < aLenField; ind++) { + Handle(GEOM_Object) aField = GetObjectImpl(thelFields[ind]); + if (aField.IsNull()) return false; + aFields.push_back(aField); + } + + if (!aReference.IsNull()) + { + // Export XAO + isGood = GetOperations()->ExportXAO(aReference, theFileName, aGroups, aFields); + } + + return isGood; +} + +/*@@ insert new functions before this line @@ do not remove this line @@*/ diff --git a/src/GEOM_I/GEOM_IImportExportOperations_i.hh b/src/GEOM_I/GEOM_IImportExportOperations_i.hh new file mode 100644 index 000000000..dbcc9f7a2 --- /dev/null +++ b/src/GEOM_I/GEOM_IImportExportOperations_i.hh @@ -0,0 +1,52 @@ +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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. +// +// 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 +// + +// File : GEOM_IImportExportOperations.hh +// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) +// +#ifndef _GEOM_IImportExportOperations_i_HeaderFile +#define _GEOM_IImportExportOperations_i_HeaderFile + +#include "GEOMImpl_Gen.hxx" + +#include + +#include CORBA_SERVER_HEADER(GEOM_Gen) +#include "GEOM_IOperations_i.hh" +#include "GEOM_Object_i.hh" + +#include "GEOMImpl_IImportExportOperations.hxx" + +class GEOM_I_EXPORT GEOM_IImportExportOperations_i : + public virtual POA_GEOM::GEOM_IImportExportOperations, + public virtual GEOM_IOperations_i +{ + public: + GEOM_IImportExportOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, + ::GEOMImpl_IImportExportOperations* theImpl); + ~GEOM_IImportExportOperations_i(); + + CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, const GEOM::ListOfGO& thelGroups, const GEOM::ListOfGO& thelFields); + /*@@ insert new functions before this line @@ do not remove this line @@*/ + + ::GEOMImpl_IImportExportOperations* GetOperations() + { return (::GEOMImpl_IImportExportOperations*)GetImpl(); } +}; + +#endif diff --git a/src/GEOM_I/Makefile.am b/src/GEOM_I/Makefile.am index b5cd51165..c7fe609d9 100644 --- a/src/GEOM_I/Makefile.am +++ b/src/GEOM_I/Makefile.am @@ -46,6 +46,7 @@ salomeinclude_HEADERS = \ GEOM_IMeasureOperations_i.hh \ GEOM_IGroupOperations_i.hh \ GEOM_IAdvancedOperations_i.hh \ + GEOM_IImportExportOperations_i.hh \ GEOM_Gen_i.hh \ GEOM_GEOM_I.hxx @@ -65,6 +66,7 @@ dist_libGEOMEngine_la_SOURCES = \ GEOM_IMeasureOperations_i.cc \ GEOM_IGroupOperations_i.cc \ GEOM_IAdvancedOperations_i.cc \ + GEOM_IImportExportOperations_i.cc \ GEOM_Gen_i.cc \ GEOM_DumpPython.cc diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index b3c2cf038..f6905d3b1 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -402,6 +402,22 @@ void GEOM_Superv_i::getAdvancedOp() } } +//============================================================================= +// getImportExportOp: +//============================================================================= +void GEOM_Superv_i::getImportExportOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM_IImportExportOperations interface + if (CORBA::is_nil(myImportExportOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + myImportExportOp = myGeomEngine->GetIImportExportOperations(myStudyID); + } +} + //============================================================================= // GetServant: //============================================================================= @@ -3432,6 +3448,28 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR, return anObj; } +//============================================================================= +// ExportXAO +//============================================================================= +CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, GEOM::GEOM_List_ptr thelGroups, GEOM::GEOM_List_ptr thelFields) +{ + beginService( " GEOM_Superv_i::ExportXAO" ); + MESSAGE("GEOM_Superv_i::ExportXAO"); + getImportExportOp(); + if (GEOM_List_i* aListImplG = + dynamic_cast*>(GetServant(thelGroups, myPOA).in())) + { + if (GEOM_List_i* aListImplF = + dynamic_cast*>(GetServant(thelFields, myPOA).in())) + { + CORBA::Boolean isGood = myImportExportOp->ExportXAO(theExportingShape, theFileName, aListImplG->GetList(), aListImplF->GetList()); + endService( " GEOM_Superv_i::ExportXAO" ); + return isGood; + } + } + endService( " GEOM_Superv_i::ExportXAO" ); + return false; +} /*@@ insert new functions before this line @@ do not remove this line @@*/ //===================================================================================== diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index 7a9014af8..4ded8898f 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -61,6 +61,7 @@ public: void getLocalOp(); void getGroupOp(); void getAdvancedOp(); + void getImportExportOp(); PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA); @@ -711,6 +712,10 @@ public: GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH, GEOM::pattern thePattern); + //-----------------------------------------------------------// + // ImportExport Operations // + //-----------------------------------------------------------// + CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr theExportingShape, const char* theFileName, GEOM::GEOM_List_ptr thelGroups, GEOM::GEOM_List_ptr thelFields); /*@@ insert new functions before this line @@ do not remove this line @@*/ private: diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index 40a7dd53a..f515c9e1b 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -393,6 +393,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): self.BlocksOp = None self.GroupOp = None self.AdvOp = None + self.ImpExpOp = None pass ## @addtogroup l1_geompy_auxiliary @@ -425,6 +426,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): self.BlocksOp = self.GetIBlocksOperations (self.myStudyId) self.GroupOp = self.GetIGroupOperations (self.myStudyId) self.AdvOp = self.GetIAdvancedOperations (self.myStudyId) + self.ImpExpOp = self.GetIImportExportOperations (self.myStudyId) pass ## Dump component to the Python script @@ -9071,6 +9073,21 @@ class geompyDC(GEOM._objref_GEOM_Gen): if Parameters: anObj.SetParameters(Parameters) return anObj + ## Export a shape to XAO Format + # @param theExportingShape Shape to export + # @param theFileName The name of the exported file + # @param thelGroups List of groups to export + # @param thelFields List of fields to export + # @return New GEOM_Object, containing the created shape. + # + # @ref tui_creation_exportxao "Example" + def ExportXAO(self, theExportingShape, theFileName, thelGroups, thelFields): + theExportingShape, theFileName, thelGroups, thelFields, Parameters = ParseParameters(theExportingShape, theFileName, thelGroups, thelFields) + isGood = self.ImpExpOp.ExportXAO(theExportingShape, theFileName, thelGroups, thelFields) + RaiseIfFailed("ExportXAO", self.ImpExpOp) + #if Parameters: anObj.SetParameters(Parameters) + return isGood + #@@ insert new functions before this line @@ do not remove this line @@# # end of l4_advanced -- 2.30.2