CoTech 32: Action 32.3: In GEOM, the function Import() renamed to ImportFile()

This commit is contained in:
jfa 2011-03-30 13:20:55 +00:00
parent e4ebb2bada
commit 9e31f81bd0
15 changed files with 146 additions and 128 deletions

View File

@ -24,7 +24,7 @@ print "UnitName2 = ", UnitName2
# import shapes # import shapes
Shape1 = geompy.ImportIGES(theFileName1) Shape1 = geompy.ImportIGES(theFileName1)
Shape2 = geompy.ImportIGES(theFileName2) Shape2 = geompy.ImportIGES(theFileName2)
Shape3 = geompy.Import(theFileName2,"IGES_SCALE") Shape3 = geompy.ImportFile(theFileName2,"IGES_SCALE")
[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1) [Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1)
[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2) [Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2)
[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3) [Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3)

View File

@ -2939,7 +2939,7 @@ module GEOM
* set to 'meter' and result model will be scaled. * set to 'meter' and result model will be scaled.
* \return New GEOM_Object, containing the imported shape. * \return New GEOM_Object, containing the imported shape.
*/ */
GEOM_Object Import (in string theFileName, in string theFormatName); GEOM_Object ImportFile (in string theFileName, in string theFormatName);
/*! /*!
* Get the supported import formats and corresponding patterns for File dialog. * Get the supported import formats and corresponding patterns for File dialog.

View File

@ -257,7 +257,7 @@ module GEOM
//-----------------------------------------------------------// //-----------------------------------------------------------//
GEOM_Object MakeCopy (in GEOM_Object theOriginal) ; GEOM_Object MakeCopy (in GEOM_Object theOriginal) ;
void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName) ; void Export (in GEOM_Object theObject, in string theFileName, in string theFormatName) ;
GEOM_Object Import (in string theFileName, in string theFormatName) ; GEOM_Object ImportFile (in string theFileName, in string theFormatName) ;
void ImportTranslators (out string_array theFormats, void ImportTranslators (out string_array theFormats,
out string_array thePatterns) ; out string_array thePatterns) ;
void ExportTranslators (out string_array theFormats, void ExportTranslators (out string_array theFormats,

View File

@ -31,28 +31,6 @@
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="2" column="0" colspan="3" >
<widget class="QCheckBox" name="CheckButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="PushButton1" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QLabel" name="TextLabel1" > <widget class="QLabel" name="TextLabel1" >
<property name="sizePolicy" > <property name="sizePolicy" >
@ -71,21 +49,24 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2" > <item row="0" column="1" >
<widget class="QLineEdit" name="LineEdit1" /> <widget class="QPushButton" name="PushButton1" >
</item>
<item row="1" column="1" colspan="2" >
<widget class="QComboBox" name="ComboBox1" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy> <sizepolicy>
<hsizetype>7</hsizetype> <hsizetype>0</hsizetype>
<vsizetype>0</vsizetype> <vsizetype>0</vsizetype>
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text" >
<string/>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="2" >
<widget class="QLineEdit" name="LineEdit1" />
</item>
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" > <widget class="QLabel" name="TextLabel2" >
<property name="sizePolicy" > <property name="sizePolicy" >
@ -104,6 +85,25 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2" >
<widget class="QComboBox" name="ComboBox1" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3" >
<widget class="QCheckBox" name="CheckButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -72,53 +72,67 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2" colspan="2" > <item row="0" column="2" >
<widget class="QLineEdit" name="LineEdit1" /> <widget class="QLineEdit" name="LineEdit1" />
</item> </item>
<item row="1" column="0" colspan="3" > <item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL2</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="QComboBox" name="ComboBox1" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" rowspan="3" column="0" colspan="2" >
<widget class="QCheckBox" name="CheckButton1" > <widget class="QCheckBox" name="CheckButton1" >
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3" > <item row="2" column="2" >
<widget class="QPushButton" name="PushButton2" > <widget class="QPushButton" name="PushButton2" >
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item rowspan="3" row="2" column="0" colspan="3" > <item row="3" column="2" >
<widget class="QListWidget" name="ListView1" />
</item>
<item row="2" column="3" >
<widget class="QPushButton" name="PushButton3" > <widget class="QPushButton" name="PushButton3" >
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="3" > <item row="4" column="2" >
<widget class="QPushButton" name="PushButton4" > <widget class="QPushButton" name="PushButton4" >
<property name="text" > <property name="text" >
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>21</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -243,7 +243,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::Import
//Make a Python command //Make a Python command
if( theFormatName != "IGES_UNIT" ) { if( theFormatName != "IGES_UNIT" ) {
GEOM::TPythonDump(aFunction) << result << " = geompy.Import(\"" GEOM::TPythonDump(aFunction) << result << " = geompy.ImportFile(\""
<< theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")"; << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
} }

View File

@ -634,7 +634,7 @@ bool GEOMToolsGUI::Import()
// skl 29.05.2009 // skl 29.05.2009
if ( aCurrentType == "IGES" ) { if ( aCurrentType == "IGES" ) {
GEOM::GEOM_Object_var anObj = aInsOp->Import( fileN, "IGES_UNIT" ); GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, "IGES_UNIT" );
bool needConvert = false; bool needConvert = false;
TCollection_AsciiString aUnitName = aInsOp->GetErrorCode(); TCollection_AsciiString aUnitName = aInsOp->GetErrorCode();
if ( aUnitName.SubString( 1, 4 ) == "UNIT" ) if ( aUnitName.SubString( 1, 4 ) == "UNIT" )
@ -682,7 +682,7 @@ bool GEOMToolsGUI::Import()
} // if ( acisAnswer != YesToAll && acisAnswer != NoToAll ) } // if ( acisAnswer != YesToAll && acisAnswer != NoToAll )
} // else if ( aCurrentType == "ACIS" ) } // else if ( aCurrentType == "ACIS" )
GEOM::GEOM_Object_var anObj = aInsOp->Import( fileN, fileT ); GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, fileT );
if ( !anObj->_is_nil() && aInsOp->IsDone() ) { if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
QString aPublishObjName = QString aPublishObjName =

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WNT #ifdef WNT
#pragma warning( disable:4786 ) #pragma warning( disable:4786 )
@ -115,10 +114,10 @@ void GEOM_IInsertOperations_i::Export
//============================================================================= //=============================================================================
/*! /*!
* Import * ImportFile
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::Import GEOM::GEOM_Object_ptr GEOM_IInsertOperations_i::ImportFile
(const char* theFileName, (const char* theFileName,
const char* theFormatName) const char* theFormatName)
{ {

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_IInsertOperations_i_HeaderFile #ifndef _GEOM_IInsertOperations_i_HeaderFile
#define _GEOM_IInsertOperations_i_HeaderFile #define _GEOM_IInsertOperations_i_HeaderFile
@ -49,7 +48,7 @@ class GEOM_I_EXPORT GEOM_IInsertOperations_i :
const char* theFileName, const char* theFileName,
const char* theFormatName); const char* theFormatName);
GEOM::GEOM_Object_ptr Import (const char* theFileName, GEOM::GEOM_Object_ptr ImportFile (const char* theFileName,
const char* theFormatName); const char* theFormatName);
void ImportTranslators (GEOM::string_array_out theFormats, void ImportTranslators (GEOM::string_array_out theFormats,

View File

@ -1495,14 +1495,14 @@ void GEOM_Superv_i::Export (GEOM::GEOM_Object_ptr theObject,
//============================================================================= //=============================================================================
// Import: // Import:
//============================================================================= //=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::Import (const char* theFileName, GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportFile (const char* theFileName,
const char* theFormatName) const char* theFormatName)
{ {
beginService( " GEOM_Superv_i::Import" ); beginService( " GEOM_Superv_i::ImportFile" );
MESSAGE("GEOM_Superv_i::Import"); MESSAGE("GEOM_Superv_i::ImportFile");
getInsOp(); getInsOp();
GEOM::GEOM_Object_ptr anObj = myInsOp->Import(theFileName, theFormatName); GEOM::GEOM_Object_ptr anObj = myInsOp->ImportFile(theFileName, theFormatName);
endService( " GEOM_Superv_i::Import" ); endService( " GEOM_Superv_i::ImportFile" );
return anObj; return anObj;
} }

View File

@ -347,7 +347,7 @@ public:
void Export (GEOM::GEOM_Object_ptr theObject, void Export (GEOM::GEOM_Object_ptr theObject,
const char* theFileName, const char* theFileName,
const char* theFormatName); const char* theFormatName);
GEOM::GEOM_Object_ptr Import (const char* theFileName, GEOM::GEOM_Object_ptr ImportFile (const char* theFileName,
const char* theFormatName); const char* theFormatName);
void ImportTranslators (GEOM::string_array_out theFormats, void ImportTranslators (GEOM::string_array_out theFormats,
GEOM::string_array_out thePatterns); GEOM::string_array_out thePatterns);

View File

@ -77,7 +77,7 @@ def TestExportImport (geompy, shape):
geompy.ExportSTEP(shape, fileExportImportSTEP) geompy.ExportSTEP(shape, fileExportImportSTEP)
# Import # Import
Import = geompy.Import(fileExportImport, "BREP") Import = geompy.ImportFile(fileExportImport, "BREP")
id_Import = geompy.addToStudy(Import, "Import") id_Import = geompy.addToStudy(Import, "Import")

View File

@ -3738,32 +3738,39 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @return New GEOM_Object, containing the imported shape. # @return New GEOM_Object, containing the imported shape.
# #
# @ref swig_Import_Export "Example" # @ref swig_Import_Export "Example"
def Import(self,theFileName, theFormatName): def ImportFile(self,theFileName, theFormatName):
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.InsertOp.Import(theFileName, theFormatName) anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
RaiseIfFailed("Import", self.InsertOp) RaiseIfFailed("Import", self.InsertOp)
return anObj return anObj
## Shortcut to Import() for BREP format ## Deprecated analog of ImportFile
def Import(self,theFileName, theFormatName):
print "WARNING: Function Import is deprecated, use ImportFile instead"
anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
RaiseIfFailed("Import", self.InsertOp)
return anObj
## Shortcut to ImportFile() for BREP format
# #
# @ref swig_Import_Export "Example" # @ref swig_Import_Export "Example"
def ImportBREP(self,theFileName): def ImportBREP(self,theFileName):
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
return self.Import(theFileName, "BREP") return self.ImportFile(theFileName, "BREP")
## Shortcut to Import() for IGES format ## Shortcut to ImportFile() for IGES format
# #
# @ref swig_Import_Export "Example" # @ref swig_Import_Export "Example"
def ImportIGES(self,theFileName): def ImportIGES(self,theFileName):
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
return self.Import(theFileName, "IGES") return self.ImportFile(theFileName, "IGES")
## Return length unit from given IGES file ## Return length unit from given IGES file
# #
# @ref swig_Import_Export "Example" # @ref swig_Import_Export "Example"
def GetIGESUnit(self,theFileName): def GetIGESUnit(self,theFileName):
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.InsertOp.Import(theFileName, "IGES_UNIT") anObj = self.InsertOp.ImportFile(theFileName, "IGES_UNIT")
#RaiseIfFailed("Import", self.InsertOp) #RaiseIfFailed("Import", self.InsertOp)
# recieve name using returned vertex # recieve name using returned vertex
UnitName = "M" UnitName = "M"
@ -3779,12 +3786,12 @@ class geompyDC(GEOM._objref_GEOM_Gen):
UnitName = "MM" UnitName = "MM"
return UnitName return UnitName
## Shortcut to Import() for STEP format ## Shortcut to ImportFile() for STEP format
# #
# @ref swig_Import_Export "Example" # @ref swig_Import_Export "Example"
def ImportSTEP(self,theFileName): def ImportSTEP(self,theFileName):
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
return self.Import(theFileName, "STEP") return self.ImportFile(theFileName, "STEP")
## Export the given shape into a file with given name. ## Export the given shape into a file with given name.
# @param theObject Shape to be stored in the file. # @param theObject Shape to be stored in the file.

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GroupGUI_GroupDlg.cxx // File : GroupGUI_GroupDlg.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#include "GroupGUI_GroupDlg.h" #include "GroupGUI_GroupDlg.h"
#include <DlgRef.h> #include <DlgRef.h>

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : GroupGUI_GroupDlg.h // File : GroupGUI_GroupDlg.h
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
//
#ifndef GROUPGUI_GROUPDLG_H #ifndef GROUPGUI_GROUPDLG_H
#define GROUPGUI_GROUPDLG_H #define GROUPGUI_GROUPDLG_H
@ -81,6 +80,7 @@ private slots:
private: private:
void Init(); void Init();
void enterEvent (QEvent*); void enterEvent (QEvent*);
int subSelectionWay() const; int subSelectionWay() const;
TopAbs_ShapeEnum getShapeType() const; TopAbs_ShapeEnum getShapeType() const;
void setShapeType (const TopAbs_ShapeEnum); void setShapeType (const TopAbs_ShapeEnum);