+++ /dev/null
-/*!
-
-\page create_exportxao_page ExportXAO
-
-To create a \b ExportXAO in the <b>Main Menu</b> select <b>New Entity - >
-ImportExport - > ExportXAO </b>
-
-Specify the parameters of the ExportXAO object creation in the opened dialog
-box and press "Apply" or "Apply & Close" button.
-Result of each operation will be a GEOM_Object.
-
-<b>TUI Command:</b> <em>geompy.MakeExportXAO(ExportingShape, FileName, lGroups, lFields)</em>
-
-<b>Arguments:</b>
-- \b ExportingShape - Shape to export
-- \b FileName - The name of the exported file
-- \b lGroups - List of groups to export
-- \b lFields - List of fields to export
-
-\image html exportxao_dlg.png
-
-Example:
-
-\image html exportxao.png
-
-Our <b>TUI Scripts</b> provide you with useful examples of creation of
-\ref tui_creation_exportxao "ImportExport objects".
-
-*/
--- /dev/null
+/*!
+
+\page export_xao_page Export XAO
+
+To export a shape in the \b XAO format, in the <b>Main Menu</b> select <b>New Entity ->
+Import / Export -> Export XAO </b>
+
+Specify the parameters of the Export XAO dialog box and press "Apply" or "Apply & Close" button.
+
+
+<b>TUI Command:</b> <em>geompy.MakeExportXAO(Shape, FileName, Groups, Fields)</em>
+
+<b>Arguments:</b>
+- \b Shape - The shape to export
+- \b FileName - The name of the file to create
+- \b Groups - The list of groups to export
+- \b Fields - The list of fields to export
+
+\image html exportxao_dlg.png
+
+*/
--- /dev/null
+/*!
+
+\page import_xao_page Import XAO
+
+To import a shape in the \b XAO format, in the <b>Main Menu</b> select <b>New Entity ->
+Import / Export -> Import XAO </b>
+
+*/
\image html geomscreen.png
-\b Geometry module of SALOME is destined for:
+\b Geometry module of SALOME is destined for:
- \subpage import_export_geom_obj_page "import and export of geometrical models"
in IGES, BREP and STEP formats;
- \subpage create_geom_obj_page "construction of geometrical objects"
- using a wide range of functions;
+ using a wide range of functions;
- \subpage view_geom_obj_page "viewing geometrical objects" in the OCC
- viewer;
+ viewer;
- \subpage transform_geom_obj_page "transformation of geometrical objects"
using various algorithms;
- \subpage repairing_operations_page "optimization of geometrical objects";
- viewing \subpage geometrical_obj_prop_page "geometrical object properties"
- and other information about geometrical objects using
+ and other information about geometrical objects using
\subpage using_measurement_tools_page "measurement tools";
+- \subpage xao_format_page "The XAO format"
- \subpage pictures_page "designing shapes from pictures";
- easily setting parameters via the variables predefined in
\subpage using_notebook_geom_page "SALOME notebook".
--- /dev/null
+/*!
+
+\page xao_format_page The XAO format
+
+XAO is a file format which describes a shape with its topology, groups and fields.
+
+- \subpage export_xao_page "Export"
+- \subpage import_xao_page "Import"
+
+*/
interface GEOM_IImportExportOperations : GEOM_IOperations
{
/*!
- * Export a shape to XAO Format
+ * Export a shape to XAO format
* \param shape The shape to export
* \param groups The list of groups to export
* \param fields The list of fields to export
- * \param xao The exported XAO
+ * \param author The author of the export
+ * \param fileName The name of the file to export
* \return boolean indicating if export was succeful.
*/
- boolean ExportXAO(in GEOM_Object shape, in ListOfGO groups, in ListOfGO fields, out string xao);
+ boolean ExportXAO(in GEOM_Object shape,
+ in ListOfGO groups, in ListOfGO fields,
+ in string author, in string fileName);
/*!
- * Import a shape from XAO Format
- * \param xao The XAO data to import
+ * Import a shape from XAO format
+ * \param xao The name of the file to import
* \param shape The imported shape
* \param groups The list of imported groups
* \param fields The list of imported fields
* \return boolean indicating if import was succeful.
*/
- //boolean ImportXAO(in string xao, out GEOM_Object shape, out ListOfGO groups, out ListOfGO fields);
+ boolean ImportXAO(in string fileName,
+ out GEOM_Object shape, out ListOfGO groups, out ListOfGO fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
//-----------------------------------------------------------//
// ImportExportOperations //
//-----------------------------------------------------------//
- boolean ExportXAO(in GEOM_Object exportingShape,
- in GEOM_List groups, in GEOM_List fields, out string xao);
-// boolean ImportXAO(in string fileName, out GEOM_Object exportingShape,
-// out GEOM_List groups, out GEOM_List fields);
+ boolean ExportXAO(in GEOM_Object shape,
+ in GEOM_List groups, in GEOM_List fields,
+ in string author, in string fileName);
+ boolean ImportXAO(in string fileName, out GEOM_Object shape,
+ out GEOM_List groups, out GEOM_List fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
<component-comment>Geometry component</component-comment>
<component-multistudy>1</component-multistudy>
<component-icone>ModuleGeom.png</component-icone>
- <component-impltype>1</component-impltype>
+ <component-impltype>1</component-impltype>
<!-- component interface list -->
<component-interface-list>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
- <component-service>
- <service-name>GetDumpName</service-name>
- <service-author></service-author>
- <service-version></service-version>
- <service-comment>unknown</service-comment>
- <service-by-default>0</service-by-default>
- <inParameter-list>
- <inParameter>
- <inParameter-name>theStudyEntry</inParameter-name>
- <inParameter-type>string</inParameter-type>
- <inParameter-comment>unknown</inParameter-comment>
- </inParameter>
- </inParameter-list>
- <outParameter-list>
- <outParameter>
- <outParameter-name>return</outParameter-name>
- <outParameter-type>string</outParameter-type>
- <outParameter-comment>unknown</outParameter-comment>
- </outParameter>
- </outParameter-list>
- <DataStream-list></DataStream-list>
- </component-service>
- <component-service>
- <service-name>GetAllDumpNames</service-name>
- <service-author></service-author>
- <service-version></service-version>
- <service-comment>unknown</service-comment>
- <service-by-default>0</service-by-default>
- <inParameter-list></inParameter-list>
- <outParameter-list>
- <outParameter>
- <outParameter-name>return</outParameter-name>
- <outParameter-type>string_array</outParameter-type>
- <outParameter-comment>unknown</outParameter-comment>
- </outParameter>
- </outParameter-list>
- <DataStream-list></DataStream-list>
- </component-service>
+ <component-service>
+ <service-name>GetDumpName</service-name>
+ <service-author></service-author>
+ <service-version></service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list>
+ <inParameter>
+ <inParameter-name>theStudyEntry</inParameter-name>
+ <inParameter-type>string</inParameter-type>
+ <inParameter-comment>unknown</inParameter-comment>
+ </inParameter>
+ </inParameter-list>
+ <outParameter-list>
+ <outParameter>
+ <outParameter-name>return</outParameter-name>
+ <outParameter-type>string</outParameter-type>
+ <outParameter-comment>unknown</outParameter-comment>
+ </outParameter>
+ </outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
+ <component-service>
+ <service-name>GetAllDumpNames</service-name>
+ <service-author></service-author>
+ <service-version></service-version>
+ <service-comment>unknown</service-comment>
+ <service-by-default>0</service-by-default>
+ <inParameter-list></inParameter-list>
+ <outParameter-list>
+ <outParameter>
+ <outParameter-name>return</outParameter-name>
+ <outParameter-type>string_array</outParameter-type>
+ <outParameter-comment>unknown</outParameter-comment>
+ </outParameter>
+ </outParameter-list>
+ <DataStream-list></DataStream-list>
+ </component-service>
</component-service-list>
</component-interface-list>
<constraint>hostname = localhost</constraint>
</message>
<message>
<source>GEOM_EXPORTXAO</source>
- <translation>ExportXAO</translation>
+ <translation>Export XAO</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source>
<source>GEOM_EXPORTXAO_FILENAME</source>
<translation>File Name</translation>
</message>
+ <message>
+ <source>GEOM_EXPORTXAO_AUTHOR</source>
+ <translation>Author</translation>
+ </message>
<message>
<source>GEOM_EXPORTXAO_LGROUPS</source>
- <translation>List of groups</translation>
+ <translation>Groups</translation>
</message>
<message>
<source>GEOM_EXPORTXAO_LFIELDS</source>
- <translation>List of fields</translation>
+ <translation>Fields</translation>
+ </message>
+</context>
+<context>
+ <name>ImportExportGUI_ImportXAODlg</name>
+ <message>
+ <source>GEOM_IMPORTXAO_TITLE</source>
+ <translation>Import XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO</source>
+ <translation>Import XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_IMPORTINGSHAPE</source>
+ <translation>Shape</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_FILENAME</source>
+ <translation>File Name</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_LGROUPS</source>
+ <translation>Groups</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_LFIELDS</source>
+ <translation>Fields</translation>
</message>
</context>
</TS>
<translation>P&ublier et fermer</translation>
</message>
</context>
+<context>
+ <name>ImportExportGUI_ExportXAODlg</name>
+ <message>
+ <source>GEOM_EXPORTXAO_TITLE</source>
+ <translation>Export XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO</source>
+ <translation>Export XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_EXPORTINGSHAPE</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_FILENAME</source>
+ <translation>Fichier</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_AUTHOR</source>
+ <translation>Auteur</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_LGROUPS</source>
+ <translation>Groupes</translation>
+ </message>
+ <message>
+ <source>GEOM_EXPORTXAO_LFIELDS</source>
+ <translation>Champs</translation>
+ </message>
+</context>
+<context>
+ <name>ImportExportGUI_ImportXAODlg</name>
+ <message>
+ <source>GEOM_IMPORTXAO_TITLE</source>
+ <translation>Import XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO</source>
+ <translation>Import XAO</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_IMPORTINGSHAPE</source>
+ <translation>Objet</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_FILENAME</source>
+ <translation>Fichier</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_LGROUPS</source>
+ <translation>Groupes</translation>
+ </message>
+ <message>
+ <source>GEOM_IMPORTXAO_LFIELDS</source>
+ <translation>Champs</translation>
+ </message>
+</context>
</TS>
+++ /dev/null
-// 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 <Standard_Stream.hxx>
-
-#include <GEOMImpl_ExportXAODriver.hxx>
-#include <GEOMImpl_IExportXAO.hxx>
-#include <GEOMImpl_Types.hxx>
-#include <GEOM_Function.hxx>
-
-#include <TFunction_Logbook.hxx>
-#include <StdFail_NotDone.hxx>
-
-//@@ include required header files here @@//
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-const Standard_GUID& GEOMImpl_ExportXAODriver::GetID()
-{
- static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
- 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;
-}
+++ /dev/null
-// 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 <TFunction_Driver.hxx>
-
-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
#include <GEOMImpl_PipeTShapeDriver.hxx>
#include <GEOMImpl_DividedDiskDriver.hxx>
// #include <GEOMImpl_DividedCylinderDriver.hxx>
-#include <GEOMImpl_ExportXAODriver.hxx>
+#include <GEOMImpl_XAODriver.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
//=============================================================================
// 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());
+ // XAO operations
+ TFunction_DriverTable::Get()->AddDriver(GEOMImpl_XAODriver::GetID(), new GEOMImpl_XAODriver());
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
SetEngine(this);
+++ /dev/null
-// 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_
-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013 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
// 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 <cmath>
#include <iostream>
#include "Group.hxx"
#include "XaoUtils.hxx"
-#include <GEOMImpl_ExportXAODriver.hxx>
-#include <GEOMImpl_IExportXAO.hxx>
+#include <GEOMImpl_XAODriver.hxx>
+#include <GEOMImpl_IImportExportXAO.hxx>
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopAbs.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
+#include <TDataStd_Integer.hxx>
#include <TDF_Tool.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
delete m_groupOperations;
}
+TopAbs_ShapeEnum getGroupDimension(XAO::Group* group)
+{
+ XAO::Dimension dim = group->getDimension();
+ if (dim == XAO::VERTEX)
+ return TopAbs_VERTEX;
+ if (dim == XAO::EDGE)
+ return TopAbs_EDGE;
+ if (dim == XAO::FACE)
+ return TopAbs_FACE;
+ if (dim == XAO::SOLID)
+ return TopAbs_SOLID;
+ return TopAbs_COMPOUND;
+}
+
//=============================================================================
/*!
- * Export a shape to XAO Format
+ * Export a shape to XAO format
* \param shape The shape to export
* \param groups The list of groups to export
* \param fields The list of fields to export
- * \param xao The exported XAO.
+ * \param fileName The name of the file to exported
* \return boolean indicating if export was succeful.
*/
//=============================================================================
bool GEOMImpl_IImportExportOperations::ExportXAO(Handle(GEOM_Object) shape,
std::list<Handle(GEOM_Object)> groupList,
std::list<Handle(GEOM_Object)> fieldList,
- char*& xao)
+ const char* author,
+ const char* fileName)
{
SetErrorCode(KO);
+ if (shape.IsNull()) return false;
+
// add a new shape function with parameters
Handle(GEOM_Function) lastFunction = shape->GetLastFunction();
- if (lastFunction.IsNull())
- return false;
+ if (lastFunction.IsNull()) return false;
// add a new result object
Handle(GEOM_Object) result = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
// add an Export function
- Handle(GEOM_Function) exportFunction = result->AddFunction(GEOMImpl_ExportXAODriver::GetID(),
- EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS);
- if (exportFunction.IsNull())
- return false;
-
- // check if the function is set correctly
- if (exportFunction->GetDriverGUID() != GEOMImpl_ExportXAODriver::GetID())
- return false;
+ Handle(GEOM_Function) exportFunction = result->AddFunction(GEOMImpl_XAODriver::GetID(), IMPORTEXPORT_EXPORTXAO);
+ if (exportFunction.IsNull()) return false;
+ if (exportFunction->GetDriverGUID() != GEOMImpl_XAODriver::GetID()) return false;
+ // Build the XAO
XAO::Xao* xaoObject = new XAO::Xao();
+ xaoObject->setAuthor(author);
XAO::Geometry* geometry = new XAO::Geometry();
TopoDS_Shape topoShape = shape->GetValue();
+ exportFunction->SetValue(topoShape);
geometry->setShape(topoShape);
geometry->setName(shape->GetName());
Handle(TColStd_HSequenceOfTransient) subObjects = m_shapesOperations->GetExistingSubObjects(shape, false);
int nbSubObjects = subObjects->Length();
+ // set the names of the sub shapes
int tmpIndex;
for (int i = 1; i <= nbSubObjects; i++)
{
}
xaoObject->setGeometry(geometry);
- // adding groups
- std::list<Handle(GEOM_Object)>::iterator itG1 = groupList.begin();
- while (itG1 != groupList.end())
+ // add the groups
+ std::list<Handle(GEOM_Object)>::iterator groupIterator = groupList.begin();
+ while (groupIterator != groupList.end())
{
- Handle(GEOM_Object) itGroup = (*itG1++);
- Handle(TColStd_HArray1OfInteger) groupIds = m_groupOperations->GetObjects(itGroup);
- TopAbs_ShapeEnum shapeGroup = m_groupOperations->GetType(itGroup);
-
+ Handle(GEOM_Object) currGroup = (*groupIterator++);
+ Handle(TColStd_HArray1OfInteger) groupIds = m_groupOperations->GetObjects(currGroup);
XAO::Group* group = new XAO::Group();
- group->setName(itGroup->GetName());
+ group->setName(currGroup->GetName());
+
+ TopAbs_ShapeEnum shapeGroup = m_groupOperations->GetType(currGroup);
switch (shapeGroup)
{
case TopAbs_VERTEX:
- group->setDimension(0);
+ group->setDimension(XAO::VERTEX);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
}
break;
case TopAbs_EDGE:
- group->setDimension(1);
+ group->setDimension(XAO::EDGE);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
}
break;
case TopAbs_FACE:
- group->setDimension(2);
+ group->setDimension(XAO::FACE);
for (int i = 1; i <= groupIds->Length(); i++)
{
- const char* ref = XAO::XaoUtils::intToString((int)(groupIds->Value(i)));
+ const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
const int index = geometry->getFaceIndexByReference(ref);
group->addElement(index);
}
break;
case TopAbs_SOLID:
- group->setDimension(3);
+ group->setDimension(XAO::SOLID);
for (int i = 1; i <= groupIds->Length(); i++)
{
const char* ref = XAO::XaoUtils::intToString(groupIds->Value(i));
xaoObject->addGroup(group);
}
- const char* data = xaoObject->getXML();
- xao = new char[strlen(data)];
- strcpy(xao, data);
- delete data;
+ // TODO: add the fields
+
+ // export the XAO to the file
+ xaoObject->exportXAO(fileName);
+ delete xaoObject;
// make a Python command
GEOM::TPythonDump pd(exportFunction);
pd << "exported = geompy.ExportXAO(";
- pd << shape << "shpae, [], [], xao";
- pd << ")";
-
-// std::list<Handle(GEOM_Object)>::iterator itG = groupList.begin();
-// pd << (*itG++);
-// while (itG != groupList.end())
-// {
-// pd << ", " << (*itG++);
-// }
-// pd << "], [";
-// std::list<Handle(GEOM_Object)>::iterator itF = fieldList.begin();
-// pd << (*itF++);
-// while (itF != fieldList.end())
-// {
-// pd << ", " << (*itF++);
-// }
-// pd << "])";
+ pd << shape;
+ pd << ", [";
+
+ if (groupList.size() > 0)
+ {
+ std::list<Handle(GEOM_Object)>::iterator itG = groupList.begin();
+ pd << (*itG++);
+ while (itG != groupList.end())
+ {
+ pd << ", " << (*itG++);
+ }
+ }
+ pd << "], [";
+ if (fieldList.size() > 0)
+ {
+ std::list<Handle(GEOM_Object)>::iterator itF = fieldList.begin();
+ pd << (*itF++);
+ while (itF != fieldList.end())
+ {
+ pd << ", " << (*itF++);
+ }
+ }
+ pd << "], ";
+ pd << author << ", \"" << fileName << "\")";
SetErrorCode(OK);
//=============================================================================
/*!
- * Import a shape from XAO Format
- * \param fileName The name of the imported file
+ * Import a shape from XAO format
+ * \param fileName The name of the file to import
* \param shape The imported shape
* \param groups The list of imported groups
* \param fields The list of imported fields
* \return boolean indicating if import was succeful.
*/
//=============================================================================
-//bool GEOMImpl_IImportExportOperations::ImportXAO(const std::string fileName,
-// Handle(GEOM_Object) shape,
-// std::list<Handle(GEOM_Object)> groupList,
-// std::list<Handle(GEOM_Object)> fieldList)
-//{
-// SetErrorCode(KO);
-// return true;
-//}
+bool GEOMImpl_IImportExportOperations::ImportXAO(const char* fileName,
+ Handle(GEOM_Object)& shape,
+ Handle(TColStd_HSequenceOfTransient)& groupList,
+ Handle(TColStd_HSequenceOfTransient)& fieldList)
+{
+ SetErrorCode(KO);
+
+ if (fileName == NULL || groupList.IsNull() || fieldList.IsNull())
+ return false;
+
+ // Read the XAO
+ XAO::Xao* xaoObject = new XAO::Xao();
+ xaoObject->importXAO(fileName);
+
+ XAO::Geometry* xaoGeometry = xaoObject->getGeometry();
+ if (xaoGeometry == NULL)
+ return false;
+
+ // create the shape
+ shape = GetEngine()->AddObject(GetDocID(), GEOM_IMPORT);
+ Handle(GEOM_Function) function = shape->AddFunction(GEOMImpl_XAODriver::GetID(), IMPORTEXPORT_EXPORTXAO);
+ if (function.IsNull()) return false;
+ if (function->GetDriverGUID() != GEOMImpl_XAODriver::GetID()) return false;
+
+ // set the geometry
+ TopoDS_Shape geomShape = xaoGeometry->getShape();
+ function->SetValue(geomShape);
+ shape->SetName(xaoGeometry->getName());
+
+ // TODO: create sub shapes with names
+
+ // create groups
+ int nbGroups = xaoObject->countGroups();
+ for (int i = 0; i < nbGroups; ++i)
+ {
+ XAO::Group* xaoGroup = xaoObject->getGroup(i);
+
+ // build an array with the indexes of the sub shapes
+ int nbElt = xaoGroup->getCount();
+ Handle(TColStd_HArray1OfInteger) array = new TColStd_HArray1OfInteger(1, nbElt);
+ for (int j = 0; j < nbElt; j++)
+ {
+ int index = xaoGroup->getElement(j);
+ const char* ref = xaoGeometry->getElementReference(xaoGroup->getDimension(), index);
+ array->SetValue(j + 1, atoi(ref));
+ }
+
+ // create the group with the array of sub shapes indexes
+ Handle(GEOM_Object) group = GetEngine()->AddSubShape(shape, array);
+ group->SetType(GEOM_GROUP);
+ group->SetName(xaoGroup->getName());
+
+ // Set a sub-shape type
+ TDF_Label freeLabel = group->GetFreeLabel();
+ TDataStd_Integer::Set(freeLabel, (Standard_Integer) getGroupDimension(xaoGroup));
+ groupList->Append(group);
+
+ function = group->GetLastFunction();
+ }
+
+ // TODO: create the fields
+
+ // make a Python command
+ GEOM::TPythonDump pd(function);
+ pd << "(imported, " << shape << ", ";
+
+ pd << "[";
+ if (nbGroups > 0)
+ {
+ for (int i = 1; i <= nbGroups; i++)
+ {
+ Handle(GEOM_Object) obj = Handle(GEOM_Object)::DownCast(groupList->Value(i));
+ pd << obj << ((i < nbGroups) ? ", " : "");
+ }
+ }
+ pd << "], []";
+
+ pd << ") = geompy.ImportXAO(\"" << fileName << "\")";
+
+ delete xaoObject;
+ SetErrorCode(OK);
+
+ return true;
+}
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013 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
// 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_
Standard_EXPORT bool ExportXAO(Handle(GEOM_Object) shape,
std::list<Handle(GEOM_Object)> groupList,
std::list<Handle(GEOM_Object)> fieldList,
- char*& xao);
-// Standard_EXPORT bool ImportXAO (const std::string fileName,
-// Handle(GEOM_Object) shape,
-// std::list<Handle(GEOM_Object)> groupList,
-// std::list<Handle(GEOM_Object)> fieldList);
+ const char* author,
+ const char* fileName);
+ Standard_EXPORT bool ImportXAO(const char* fileName,
+ Handle(GEOM_Object)& shape,
+ Handle(TColStd_HSequenceOfTransient)& groupList,
+ Handle(TColStd_HSequenceOfTransient)& fieldList);
/*@@ insert new functions before this line @@ do not remove this line @@*/
};
#endif
--- /dev/null
+// Copyright (C) 2013 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_IImportExportXAO_HXX_
+#define _GEOMImpl_IImportExportXAO_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define IMPORTEXPORTXAO_ARG_DATA 1
+
+class GEOMImpl_IImportExportXAO
+{
+public:
+ GEOMImpl_IImportExportXAO(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetData(const TCollection_AsciiString& data) { _func->SetString(IMPORTEXPORTXAO_ARG_DATA, data); }
+ const TCollection_AsciiString GetData() { return _func->GetString(IMPORTEXPORTXAO_ARG_DATA); }
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _GEOMImpl_IExportXAO_HXX_
#define DIVIDEDDISK_R_RATIO 1
#define DIVIDEDDISK_R_VECTOR_PNT 2
#define DIVIDEDCYLINDER_R_H 1
-#define EXPORTXAO_EXPORTINGSHAPE_FILENAME_LGROUPS_LFIELDS 1
+
+#define IMPORTEXPORT_EXPORTXAO 1
+#define IMPORTEXPORT_IMPORTXAO 2
/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
--- /dev/null
+// Copyright (C) 2013 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
+
+#include <Standard_Stream.hxx>
+
+#include <GEOMImpl_XAODriver.hxx>
+#include <GEOMImpl_IImportExportXAO.hxx>
+#include <GEOMImpl_Types.hxx>
+#include <GEOM_Function.hxx>
+
+#include <TFunction_Logbook.hxx>
+#include <StdFail_NotDone.hxx>
+
+#include "Xao.hxx"
+#include "Geometry.hxx"
+#include "Group.hxx"
+#include "XaoUtils.hxx"
+//@@ include required header files here @@//
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& GEOMImpl_XAODriver::GetID()
+{
+ static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
+ return aGUID;
+}
+
+//=======================================================================
+//function : GEOMImpl_XAODriver
+//purpose :
+//=======================================================================
+GEOMImpl_XAODriver::GEOMImpl_XAODriver()
+{
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer GEOMImpl_XAODriver::Execute(TFunction_Logbook& log) const
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IImportExportXAO iexao(function);
+ TCollection_AsciiString xao = iexao.GetData();
+
+ TopoDS_Shape shape;
+
+ Standard_Integer functionType = function->GetType();
+ if (functionType == IMPORTEXPORT_EXPORTXAO)
+ {
+ }
+ else if (functionType == IMPORTEXPORT_IMPORTXAO)
+ {
+ }
+ else
+ {
+ // other construction modes here
+ }
+
+ if (shape.IsNull()) return 0;
+
+ function->SetValue(shape);
+
+ log.SetTouched(Label());
+
+ return 1;
+}
+
+//=======================================================================
+//function : GEOMImpl_XAODriver_Type_
+//purpose :
+//=======================================================================
+Standard_EXPORT Handle_Standard_Type& GEOMImpl_XAODriver_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_XAODriver",
+ sizeof(GEOMImpl_XAODriver),
+ 1,
+ (Standard_Address) _Ancestors,
+ (Standard_Address) NULL);
+ return _aType;
+}
+
+//=======================================================================
+//function : DownCast
+//purpose :
+//=======================================================================
+const Handle(GEOMImpl_XAODriver) Handle(GEOMImpl_XAODriver)::DownCast(
+ const Handle(Standard_Transient)& AnObject)
+{
+ Handle(GEOMImpl_XAODriver) _anOtherObject;
+
+ if (!AnObject.IsNull())
+ {
+ if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_XAODriver)))
+ {
+ _anOtherObject = Handle(GEOMImpl_XAODriver)((Handle(GEOMImpl_XAODriver)&) AnObject);
+ }
+ }
+
+ return _anOtherObject;
+}
--- /dev/null
+// Copyright (C) 2013 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_XAODriver_HXX
+#define _GEOMImpl_XAODriver_HXX
+
+#include <TFunction_Driver.hxx>
+
+class Handle_Standard_Type;
+class GEOMImpl_XAODriver;
+
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_XAODriver);
+
+class Handle(GEOMImpl_XAODriver): 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_XAODriver) () :
+ Handle(TFunction_Driver)()
+ {
+ }
+ Handle(GEOMImpl_XAODriver) (const Handle(GEOMImpl_XAODriver)& aHandle) :
+ Handle(TFunction_Driver)(aHandle)
+ {
+ }
+
+ Handle(GEOMImpl_XAODriver) (const GEOMImpl_XAODriver* anItem) :
+ Handle(TFunction_Driver)((TFunction_Driver *) anItem)
+ {
+ }
+
+ Handle(GEOMImpl_XAODriver)& operator=(const Handle(GEOMImpl_XAODriver)& aHandle)
+ {
+ Assign(aHandle.Access());
+ return *this;
+ }
+
+ Handle(GEOMImpl_XAODriver)& operator=(const GEOMImpl_XAODriver* anItem)
+ {
+ Assign((Standard_Transient *) anItem);
+ return *this;
+ }
+
+ GEOMImpl_XAODriver* operator->()
+ {
+ return (GEOMImpl_XAODriver *) ControlAccess();
+ }
+
+ GEOMImpl_XAODriver* operator->() const
+ {
+ return (GEOMImpl_XAODriver *) ControlAccess();
+ }
+
+ Standard_EXPORT
+ ~Handle(GEOMImpl_XAODriver)()
+ {
+ }
+
+ Standard_EXPORT
+ static const Handle(GEOMImpl_XAODriver) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+
+class GEOMImpl_XAODriver: 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_XAODriver();
+ 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_XAODriver()
+ {
+ }
+
+ // Type management
+ //
+ Standard_EXPORT
+ friend Handle_Standard_Type& GEOMImpl_ExportXAODriver_Type_();
+ Standard_EXPORT
+ const Handle(Standard_Type)& DynamicType() const
+ {
+ return STANDARD_TYPE(GEOMImpl_XAODriver);
+ }
+ Standard_EXPORT
+ Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
+ {
+ return (STANDARD_TYPE(GEOMImpl_XAODriver) == AType || TFunction_Driver::IsKind(AType));
+ }
+};
+
+#endif // _GEOMImpl_XAODriver_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
+IMPORTEXPORT_INCLUDES += GEOMImpl_IImportExportXAO.hxx GEOMImpl_XAODriver.hxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx
IMPORTEXPORT_SOURCES =
-IMPORTEXPORT_SOURCES += GEOMImpl_ExportXAODriver.cxx
+IMPORTEXPORT_SOURCES += GEOMImpl_XAODriver.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)
throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" );
+ MESSAGE( "GEOM_Gen_i::GetIImportExportOperations" );
GEOM::GEOM_Gen_ptr engine = _this();
-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013 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
// 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 <Standard_Stream.hxx>
#include "GEOM_IImportExportOperations_i.hh"
//=============================================================================
/*!
- * Export a shape to XAO Format
- * \param fileName The name of the exported file
+ * Export a shape to XAO format
* \param shape The shape to export
* \param groups The list of groups to export
* \param fields The list of fields to export
+ * \param author The author of the export
+ * \param fileName The name of the exported file
* \return boolean indicating if export was succeful.
*/
//=============================================================================
CORBA::Boolean GEOM_IImportExportOperations_i::ExportXAO(GEOM::GEOM_Object_ptr shape,
- const GEOM::ListOfGO& groups, const GEOM::ListOfGO& fields, CORBA::String_out xao)
+ const GEOM::ListOfGO& groups, const GEOM::ListOfGO& fields,
+ const char* author, const char* fileName)
{
bool isGood = false;
// Set a not done flag
if (!reference.IsNull())
{
// Export XAO
- char* data;
- isGood = GetOperations()->ExportXAO(reference, groupsObj, fieldsObj, data);
- xao = CORBA::string_dup(data);
- delete data;
+ isGood = GetOperations()->ExportXAO(reference, groupsObj, fieldsObj, author, fileName);
}
return isGood;
//=============================================================================
/*!
- * Import a shape from XAO Format
- * \param xao The XAO data to import
+ * Import a shape from XAO format
+ * \param fileName The name of the file to import
* \param shape The imported shape
* \param groups The list of imported groups
* \param fields The list of imported fields
* \return boolean indicating if import was succeful.
*/
//=============================================================================
-//bool GEOMImpl_IImportExportOperations::ImportXAO(const std::xao fileName,
-// Handle(GEOM_Object),
-// std::list<Handle_GEOM_Object, std::allocator<Handle_GEOM_Object> > groups,
-// std::list<Handle_GEOM_Object, std::allocator<Handle_GEOM_Object> > fields)
-//{
-// return true;
-//}
+CORBA::Boolean GEOM_IImportExportOperations_i::ImportXAO(const char* fileName,
+ GEOM::GEOM_Object_out shape,
+ GEOM::ListOfGO_out groups,
+ GEOM::ListOfGO_out fields)
+{
+ GEOM::GEOM_Object_var vshape;
+ shape = vshape._retn();
+
+ groups = new GEOM::ListOfGO;
+ fields = new GEOM::ListOfGO;
+
+ // Set a not done flag
+ GetOperations()->SetNotDone();
+
+ Handle(TColStd_HSequenceOfTransient) importedGroups = new TColStd_HSequenceOfTransient();
+ Handle(TColStd_HSequenceOfTransient) importedFields = new TColStd_HSequenceOfTransient();
+ Handle(GEOM_Object) hshape;
+ bool res = GetOperations()->ImportXAO(fileName, hshape, importedGroups, importedFields);
+
+ if (!GetOperations()->IsDone() || !res)
+ return false;
+
+ // parse groups
+ int n = importedGroups->Length();
+ groups->length(n);
+ for (int i = 1; i <= n; i++)
+ {
+ (*groups)[i - 1] = GetObject(Handle(GEOM_Object)::DownCast(importedGroups->Value(i)));
+ }
+
+ // parse fields
+ n = importedFields->Length();
+ fields->length(n);
+ for (int i = 1; i <= n; i++)
+ {
+ (*fields)[i - 1] = GetObject(Handle(GEOM_Object)::DownCast(importedFields->Value(i)));
+ }
+
+ shape = GetObject(hshape);
+
+ return res;
+}
/*@@ insert new functions before this line @@ do not remove this line @@*/
-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013 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
// 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
CORBA::Boolean ExportXAO (GEOM::GEOM_Object_ptr shape,
const GEOM::ListOfGO& groups,
const GEOM::ListOfGO& fields,
- CORBA::String_out xao);
- CORBA::Boolean ImportXAO (const char* xao, GEOM::GEOM_Object_out shape,
+ const char* author,
+ const char* fileName);
+ CORBA::Boolean ImportXAO (const char* fileName,
+ GEOM::GEOM_Object_out shape,
GEOM::ListOfGO_out groups,
GEOM::ListOfGO_out fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
// ExportXAO
//=============================================================================
CORBA::Boolean GEOM_Superv_i::ExportXAO (GEOM::GEOM_Object_ptr shape,
- GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields, CORBA::String_out xao)
+ GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields,
+ const char* author, const char* fileName)
{
beginService( " GEOM_Superv_i::ExportXAO" );
MESSAGE("GEOM_Superv_i::ExportXAO");
if (GEOM_List_i<GEOM::ListOfGO>* fieldList =
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(fields, myPOA).in()))
{
- CORBA::Boolean isGood = myImportExportOp->ExportXAO(shape, groupList->GetList(), fieldList->GetList(), xao);
+ CORBA::Boolean isGood = myImportExportOp->ExportXAO(shape,
+ groupList->GetList(), fieldList->GetList(), author, fileName);
endService( " GEOM_Superv_i::ExportXAO" );
return isGood;
}
//=============================================================================
// ImportXAO
//=============================================================================
-//CORBA::Boolean GEOM_Superv_i::ImportXAO (const char* fileName, GEOM::GEOM_Object_out shape,
-// GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields)
-//{
-// return false;
-//}
+CORBA::Boolean GEOM_Superv_i::ImportXAO (const char* fileName, GEOM::GEOM_Object_out shape,
+ GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields)
+{
+ return false;
+}
/*@@ insert new functions before this line @@ do not remove this line @@*/
//=====================================================================================
// ImportExport Operations //
//-----------------------------------------------------------//
CORBA::Boolean ExportXAO(GEOM::GEOM_Object_ptr shape,
- GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields, CORBA::String_out xao);
-// CORBA::Boolean ImportXAO(const char* fileName, GEOM::GEOM_Object_out shape,
-// GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields);
+ GEOM::GEOM_List_ptr groups, GEOM::GEOM_List_ptr fields,
+ const char* author, const char* fileName);
+ CORBA::Boolean ImportXAO(const char* fileName, GEOM::GEOM_Object_out shape,
+ GEOM::GEOM_List_out groups, GEOM::GEOM_List_out fields);
/*@@ insert new functions before this line @@ do not remove this line @@*/
private:
Returns:
data packed to the byte stream
-
+
Example of usage:
val = PackData("10001110") # val = 0xAE
val = PackData("1") # val = 0x80
texture bitmap itself.
This function can be used to read the texture to the byte stream in order to pass it to
the AddTexture() function of geompy class.
-
+
Parameters:
fname texture file name
Returns:
sequence of tree values: texture's width, height in pixels and its byte stream
-
+
Example of usage:
import geompy
geompy.init_geom(salome.myStudy)
theAddPrefix add prefix "from_" to names of restored sub-shapes,
and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
- Returns:
+ Returns:
list of published sub-shapes
"""
# Example: see GEOM_TestAll.py
theX The X coordinate of the point.
theY The Y coordinate of the point.
theZ The Z coordinate of the point.
-
- Returns:
+
+ Returns:
New GEOM.GEOM_Object, containing the created point.
"""
# Example: see GEOM_TestAll.py
def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
"""
Create a point by projection give coordinates on the given curve
-
+
Parameters:
theRefCurve The referenced curve.
theX X-coordinate in 3D space
theParameterU horisontal value of the center point (0.0 - 1.0).
theTrimSize the size of plane.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created tangent.
Example of usage:
theDY Y component of the vector.
theDZ Z component of the vector.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created vector.
"""
# Example: see GEOM_TestAll.py
thePnt1 Start point for the vector.
thePnt2 End point for the vector.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created vector.
"""
# Example: see GEOM_TestAll.py
theVec Vector, defining the plane normal direction.
theTrimSize Half size of a side of quadrangle face, representing the plane.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created plane.
"""
# Example: see GEOM_TestAll.py
theVec2 Vector, defining the plane normal direction.
theTrimSize Half size of a side of quadrangle face, representing the plane.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created plane.
"""
# Example: see GEOM_TestAll.py
"""
Create a plane, based on a Local coordinate system.
- Parameters:
+ Parameters:
theLCS coordinate system, defining plane.
theTrimSize Half size of a side of quadrangle face, representing the plane.
theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created plane.
"""
# Example: see GEOM_TestAll.py
"""
Create a local coordinate system.
- Parameters:
+ Parameters:
OX,OY,OZ Three coordinates of coordinate system origin.
XDX,XDY,XDZ Three components of OX direction
YDX,YDY,YDZ Three components of OY direction
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created coordinate system.
"""
# Example: see GEOM_TestAll.py
Parameters:
theShape The initial shape to detect the coordinate system.
-
- Returns:
+
+ Returns:
New GEOM.GEOM_Object, containing the created coordinate system.
"""
anObj = self.BasicOp.MakeMarkerFromShape(theShape)
theXVec Vector of X direction
theYVec Vector of Y direction
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created coordinate system.
"""
thePnt2 Middle point of the arc.
thePnt3 End point of the arc.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created arc.
"""
# Example: see GEOM_TestAll.py
theRMinor Minor ellipse radius.
theVecMaj Vector, direction of the ellipse's main axis.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created ellipse.
"""
# Example: see GEOM_TestAll.py
theDoReordering If True, the algo does not follow the order of
thePoints but searches for the closest vertex.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created B-Spline curve.
"""
# Example: see GEOM_TestAll.py
if theNewMethod:
anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
else:
- anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
+ anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
anObj.SetParameters(Parameters)
return anObj
-
+
# end of l4_curves
- CMD is one of
- "R angle" : Set the direction by angle
- "D dx dy" : Set the direction by DX & DY
-
+
- "TT x y" : Create segment by point at X & Y
- "T dx dy" : Create segment by point with DX & DY
- "L length" : Create segment by direction & Length
- "WW" : Close Wire (to finish)
- "WF" : Close Wire and build face (to finish)
-
+
- Flag1 (= reverse) is 0 or 2 ...
- if 0 the drawn arc is the one of lower angle (< Pi)
- if 2 the drawn arc ius the one of greater angle (> Pi)
-
+
- Flag2 (= control tolerance) is 0 or 1 ...
- if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
- if 1 the wire is built only if the end point is on the arc
def MakeBox (self, x1,y1,z1, x2,y2,z2):
"""
Create a box by coordinates of two opposite vertices.
-
+
Parameters:
x1,y1,z1 double values, defining first point.
x2,y2,z2 double values, defining second point.
-
+
Returns:
New GEOM.GEOM_Object, containing the created box.
"""
theDY Length of Box edges, parallel to OY axis.
theDZ Length of Box edges, parallel to OZ axis.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created box.
"""
# Example: see GEOM_TestAll.py
theVec Vector, normal to the plane of the disk.
theR Disk radius.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created disk.
"""
# Example: see GEOM_TestAll.py
Parameters:
thePnt1,thePnt2,thePnt3 Points, defining the disk.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created disk.
"""
# Example: see GEOM_TestAll.py
theR Radius of Face.
theOrientation set the orientation belong axis OXY or OYZ or OZX
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created disk.
Example of usage:
theR Cylinder radius.
theH Cylinder height.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created cylinder.
"""
# Example: see GEOM_TestAll.py
theR Cylinder radius.
theH Cylinder height.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created cylinder.
"""
# Example: see GEOM_TestAll.py
thePnt Sphere center.
theR Sphere radius.
- Returns:
- New GEOM.GEOM_Object, containing the created sphere.
+ Returns:
+ New GEOM.GEOM_Object, containing the created sphere.
"""
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
"""
Create a sphere with given center and radius.
- Parameters:
+ Parameters:
x,y,z Coordinates of sphere center.
theR Sphere radius.
"""
Create a sphere with given radius at the origin of coordinate system.
- Parameters:
+ Parameters:
theR Sphere radius.
Returns:
- New GEOM.GEOM_Object, containing the created sphere.
+ New GEOM.GEOM_Object, containing the created sphere.
"""
# Example: see GEOM_TestAll.py
theR,Parameters = ParseParameters(theR)
"""
Create a cone with given base point, axis, height and radiuses.
- Parameters:
+ Parameters:
thePnt Central point of the first cone base.
theAxis Cone axis.
theR1 Radius of the first cone base.
the origin of coordinate system. Axis of the cone will
be collinear to the OZ axis of the coordinate system.
- Parameters:
+ Parameters:
theR1 Radius of the first cone base.
theR2 Radius of the second cone base.
theH Cone height.
"""
Create a torus with given center, normal vector and radiuses.
- Parameters:
+ Parameters:
thePnt Torus central point.
theVec Torus axis of symmetry.
theRMajor Torus major radius.
"""
Create a torus with given radiuses at the origin of coordinate system.
- Parameters:
+ Parameters:
theRMajor Torus major radius.
theRMinor Torus minor radius.
Returns:
- New GEOM.GEOM_Object, containing the created torus.
+ New GEOM.GEOM_Object, containing the created torus.
"""
# Example: see GEOM_TestAll.py
theRMajor,theRMinor,Parameters = ParseParameters(theRMajor,theRMinor)
"""
Create a shape by extrusion of the base shape along a vector, defined by two points.
- Parameters:
+ Parameters:
theBase Base shape to be extruded.
thePoint1 First end of extrusion vector.
thePoint2 Second end of extrusion vector.
Create a shape by extrusion of the base shape along a
vector, defined by two points, in 2 Ways (forward/backward).
- Parameters:
+ Parameters:
theBase Base shape to be extruded.
thePoint1 First end of extrusion vector.
thePoint2 Second end of extrusion vector.
i.e. all the space, transfixed by the base shape during its translation
along the vector on the given distance.
- Parameters:
+ Parameters:
theBase Base shape to be extruded.
theVec Direction of extrusion.
theH Prism dimension along theVec.
theScaleFactor Use it to make prism with scaled second base.
Nagative value means not scaled second base.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created prism.
"""
# Example: see GEOM_TestAll.py
theAxis Rotation axis.
theAngle Rotation angle in radians.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created revolution.
"""
# Example: see GEOM_TestAll.py
theAxis Rotation axis.
theAngle Rotation angle in radians.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created revolution.
"""
theAngle,Parameters = ParseParameters(theAngle)
Approximation makes the algorithm work slower, but allows
building the surface for rather complex cases
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created filling surface.
Example of usage:
theMaxDeg a maximal degree of BSpline surface to create
theTol3D a 3d tolerance to be reached
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created filling surface.
Example of usage:
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created solids.
"""
anObj = self.PrimOp.MakePipeWithShellSections(theSeqBases, theSeqSubBases,
same angle beetween the direction and the sections
along the sweep surface.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created pipe.
"""
# Example: see GEOM_TestAll.py
thePnt1 Point for the first end of edge.
thePnt2 Point for the second end of edge.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created edge.
"""
# Example: see GEOM_TestAll.py
at the end of theRefCurve, close to the selected point.
If None, start from the first point of theRefCurve.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created edge.
"""
# Example: see GEOM_TestAll.py
theTolerance Maximum distance between vertices, that will be merged.
Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created wire.
"""
# Example: see GEOM_TestAll.py
algorithm tries to build any suitable face on the given
wire and prints a warning message.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created face.
"""
# Example: see GEOM_TestAll.py
Parameters:
theShape Shape to count faces of.
- Returns:
+ Returns:
Quantity of faces.
"""
# Example: see GEOM_TestOthers.py
Parameters:
theShape Shape to count edges of.
- Returns:
+ Returns:
Quantity of edges.
"""
# Example: see GEOM_TestOthers.py
Parameters:
theShape Shape to be reversed.
- Returns:
+ Returns:
The reversed copy of theShape.
"""
# Example: see GEOM_TestAll.py
theShapes Shapes to find common sub-shapes of.
theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
- Returns:
+ Returns:
List of GEOM.GEOM_Object, that are sub-shapes of all given shapes.
"""
# Example: see GEOM_TestOthers.py
theState The state of the sub-shapes to find (see GEOM::shape_state)
Returns:
- List of all found sub-shapes indices.
+ List of all found sub-shapes indices.
"""
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnCylinderWithLocationIDs(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
# certain way, defined through \a theState parameter.
# @param theCheckShape Shape for relative comparing. It must be a solid.
# @param theShape Shape to find sub-shapes of.
- # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
# @return List of all found sub-shapes.
#
Returns:
Group of all found sub-shapes or a single found sub-shape.
-
+
Note:
This function has a restriction on argument shapes.
If theShapeWhere has curved parts with significantly
# equal to \a theShapeWhat.
# @param theShapeWhere Shape to find sub-shape of.
# @param theShapeWhat Shape, specifying what to find.
- # @return List of all found sub-shapes indices.
+ # @return List of all found sub-shapes indices.
#
# @ref swig_GetSame "Example"
def GetSameIDs(self,theShapeWhere, theShapeWhat):
## Explode a shape on sub-shapes of a given type.
# If the shape itself matches the type, it is also returned.
# @param aShape Shape to be exploded.
- # @param aType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param aType Type of sub-shapes to be retrieved (see ShapeType())
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
# @ref swig_all_decompose "Example"
Parameters:
aShape Shape to be exploded.
- aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
Returns:
List of sub-shapes of type theShapeType, contained in theShape.
Explode a shape on sub-shapes of a given type.
Parameters:
- aShape Shape to be exploded (see geompy.ShapeType)
+ aShape Shape to be exploded (see geompy.ShapeType)
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
Returns:
Obtain a compound of sub-shapes of aShape,
selected by they indices in list of all sub-shapes of type aType.
Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
-
+
Parameters:
aShape Shape to get sub-shape of.
ListOfID List of sub-shapes indices.
Sub-shapes will be sorted by coordinates of their gravity centers.
If the shape itself matches the type, it is also returned.
- Parameters:
+ Parameters:
aShape Shape to be exploded.
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
- Returns:
+ Returns:
List of sub-shapes of type theShapeType, contained in theShape.
"""
# Example: see GEOM_TestAll.py
Explode a shape on sub-shapes of a given type.
Sub-shapes will be sorted by coordinates of their gravity centers.
- Parameters:
+ Parameters:
aShape Shape to be exploded.
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
- Returns:
+ Returns:
List of IDs of sub-shapes.
"""
ListIDs = self.ShapesOp.GetAllSubShapesIDs(aShape, EnumToLong( aType ), True)
aType The shape type (see geompy.ShapeType)
isSorted Boolean flag to switch sorting on/off.
- Returns:
+ Returns:
List of sub-shapes of type aType, contained in aShape.
"""
# Example: see GEOM_TestAll.py
aShape Main shape.
anIDs List of unique IDs of sub-shapes inside theMainShape.
- Returns:
+ Returns:
List of GEOM.GEOM_Object, corresponding to found sub-shapes.
"""
# Example: see GEOM_TestAll.py
# are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n
# \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel,
# ruling out sharp edges).\n
- # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
+ # \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
# are of the same magnitude).\n
# \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves
# or surfaces (d/du C(u)) are the same at junction. \n
* SplitContinuity.SurfaceContinuity - required continuity for surfaces.
* SplitContinuity.CurveContinuity - required continuity for curves.
This and the previous parameters can take the following values:
-
+
Parametric Continuity:
C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces are
coincidental. The curves or surfaces may still meet at an angle,
or surfaces are of the same magnitude).
CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of
curves or surfaces (d/du C(u)) are the same at junction.
-
+
Geometric Continuity:
G1: first derivatives are proportional at junction.
The curve tangents thus have the same direction, but not necessarily the same magnitude.
theWires Indices of wires to be removed, if EMPTY then the method
removes ALL internal wires of the given object.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
theWires Indices of wires to be removed, if EMPTY then the method
removes ALL internal holes of the given object
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
"""
Close an open wire.
- Parameters:
+ Parameters:
theObject Shape to be processed.
theWires Indexes of edge(s) and wire(s) to be closed within theObject's shape,
if [ ], then theObject itself is a wire.
isCommonVertex If True : closure by creation of a common vertex,
If False : closure by creation of an edge between ends.
- Returns:
- New GEOM.GEOM_Object, containing processed shape.
+ Returns:
+ New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
"""
Addition of a point to a given edge object.
- Parameters:
+ Parameters:
theObject Shape to be processed.
theEdgeIndex Index of edge to be divided within theObject's shape,
if -1, then theObject itself is the edge.
isByParameter If TRUE : theValue is treated as a curve parameter [0..1],
if FALSE : theValue is treated as a length parameter [0..1]
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
"""
Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
- Parameters:
+ Parameters:
theWire Wire to minimize the number of C1 continuous edges in.
theVertices A list of vertices to suppress. If the list
is empty, all vertices in a wire will be assumed.
- Returns:
+ Returns:
New GEOM.GEOM_Object with modified wire.
"""
anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices)
"""
Change orientation of the given object. Updates given shape.
- Parameters:
+ Parameters:
theObject Shape to be processed.
- Returns:
+ Returns:
Updated theObject
"""
theObject = self.HealOp.ChangeOrientation(theObject)
Parameters:
theObject Shape to be processed.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
anObj = self.HealOp.ChangeOrientationCopy(theObject)
theObject Shape to be processed.
theTolerance Required tolerance value.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
Parameters:
theObject Shape to get free boundary of.
- Returns:
+ Returns:
[status, theClosedWires, theOpenWires]
status: FALSE, if an error(s) occured during the method execution.
theClosedWires: Closed wires on the free boundary of the given shape.
theTolerance Maximum distance between faces,
which can be considered as coincident.
- Returns:
+ Returns:
GEOM.ListOfGO
"""
anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
theShape Initial shape.
theTolerance Maximum distance between edges, which can be considered as coincident.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing a copy of theShape without coincident edges.
"""
theTolerance,Parameters = ParseParameters(theTolerance)
theTolerance Maximum distance between edges,
which can be considered as coincident.
- Returns:
+ Returns:
GEOM.ListOfGO
"""
anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
which can be considered as coincident.
theEdges List of edges for gluing.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing a copy of theShape
without some edges.
"""
"""
Perform one of boolean operations on two given shapes.
- Parameters:
+ Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
theOperation Indicates the operation to be done:
1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestAll.py
"""
Perform Common boolean operation on two given shapes.
- Parameters:
+ Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
- Returns:
+
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestOthers.py
"""
Perform Cut boolean operation on two given shapes.
- Parameters:
+ Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
- Returns:
+
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
-
+
"""
# Example: see GEOM_TestOthers.py
return self.MakeBoolean(theShape1, theShape2, 2)
"""
Perform Fuse boolean operation on two given shapes.
- Parameters:
+ Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
- Returns:
+
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
-
+
"""
# Example: see GEOM_TestOthers.py
return self.MakeBoolean(theShape1, theShape2, 3)
"""
Perform Section boolean operation on two given shapes.
- Parameters:
+ Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
- Returns:
+
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
-
+
"""
# Example: see GEOM_TestOthers.py
return self.MakeBoolean(theShape1, theShape2, 4)
"""
Perform partition operation.
- Parameters:
+ Parameters:
ListShapes Shapes to be intersected.
ListTools Shapes to intersect theShapes.
Limit Type of resulting shapes (see geompy.ShapeType)
Each compound from ListShapes and ListTools will be exploded
in order to avoid possible intersection between shapes from
this compound.
-
+
After implementation new version of PartitionAlgo (October 2006) other
parameters are ignored by current functionality. They are kept in this
function only for support old versions.
-
+
Ignored parameters:
ListKeepInside Shapes, outside which the results will be deleted.
Each shape from theKeepInside must belong to theShapes also.
RemoveWebs If TRUE, perform Glue 3D algorithm.
ListMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shapes.
"""
# Example: see GEOM_TestAll.py
compound contains nonintersected shapes. Performance will be better
since intersection between shapes from compound is not performed.
- Parameters:
+ Parameters:
Description of all parameters as in method geompy.MakePartition
-
+
NOTE:
Passed compounds (via ListShapes or via ListTools)
have to consist of nonintersecting shapes.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shapes.
"""
if Limit == ShapeType["AUTO"]:
"""
Perform partition of the Shape with the Plane
- Parameters:
+ Parameters:
theShape Shape to be intersected.
thePlane Tool shape, to intersect theShape.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestAll.py
Translate the given object along the vector, specified
by its end points, creating its copy before the translation.
- Parameters:
+ Parameters:
theObject The object to be translated.
thePoint1 Start point of translation vector.
thePoint2 End point of translation vector.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the translated object.
"""
# Example: see GEOM_TestAll.py
"""
Translate the given object along the vector, specified by its components.
- Parameters:
+ Parameters:
theObject The object to be translated.
theDX,theDY,theDZ Components of translation vector.
- Returns:
+ Returns:
Translated GEOM.GEOM_Object.
"""
# Example: see GEOM_TestAll.py
Translate the given object along the vector, specified
by its components, creating its copy before the translation.
- Parameters:
+ Parameters:
theObject The object to be translated.
theDX,theDY,theDZ Components of translation vector.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the translated object.
"""
# Example: see GEOM_TestAll.py
Translate the given object along the given vector,
creating its copy before the translation.
- Parameters:
+ Parameters:
theObject The object to be translated.
theVector The translation vector.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the translated object.
"""
# Example: see GEOM_TestAll.py
"""
Translate the given object along the given vector on given distance.
- Parameters:
+ Parameters:
theObject The object to be translated.
theVector The translation vector.
theDistance The translation distance.
theCopy Flag used to translate object itself or create a copy.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the translated object.
"""
# Example: see GEOM_TestAll.py
theVector The translation vector.
theDistance The translation distance.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the translated object.
"""
# Example: see GEOM_TestAll.py
theAxis Rotation axis.
theAngle Rotation angle in radians.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the rotated object.
"""
# Example: see GEOM_TestAll.py
Passing None for it means scaling relatively the origin of global CS.
theFactor Scaling factor value.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the scaled shape.
"""
# Example: see GEOM_TestAll.py
theObject The object to be mirrored.
theAxis Axis of symmetry.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the mirrored shape.
"""
# Example: see GEOM_TestAll.py
theObject The object to be mirrored.
thePoint Point of symmetry.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the mirrored shape.
"""
# Example: see GEOM_TestAll.py
its location will be changed to theEndLCS.
theEndLCS Coordinate system to perform displacement to it.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the displaced shape.
Example of usage:
theCopy is to create a copy objects if true.
theReverse 0 - for usual direction, 1 - to reverse path direction.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the displaced shape.
Example of usage:
theObject The base object for the offset.
theOffset Offset value.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the offset object.
Example of usage:
theSource The source object for the projection. It can be a point, edge or wire.
theTarget The target object. It can be planar or cylindrical face.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the projection.
"""
# Example: see GEOM_TestAll.py
theStep Distance to translate on.
theNbTimes Quantity of translations to be done.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing compound of all
the shapes, obtained after each translation.
theAxis The rotation axis.
theNbTimes Quantity of rotations to be done.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing compound of all the
shapes, obtained after each rotation.
theStep Translation distance.
theNbTimes2 Quantity of translations to be done.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing compound of all the
shapes, obtained after each transformation.
def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
"""
The same, as MultiRotate2D(), but axis is given by direction and point
-
+
Example of usage:
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
theShape Shape, to perform fillet on.
theR Fillet radius.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
- Example of usage:
- filletall = geompy.MakeFilletAll(prism, 10.)
+ Example of usage:
+ filletall = geompy.MakeFilletAll(prism, 10.)
"""
# Example: see GEOM_TestOthers.py
theR,Parameters = ParseParameters(theR)
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
Example of usage:
The list of vertices could be empty,in this case fillet will done done at all vertices in wire
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
- Example of usage:
+ Example of usage:
# create wire
Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
# make fillet at given wire vertices with giver radius
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
Example of usage:
theShape Shape, to perform chamfer on.
theD Chamfer size along each face.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
Example of usage:
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
Example of usage:
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
Example of usage:
theD2 Chamfer size along another of two faces, connected to the edge.
theFaces Sequence of global indices of faces of theShape.
-
+
Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestAll.py
"""
Perform a chamfer on edges,
with distance D1 on the first specified face (if several for one edge)
-
+
Parameters:
theShape Shape, to perform chamfer on.
theD1,theD2 Chamfer size
else:
anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
return anObj
-
+
## Remove material from a solid by extrusion of the base shape on the given distance.
- # @param theInit Shape to remove material from. It must be a solid or
+ # @param theInit Shape to remove material from. It must be a solid or
# a compound made of a single solid.
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
- # @return New GEOM.GEOM_Object, containing the initial shape with removed material
+ # @return New GEOM.GEOM_Object, containing the initial shape with removed material
#
# @ref tui_creation_prism "Example"
def MakeExtrudedCut(self, theInit, theBase, theH, theAngle):
anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
#anObj.SetParameters(Parameters)
- return anObj
-
+ return anObj
+
## Add material to a solid by extrusion of the base shape on the given distance.
- # @param theInit Shape to add material to. It must be a solid or
+ # @param theInit Shape to add material to. It must be a solid or
# a compound made of a single solid.
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
- # @return New GEOM.GEOM_Object, containing the initial shape with added material
+ # @return New GEOM.GEOM_Object, containing the initial shape with added material
#
# @ref tui_creation_prism "Example"
def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle):
anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
#anObj.SetParameters(Parameters)
- return anObj
+ return anObj
# end of l3_local
## @}
Perform an Archimde operation on the given shape with given parameters.
The object presenting the resulting face is returned.
- Parameters:
+ Parameters:
theShape Shape to be put in water.
theWeight Weight og the shape.
theWaterDensity Density of the water.
theMeshDeflection Deflection of the mesh, using to compute the section.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing a section of theShape
by a plane, corresponding to water level.
"""
Get summarized length of all wires,
area of surface and volume of the given shape.
- Parameters:
+ Parameters:
theShape Shape to define properties of.
Returns:
"""
Get parameters of bounding box of the given shape
- Parameters:
+ Parameters:
theShape Shape to obtain bounding box of.
Returns:
"""
Get inertia matrix and moments of inertia of theShape.
- Parameters:
+ Parameters:
theShape Shape to calculate inertia of.
Returns:
def AreCoordsInside(self, theShape, coords, tolerance=1.e-7):
"""
Get if coords are included in the shape (ST_IN or ST_ON)
-
- Parameters:
+
+ Parameters:
theShape Shape
coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
tolerance to be used (default is 1.0e-7)
def MinDistance(self, theShape1, theShape2):
"""
Get minimal distance between the given shapes.
-
- Parameters:
+
+ Parameters:
theShape1,theShape2 Shapes to find minimal distance between.
- Returns:
+ Returns:
Value of the minimal distance between the given shapes.
"""
# Example: see GEOM_TestMeasures.py
"""
Get minimal distance between the given shapes.
- Parameters:
+ Parameters:
theShape1,theShape2 Shapes to find minimal distance between.
- Returns:
+ Returns:
Value of the minimal distance between the given shapes.
"""
# Example: see GEOM_TestMeasures.py
"""
Get angle between the given shapes in degrees.
- Parameters:
+ Parameters:
theShape1,theShape2 Lines or linear edges to find angle between.
Note:
If both arguments are vectors, the angle is computed in accordance
with their orientations, otherwise the minimum angle is computed.
- Returns:
+ Returns:
Value of the angle between the given shapes in degrees.
"""
# Example: see GEOM_TestMeasures.py
"""
Get angle between the given shapes in radians.
- Parameters:
+ Parameters:
theShape1,theShape2 Lines or linear edges to find angle between.
-
+
Note:
If both arguments are vectors, the angle is computed in accordance
with their orientations, otherwise the minimum angle is computed.
- Returns:
+ Returns:
Value of the angle between the given shapes in radians.
"""
# Example: see GEOM_TestMeasures.py
"""
Get angle between the given vectors in degrees.
- Parameters:
+ Parameters:
theShape1,theShape2 Vectors to find angle between.
theFlag If True, the normal vector is defined by the two vectors cross,
if False, the opposite vector to the normal vector is used.
- Returns:
+ Returns:
Value of the angle between the given vectors in degrees.
"""
anAngle = self.MeasuOp.GetAngleBtwVectors(theShape1, theShape2)
"""
Get angle between the given vectors in radians.
- Parameters:
+ Parameters:
theShape1,theShape2 Vectors to find angle between.
theFlag If True, the normal vector is defined by the two vectors cross,
if False, the opposite vector to the normal vector is used.
- Returns:
+ Returns:
Value of the angle between the given vectors in radians.
"""
anAngle = self.GetAngleVectors(theShape1, theShape2, theFlag)*math.pi/180.
"""
Measure curvature of a curve at a point, set by parameter.
- Parameters:
+ Parameters:
theCurve a curve.
theParam parameter.
- Returns:
+ Returns:
radius of curvature of theCurve.
"""
# Example: see GEOM_TestMeasures.py
"""
Measure curvature of a curve at a point.
- Parameters:
+ Parameters:
theCurve a curve.
thePoint given point.
- Returns:
- radius of curvature of theCurve.
+ Returns:
+ radius of curvature of theCurve.
"""
aCurv = self.MeasuOp.CurveCurvatureByPoint(theCurve,thePoint)
RaiseIfFailed("CurveCurvatureByPoint", self.MeasuOp)
"""
Measure max radius of curvature of surface.
- Parameters:
+ Parameters:
theSurf the given surface.
theUParam Value of U-parameter on the referenced surface.
theVParam Value of V-parameter on the referenced surface.
-
- Returns:
+
+ Returns:
max radius of curvature of theSurf.
"""
# Example: see GEOM_TestMeasures.py
"""
Measure max radius of curvature of surface in the given point.
- Parameters:
+ Parameters:
theSurf the given surface.
thePoint given point.
-
- Returns:
- max radius of curvature of theSurf.
+
+ Returns:
+ max radius of curvature of theSurf.
"""
aSurf = self.MeasuOp.MaxSurfaceCurvatureByPoint(theSurf,thePoint)
RaiseIfFailed("MaxSurfaceCurvatureByPoint", self.MeasuOp)
# @param theUParam Value of U-parameter on the referenced surface.
# @param theVParam Value of V-parameter on the referenced surface.
# @return min radius of curvature of theSurf.
- #
+ #
## @ref swig_todo "Example"
def MinSurfaceCurvatureByParam(self, theSurf, theUParam, theVParam):
"""
Measure min radius of curvature of surface.
- Parameters:
+ Parameters:
theSurf the given surface.
theUParam Value of U-parameter on the referenced surface.
theVParam Value of V-parameter on the referenced surface.
-
- Returns:
+
+ Returns:
Min radius of curvature of theSurf.
"""
aSurf = self.MeasuOp.MinSurfaceCurvatureByParam(theSurf,theUParam,theVParam)
"""
Measure min radius of curvature of surface in the given point.
- Parameters:
+ Parameters:
theSurf the given surface.
thePoint given point.
-
- Returns:
- Min radius of curvature of theSurf.
+
+ Returns:
+ Min radius of curvature of theSurf.
"""
aSurf = self.MeasuOp.MinSurfaceCurvatureByPoint(theSurf,thePoint)
RaiseIfFailed("MinSurfaceCurvatureByPoint", self.MeasuOp)
"""
Get min and max tolerances of sub-shapes of theShape
- Parameters:
+ Parameters:
theShape Shape, to get tolerances of.
- Returns:
+ Returns:
[FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]
FaceMin,FaceMax: Min and max tolerances of the faces.
EdgeMin,EdgeMax: Min and max tolerances of the edges.
Parameters:
theShape Shape to find first vertex.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created vertex.
"""
# Example: see GEOM_TestMeasures.py
"""
Get the last vertex of wire/edge depended orientation.
- Parameters:
+ Parameters:
theShape Shape to find last vertex.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created vertex.
"""
# Example: see GEOM_TestMeasures.py
"""
Get a normale to the given face. If the point is not given,
the normale is calculated at the center of mass.
-
- Parameters:
+
+ Parameters:
theFace Face to define normale of.
theOptionalPoint Point to compute the normale at.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created vector.
"""
# Example: see GEOM_TestMeasures.py
# if TRUE, the shape's geometry will be checked also.
# @param theReturnStatus If FALSE and if theShape is invalid, a description \n
# of problem is printed.
- # if TRUE and if theShape is invalid, the description
+ # if TRUE and if theShape is invalid, the description
# of problem is also returned.
# @return TRUE, if the shape "seems to be valid".
#
"""
Check a topology of the given shape.
- Parameters:
+ Parameters:
theShape Shape to check validity of.
theIsCheckGeom If FALSE, only the shape's topology will be checked,
if TRUE, the shape's geometry will be checked also.
theReturnStatus If FALSE and if theShape is invalid, a description
of problem is printed.
- if TRUE and if theShape is invalid, the description
+ if TRUE and if theShape is invalid, the description
of problem is returned.
- Returns:
+ Returns:
TRUE, if the shape "seems to be valid".
If theShape is invalid, prints a description of problem.
This description can also be returned.
"""
Detect self-intersections in the given shape.
- Parameters:
+ Parameters:
theShape Shape to check.
- Returns:
+ Returns:
TRUE, if the shape contains no self-intersections.
"""
# Example: see GEOM_TestMeasures.py
Axes of the LCS are obtained from shape's location or,
if the shape is a planar face, from position of its plane.
- Parameters:
+ Parameters:
theShape Shape to calculate position of.
- Returns:
+ Returns:
[Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
Ox,Oy,Oz: Coordinates of shape's LCS origin.
Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
def KindOfShape(self,theShape):
"""
Get kind of theShape.
-
- Parameters:
+
+ Parameters:
theShape Shape to get a kind of.
Returns:
Import a shape from the BREP or IGES or STEP file
(depends on given format) with given name.
- Parameters:
+ Parameters:
theFileName The file, containing the shape.
theFormatName Specify format for the file reading.
Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
geompy.ImportFile(...) function for BREP format
Import a shape from the BREP file with given name.
- Parameters:
+ Parameters:
theFileName The file, containing the shape.
Returns:
Note:
shape.GetShapeStream() method can be used to obtain the shape's BRep stream.
- Parameters:
+ Parameters:
theStream The BRep binary stream.
Returns:
"""
Export the given shape into a file with given name.
- Parameters:
+ Parameters:
theObject Shape to be stored in the file.
theFileName Name of the file to store the given shape in.
theFormatName Specify format for the shape storage.
Create a quadrangle face from four edges. Order of Edges is not
important. It is not necessary that edges share the same vertex.
- Parameters:
+ Parameters:
E1,E2,E3,E4 Edges for the face bound.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created face.
- Example of usage:
+ Example of usage:
qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
"""
# Example: see GEOM_Spanner.py
Create a quadrangle face on two edges.
The missing edges will be built by creating the shortest ones.
- Parameters:
+ Parameters:
E1,E2 Two opposite edges for the face.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created face.
-
+
Example of usage:
# create vertices
p1 = geompy.MakeVertex( 0., 0., 0.)
Create a quadrangle face with specified corners.
The missing edges will be built by creating the shortest ones.
- Parameters:
+ Parameters:
V1,V2,V3,V4 Corner vertices for the face.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created face.
Example of usage:
Create a hexahedral solid, bounded by the six given faces. Order of
faces is not important. It is not necessary that Faces share the same edge.
- Parameters:
+ Parameters:
F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the created solid.
Example of usage:
Create a hexahedral solid between two given faces.
The missing faces will be built by creating the smallest ones.
- Parameters:
+ Parameters:
F1,F2 Two opposite faces for the hexahedral solid.
Returns:
"""
Get a vertex, found in the given shape by its coordinates.
- Parameters:
+ Parameters:
theShape Block or a compound of blocks.
theX,theY,theZ Coordinates of the sought vertex.
theEpsilon Maximum allowed distance between the resulting
vertex and point with the given coordinates.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the found vertex.
Example of usage:
"""
Find a vertex of the given shape, which has minimal distance to the given point.
- Parameters:
+ Parameters:
theShape Any shape.
thePoint Point, close to the desired vertex.
"""
Get an edge, found in the given shape by two given vertices.
- Parameters:
+ Parameters:
theShape Block or a compound of blocks.
thePoint1,thePoint2 Points, close to the ends of the desired edge.
"""
Find an edge of the given shape, which has minimal distance to the given point.
- Parameters:
+ Parameters:
theShape Block or a compound of blocks.
thePoint Point, close to the desired edge.
theBlock Must be a hexahedral solid.
theFace Face of theBlock, opposite to the desired face.
- Returns:
+ Returns:
New GEOM.GEOM_Object, containing the found face.
"""
# Example: see GEOM_Spanner.py
Returns:
TRUE, if the given shape is a compound of blocks.
- If theCompound is not valid, prints all discovered errors.
+ If theCompound is not valid, prints all discovered errors.
"""
# Example: see GEOM_Spanner.py
(IsValid, BCErrors) = self.BlocksOp.CheckCompoundOfBlocks(theCompound)
doUnionFaces If True, then unite faces. If False (the default value),
do not unite faces.
- Returns:
+ Returns:
Improved shape.
"""
# Example: see GEOM_TestOthers.py
Parameters:
theShape The compound to check and improve.
- Returns:
+ Returns:
Improved compound.
"""
# Example: see GEOM_TestOthers.py
Note:
If theMaxNbFaces = 0, the maximum number of faces is not restricted.
- Returns:
+ Returns:
List of GEOM.GEOM_Object, containing the retrieved blocks.
"""
# Example: see GEOM_TestOthers.py
theCompound Compound, to find block in.
theParts List of faces and/or edges and/or vertices to be parts of the found block.
- Returns:
+ Returns:
New GEOM_Object, containing the found block.
"""
# Example: see GEOM_TestOthers.py
Example of usage:
group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
+
"""
# Example: see GEOM_TestOthers.py
anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
theSubShapeID is a sub-shape ID in the main object.
Note:
- Use method GetSubShapeID() to get an unique ID of the sub-shape
+ Use method GetSubShapeID() to get an unique ID of the sub-shape
"""
# Example: see GEOM_TestOthers.py
self.GroupOp.AddObject(theGroup, theSubShapeID)
Parameters:
theGroup is a GEOM group from which the sub-shapes are removed.
theSubShapes is a list of indices of sub-shapes to be removed.
- """
+ """
# Example: see GEOM_TestOthers.py
self.GroupOp.DifferenceIDs(theGroup, theSubShapes)
RaiseIfFailed("DifferenceIDs", self.GroupOp)
## Cut of lists of groups.
# New group is created. It will contain only entities
- # which are present in groups listed in theGList1 but
+ # which are present in groups listed in theGList1 but
# are not present in groups from theGList2.
# @param theGList1 is a list of GEOM groups to include elements of.
# @param theGList2 is a list of GEOM groups to exclude elements of.
"""
Cut of lists of groups.
New group is created. It will contain only entities
- which are present in groups listed in theGList1 but
+ which are present in groups listed in theGList1 but
are not present in groups from theGList2.
Parameters:
## Cut of lists of groups.
# New group is created. It will contain only entities
- # which are present in groups listed in theGList1 but
+ # which are present in groups listed in theGList1 but
# are not present in groups from theGList2.
# @param theGList1 is a list of GEOM groups to include elements of.
# @param theGList2 is a list of GEOM groups to exclude elements of.
"""
Cut of lists of groups.
New group is created. It will contain only entities
- which are present in groups listed in theGList1 but
+ which are present in groups listed in theGList1 but
are not present in groups from theGList2.
Parameters:
Parameters:
theId is a GEOM obect type id.
-
+
Returns:
type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
"""
# create PipeTShape object with position
pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
"""
- theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
+ theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
if (theP1 and theP2 and theP3):
anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
else:
theP1 1st junction point of main pipe
theP2 2nd junction point of main pipe
theP3 Junction point of incident pipe
-
+
Returns:
List of GEOM_Object, containing the created shape and propagation groups.
-
+
Example of usage:
# create PipeTShape with fillet object
pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
# create PipeTShape with fillet object with position
pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
-
+
"""
theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
if (theP1 and theP2 and theP3):
RaiseIfFailed("MakeDividedDisk", self.AdvOp)
if Parameters: anObj.SetParameters(Parameters)
return anObj
-
+
## This function allows creating a disk already divided into blocks. It
# can be used to create divided pipes for later meshing in hexaedra.
# @param theCenter Center of the disk
if Parameters: anObj.SetParameters(Parameters)
return anObj
- ## Export a shape to XAO Format
- # @param shape Shape to export
- # @param fileName The name of the exported file
- # @param groups List of groups to export
- # @param fields List of fields to export
+ ## Export a shape to XAO format
+ # @param shape The shape to export
+ # @param groups The list of groups to export
+ # @param fields The list of fields to export
+ # @param author The author of the export
+ # @param fileName The name of the file to export
# @return boolean
#
- # @ref tui_creation_exportxao "Example"
- def ExportXAO(self, fileName, shape, groups, fields):
- fileName, shape, groups, fields, Parameters = ParseParameters(fileName, shape, groups, fields)
- isGood = self.ImpExpOp.ExportXAO(fileName, shape, groups, fields)
+ # @ref tui_exportxao "Example"
+ def ExportXAO(self, shape, groups, fields, author, fileName):
+ res = self.ImpExpOp.ExportXAO(shape, groups, fields, author, fileName)
RaiseIfFailed("ExportXAO", self.ImpExpOp)
#if Parameters: anObj.SetParameters(Parameters)
- return isGood
+ return res
+
+ ## Import a shape from XAO format
+ # @param shape Shape to export
+ # @param fileName The name of the file to import
+ # @return tuple (res, shape, groups, fields)
+ # res Flag indicating if the import was succeful
+ # shape The imported shape
+ # groups The list of imported groups
+ # fields The list of imported fields
+ #
+ # @ref tui_importxao "Example"
+ def ImportXAO(self, fileName):
+ res = self.ImpExpOp.ImportXAO(fileName)
+ RaiseIfFailed("ImportXAO", self.ImpExpOp)
+ #if Parameters: anObj.SetParameters(Parameters)
+ return res
#@@ insert new functions before this line @@ do not remove this line @@#
def LoadTexture(self, Path):
"""
Load marker texture from the file
-
+
Parameters:
Path a path to the texture file
-
+
Returns:
unique texture identifier
"""
## Get internal name of the object based on its study entry
# @note This method does not provide an unique identifier of the geometry object.
- # @note This is internal function of GEOM component, though it can be used outside it for
+ # @note This is internal function of GEOM component, though it can be used outside it for
# appropriate reason (e.g. for identification of geometry object).
# @param obj geometry object
# @return unique object identifier
"""
Get internal name of the object based on its study entry.
Note: this method does not provide an unique identifier of the geometry object.
- It is an internal function of GEOM component, though it can be used outside GEOM for
+ It is an internal function of GEOM component, though it can be used outside GEOM for
appropriate reason (e.g. for identification of geometry object).
Parameters:
if entry is not None:
lst = entry.split(":")
if len(lst) > 0:
- ID = lst[-1] # -1 means last item in the list
+ ID = lst[-1] # -1 means last item in the list
return "GEOM_" + ID
return ID
-
-
+
+
## Add marker texture. @a Width and @a Height parameters
# specify width and height of the texture in pixels.
// 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 : ImportExportGUI.cxx
-// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-//
-#include "ImportExportGUI.h"
+#include <iostream>
+#include <QDialog>
#include "GeometryGUI.h"
#include "GeometryGUI_Operations.h"
#include <SalomeApp_Application.h>
#include "ImportExportGUI_ExportXAODlg.h"
+#include "ImportExportGUI_ImportXAODlg.h"
+#include "ImportExportGUI.h"
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
-#include <QDialog>
-#include <iostream>
//=======================================================================
// function : ImportExportGUI()
dialog = new ImportExportGUI_ExportXAODlg(getGeometryGUI(), parent);
break;
case GEOMOp::OpImportXAO:
+ dialog = new ImportExportGUI_ImportXAODlg(getGeometryGUI(), parent);
break;
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
default:
ledShape = new QLineEdit(gbxExport);
ledShape->setMinimumSize(QSize(100, 0));
- gridLayoutExport->addWidget(lblShape, 0, 0, 1, 1);
- gridLayoutExport->addWidget(btnShapeSelect, 0, 1, 1, 1);
- gridLayoutExport->addWidget(ledShape, 0, 2, 1, 1);
+ int line = 0, col = 0;
+ gridLayoutExport->addWidget(lblShape, line, col++, 1, 1);
+ gridLayoutExport->addWidget(btnShapeSelect, line, col++, 1, 1);
+ gridLayoutExport->addWidget(ledShape, line, col++, 1, 1);
// Line 1
QLabel* lblFileName = new QLabel(tr("GEOM_EXPORTXAO_FILENAME"), gbxExport);
ledFileName = new QLineEdit(gbxExport);
btnFileSelect->setText("...");
- gridLayoutExport->addWidget(lblFileName, 1, 0, 1, 1);
- gridLayoutExport->addWidget(btnFileSelect, 1, 1, 1, 1);
- gridLayoutExport->addWidget(ledFileName, 1, 2, 1, 1);
+ line++; col = 0;
+ gridLayoutExport->addWidget(lblFileName, line, col++, 1, 1);
+ gridLayoutExport->addWidget(btnFileSelect, line, col++, 1, 1);
+ gridLayoutExport->addWidget(ledFileName, line, col++, 1, 1);
+
+ // Line 2
+ QLabel* lblAuthor = new QLabel(tr("GEOM_EXPORTXAO_AUTHOR"), gbxExport);
+ ledAuthor = new QLineEdit(gbxExport);
+
+ line++; col = 0;
+ gridLayoutExport->addWidget(lblAuthor, line, col++, 2, 1);
+ col++; // span
+ gridLayoutExport->addWidget(ledAuthor, line, col++, 1, 1);
//****************************
// Filter Group box
QLabel* lblGroups = new QLabel(tr("GEOM_EXPORTXAO_LGROUPS"), gbxFilter);
QLabel* lblFields = new QLabel(tr("GEOM_EXPORTXAO_LFIELDS"), gbxFilter);
- gridLayoutFilter->addWidget(lblGroups, 0, 0, 1, 1);
- gridLayoutFilter->addWidget(lblFields, 0, 1, 1, 1);
+ line = 0, col = 0;
+ gridLayoutFilter->addWidget(lblGroups, line, col++, 1, 1);
+ gridLayoutFilter->addWidget(lblFields, line, col++, 1, 1);
// Line 1
lstGroups = new QListWidget(gbxFilter);
lstFields = new QListWidget(gbxFilter);
lstFields ->setSelectionMode(QAbstractItemView::ExtendedSelection);
- gridLayoutFilter->addWidget(lstGroups, 1, 0, 1, 1);
- gridLayoutFilter->addWidget(lstFields, 1, 1, 1, 1);
+ line++; col = 0;
+ gridLayoutFilter->addWidget(lstGroups, line, col++, 1, 1);
+ gridLayoutFilter->addWidget(lstFields, line, col++, 1, 1);
//****************************
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
{
bool res = false;
+ QString author = ledAuthor->text();
+ QString fileName = ledFileName->text();
+
// get selected groups
QList<QListWidgetItem*> selGroups = lstGroups->selectedItems();
GEOM::ListOfGO_var groups = new GEOM::ListOfGO();
// call engine function
GEOM::GEOM_IImportExportOperations_var ieOp = GEOM::GEOM_IImportExportOperations::_narrow(getOperation());
- char* xao;
- res = ieOp->ExportXAO(m_mainObj, groups, fields, xao);
-
- // dump xao to file
- ofstream exportFile;
- exportFile.open(ledFileName->text().toStdString().c_str());
- exportFile << xao;
- exportFile.close();
- delete xao;
+ res = ieOp->ExportXAO(m_mainObj, groups, fields,
+ author.toStdString().c_str(),
+ fileName.toStdString().c_str());
return res;
}
QList<GEOM::GeomObjPtr> m_fields;
QLineEdit* ledShape;
QLineEdit* ledFileName;
+ QLineEdit* ledAuthor;
QListWidget* lstGroups;
QListWidget* lstFields;
QPushButton* btnShapeSelect;
--- /dev/null
+// Copyright (C) 2013 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
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <LightApp_SelectionMgr.h>
+
+#include <QLabel>
+#include <QLineEdit>
+#include <QButtonGroup>
+#include <QListWidget>
+#include <QFileDialog>
+#include <QMap>
+
+// OCCT Includes
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#include <GEOMImpl_Types.hxx>
+#include "ImportExportGUI_ImportXAODlg.h"
+
+//=================================================================================
+// Constructor
+//=================================================================================
+ImportExportGUI_ImportXAODlg::ImportExportGUI_ImportXAODlg(GeometryGUI* geometryGUI, QWidget* parent)
+:
+ GEOMBase_Skeleton(geometryGUI, parent, false)
+{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap imageOp(resMgr->loadPixmap("GEOM", tr("ICON_DLG_IMPORTXAO")));
+ QPixmap iconSelect(resMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("GEOM_IMPORTXAO_TITLE"));
+
+ /***************************************************************/
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_IMPORTXAO_TITLE"));
+ mainFrame()->RadioButton1->setIcon(imageOp);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ // hide name
+ mainFrame()->GroupBoxName->hide();
+
+ //****************************
+ // Selection Group box
+ QGroupBox* gbxExport = new QGroupBox(parent);
+
+ QGridLayout* gridLayoutExport = new QGridLayout(gbxExport);
+#ifndef Q_OS_MAC
+ gridLayoutExport->setSpacing(6);
+ gridLayoutExport->setContentsMargins(9, 9, 9, 9);
+#endif
+ gridLayoutExport->setObjectName(QString::fromUtf8("gridLayoutExport"));
+
+ int line = 0, col = 0;
+ QLabel* lblFileName = new QLabel(tr("GEOM_IMPORTXAO_FILENAME"), gbxExport);
+ btnFileSelect = new QPushButton(gbxExport);
+ ledFileName = new QLineEdit(gbxExport);
+ btnFileSelect->setText("...");
+
+ line++; col = 0;
+ gridLayoutExport->addWidget(lblFileName, line, col++, 1, 1);
+ gridLayoutExport->addWidget(btnFileSelect, line, col++, 1, 1);
+ gridLayoutExport->addWidget(ledFileName, line, col++, 1, 1);
+
+ //****************************
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0);
+ layout->setSpacing(6);
+ layout->addWidget(gbxExport);
+
+ // set help
+ setHelpFileName("create_importxao_page.html");
+
+ Init();
+}
+
+//=================================================================================
+// Destructor
+//=================================================================================
+ImportExportGUI_ImportXAODlg::~ImportExportGUI_ImportXAODlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void ImportExportGUI_ImportXAODlg::Init()
+{
+ // Signal/slot connections
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(btnFileSelect, SIGNAL(clicked()), this, SLOT(btnFileSelectClicked()));
+
+ initName(tr("GEOM_IMPORTXAO"));
+ //SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void ImportExportGUI_ImportXAODlg::ClickOnOk()
+{
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool ImportExportGUI_ImportXAODlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+
+ return true;
+}
+
+//=================================================================================
+// function : btnFileSelectClicked()
+// purpose :
+//=================================================================================
+void ImportExportGUI_ImportXAODlg::btnFileSelectClicked()
+{
+ QString selFile = QFileDialog::getOpenFileName(this, tr("GEOM_SELECT_EXPORT_XAO"),
+ QString(), tr("XAO_FILES"));
+ if (!selFile.isEmpty())
+ {
+ ledFileName->setText(selFile);
+ }
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void ImportExportGUI_ImportXAODlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+}
+
+//=================================================================================
+// function : enterEvent [REDEFINED]
+// purpose :
+//=================================================================================
+void ImportExportGUI_ImportXAODlg::enterEvent(QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr ImportExportGUI_ImportXAODlg::createOperation()
+{
+ return getGeomEngine()->GetIImportExportOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool ImportExportGUI_ImportXAODlg::isValid(QString& msg)
+{
+ // check file name
+ if (ledFileName->text().isEmpty())
+ return false;
+
+ return true;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool ImportExportGUI_ImportXAODlg::execute(ObjectList& objects)
+{
+ bool res = false;
+
+ QString fileName = ledFileName->text();
+ GEOM::GEOM_Object_var shape;
+ GEOM::ListOfGO_var groups, fields;
+
+ GEOM::GEOM_IImportExportOperations_var ieOp = GEOM::GEOM_IImportExportOperations::_narrow(getOperation());
+ res = ieOp->ImportXAO(fileName.toStdString().c_str(), shape, groups, fields);
+
+ if (!shape->_is_nil())
+ {
+ objects.push_back(shape._retn());
+ }
+
+ for (int i = 0; i < groups->length(); i++)
+ {
+ objects.push_back(GEOM::GEOM_Object::_duplicate(groups[i]));
+ }
+
+ return res;
+}
+
+GEOM::GEOM_Object_ptr ImportExportGUI_ImportXAODlg::getFather(GEOM::GEOM_Object_ptr object)
+{
+ GEOM::GEOM_Object_var fatherObj;
+ if (object->GetType() == GEOM_GROUP)
+ {
+ GEOM::GEOM_IGroupOperations_var groupOper = getGeomEngine()->GetIGroupOperations(getStudyId());
+ fatherObj = groupOper->GetMainShape(object);
+ }
+ return fatherObj._retn();
+}
+
+QString ImportExportGUI_ImportXAODlg::getObjectName(GEOM::GEOM_Object_ptr object) const
+{
+ if (object->_is_nil())
+ return QString::null;
+ return object->GetName();
+}
--- /dev/null
+// Copyright (C) 2013 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
+
+#ifndef IMPORTEXPORTGUI_IMPORTXAODLG_H
+#define IMPORTEXPORTGUI_IMPORTXAODLG_H
+
+#include <GEOMBase_Skeleton.h>
+#include <GEOM_GenericObjPtr.h>
+
+class QLineEdit;
+class QButtonGroup;
+class QListWidget;
+
+//=================================================================================
+// class : ImportExportGUI_ImportXAODlg
+// purpose :
+//=================================================================================
+class ImportExportGUI_ImportXAODlg: public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ ImportExportGUI_ImportXAODlg(GeometryGUI*, QWidget* = 0);
+ ~ImportExportGUI_ImportXAODlg();
+
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid(QString&);
+ virtual bool execute(ObjectList&);
+ virtual GEOM::GEOM_Object_ptr getFather(GEOM::GEOM_Object_ptr object);
+ virtual QString getObjectName(GEOM::GEOM_Object_ptr object) const;
+
+private:
+ void Init();
+ void enterEvent(QEvent*);
+
+private:
+ QLineEdit* ledFileName;
+ QPushButton* btnFileSelect;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void LineEditReturnPressed();
+ void btnFileSelectClicked();
+};
+
+#endif // IMPORTEXPORTGUI_EXPORTXAODLG_H
# header files
salomeinclude_HEADERS = \
- ImportExportGUI.h \
- ImportExportGUI_ExportXAODlg.h
+ ImportExportGUI.h
-#IMPORTEXPORT_INCLUDES =
-#IMPORTEXPORT_INCLUDES += ImportExportGUI_ExportXAODlg.h
+libImportExportGUI_la_INCLUDES =
+libImportExportGUI_la_INCLUDES += ImportExportGUI_ExportXAODlg.h
+libImportExportGUI_la_INCLUDES += ImportExportGUI_ImportXAODlg.h
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
#salomeinclude_HEADERS += $(IMPORTEXPORT_INCLUDES)
dist_libImportExportGUI_la_SOURCES = \
- ImportExportGUI_ExportXAODlg.h \
ImportExportGUI.h \
- ImportExportGUI_ExportXAODlg.cxx \
ImportExportGUI.cxx
-#IMPORTEXPORT_SOURCES =
-#IMPORTEXPORT_SOURCES += ImportExportGUI_ExportXAODlg.h ImportExportGUI_ExportXAODlg.cxx
+libImportExportGUI_la_SOURCES =
+libImportExportGUI_la_SOURCES += ImportExportGUI_ExportXAODlg.h ImportExportGUI_ExportXAODlg.cxx
+libImportExportGUI_la_SOURCES += ImportExportGUI_ImportXAODlg.h ImportExportGUI_ImportXAODlg.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
#dist_libImportExportGUI_la_SOURCES += $(IMPORTEXPORT_SOURCES)
MOC_FILES =
-IMPORTEXPORT_MOC_FILES = ImportExportGUI_moc.cxx
-IMPORTEXPORT_MOC_FILES += ImportExportGUI_ExportXAODlg_moc.cxx
+MOC_FILES = ImportExportGUI_moc.cxx
+MOC_FILES += ImportExportGUI_ExportXAODlg_moc.cxx
+MOC_FILES += ImportExportGUI_ImportXAODlg_moc.cxx
##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@##
MOC_FILES += $(IMPORTEXPORT_MOC_FILES)