]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0023125: EDF 11112 GEOM: Choose the unity of length when exporting to STEP
authorskv <skv@opencascade.com>
Mon, 7 Dec 2015 12:38:50 +0000 (15:38 +0300)
committerskv <skv@opencascade.com>
Mon, 7 Dec 2015 12:38:50 +0000 (15:38 +0300)
15 files changed:
idl/STEPPlugin.idl
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_SWIG/STEPPluginBuilder.py
src/STEPPlugin/CMakeLists.txt
src/STEPPlugin/STEPPlugin_ExportDlg.cxx [new file with mode: 0644]
src/STEPPlugin/STEPPlugin_ExportDlg.h [new file with mode: 0644]
src/STEPPlugin/STEPPlugin_ExportDriver.cxx
src/STEPPlugin/STEPPlugin_GUI.cxx
src/STEPPlugin/STEPPlugin_IECallBack.cxx [changed mode: 0755->0644]
src/STEPPlugin/STEPPlugin_IExport.hxx
src/STEPPlugin/STEPPlugin_IOperations.cxx
src/STEPPlugin/STEPPlugin_IOperations.hxx
src/STEPPlugin/STEPPlugin_IOperations_i.cc
src/STEPPlugin/STEPPlugin_IOperations_i.hh
src/STEPPlugin/STEPPlugin_msg_en.ts

index 083016fab291b271a8764e92154d407214a5d1e3..ba1a74ec8b919b16a24be4c6d81adf3e95868766 100644 (file)
 
 module GEOM
 {
+  /*!
+   *  \brief Units of length
+   */
+  enum length_unit
+  {
+    LU_INCH,
+    LU_MILLIMETER,
+    LU_FOOT,
+    LU_MILE,
+    LU_METER,
+    LU_KILOMETER,
+    LU_MILLIINCH,
+    LU_MICROMETER,
+    LU_CENTIMETER,
+    LU_MICROINCH
+  };
+
   /*!
    *  \brief Interface for STEPPlugin modeling functions.
    */
@@ -34,9 +51,11 @@ module GEOM
      *
      *  \param theObject Shape to be stored in the file.
      *  \param theFileName Name of the file to store the given shape in.
+     *  \param theUnit the length unit.
      */
     void ExportSTEP( in GEOM::GEOM_Object theObject, 
-                     in string            theFileName );
+                     in string            theFileName,
+                     in GEOM::length_unit theUnit);
       
     /*!
      *  \brief Import a shape from the STEP file.
index 449a3c6b8ae3c8a325ed2c5459ccc3952ffbdee1..662b2c76894adc3b0ed7a71bda8a0135934908eb 100644 (file)
@@ -3563,7 +3563,10 @@ void GEOM_Superv_i::ExportSTEP( GEOM::GEOM_Object_ptr theObject,
   beginService( " GEOM_Superv_i::ExportSTEP" );
   MESSAGE("GEOM_Superv_i::ExportSTEP");
   getSTEPPluginOp();
-  mySTEPOp->ExportSTEP( theObject, theFileName );
+
+  const GEOM::length_unit aUnit = GEOM::LU_METER;
+
+  mySTEPOp->ExportSTEP( theObject, theFileName, aUnit );
   endService( " GEOM_Superv_i::ExportSTEP" );
 }
 
index 5501013f60e6747ff59d7053d7b59372449e6fbf..1ee4fc6c79a8d9f6c62150d482e1e682807e6400 100644 (file)
@@ -19,6 +19,7 @@
 #
 
 from GEOM import ISTEPOperations
+import GEOM
 
 # Engine Library Name
 __libraryName__ = "STEPPluginEngine"
@@ -30,17 +31,19 @@ def GetSTEPPluginOperations(self):
 ## Export the given shape into a file with given name in STEP format.
 #  @param theObject Shape to be stored in the file.
 #  @param theFileName Name of the file to store the given shape in.
+#  @param theUnit the length unit (see GEOM::length_unit). In meters by default.
 #  @ingroup l2_import_export
-def ExportSTEP(self, theObject, theFileName):
+def ExportSTEP(self, theObject, theFileName, theUnit=GEOM.LU_METER):
     """
     Export the given shape into a file with given name in STEP format.
 
     Parameters: 
         theObject Shape to be stored in the file.
         theFileName Name of the file to store the given shape in.
+        theUnit the length unit (see GEOM::length_unit). In meters by default.
     """
     anOp = GetSTEPPluginOperations(self)
-    anOp.ExportSTEP(theObject, theFileName)
+    anOp.ExportSTEP(theObject, theFileName, theUnit)
     if anOp.IsDone() == 0:
         raise RuntimeError,  "Export : " + anOp.GetErrorCode()
         pass
index 513f54a7487449ef3737f894a5f6a38b05745708..52d210920ba3c99563119c727f7385448699c791 100644 (file)
@@ -95,6 +95,7 @@ SET(STEPPluginEngine_HEADERS
   STEPPlugin_IExport.hxx 
   STEPPlugin_IImport.hxx
   STEPPlugin_ImportDriver.hxx 
+  STEPPlugin_ExportDlg.h
   STEPPlugin_ExportDriver.hxx
   STEPPlugin_IECallBack.hxx
   )
@@ -103,6 +104,7 @@ IF(SALOME_BUILD_GUI)
   # header files / to be processed by moc
   SET(_moc_HEADERS
     STEPPlugin_GUI.h
+    STEPPlugin_ExportDlg.h
     )
 ENDIF()
 
@@ -114,6 +116,7 @@ IF(SALOME_BUILD_GUI)
 
   SET(STEPPluginGUI_SOURCES
     STEPPlugin_GUI.cxx
+    STEPPlugin_ExportDlg.cxx
     ${_moc_SOURCES}
     )
 ENDIF()
diff --git a/src/STEPPlugin/STEPPlugin_ExportDlg.cxx b/src/STEPPlugin/STEPPlugin_ExportDlg.cxx
new file mode 100644 (file)
index 0000000..2f8124b
--- /dev/null
@@ -0,0 +1,109 @@
+// Copyright (C) 2014-2015  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, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "STEPPlugin_ExportDlg.h"
+
+#include <QApplication>
+#include <QLabel>
+#include <QLayout>
+#include <QComboBox>
+
+//=============================================================================
+// Constructor
+//=============================================================================
+STEPPlugin_ExportDlg::STEPPlugin_ExportDlg(QWidget *parent)
+  : SUIT_FileDlg (parent, false, true, true),
+    myUnitCB     (0)
+{
+  QLabel* aUnitLabel = new QLabel(tr("STEP_LENGTH_UNITS"), this);
+
+  myUnitCB = new QComboBox(this);
+  myUnitCB->addItem(tr("STEP_UNITS_KILOMETER"),  GEOM::LU_KILOMETER);
+  myUnitCB->addItem(tr("STEP_UNITS_METER"),      GEOM::LU_METER);
+  myUnitCB->addItem(tr("STEP_UNITS_CENTIMETER"), GEOM::LU_CENTIMETER);
+  myUnitCB->addItem(tr("STEP_UNITS_MILLIMETER"), GEOM::LU_MILLIMETER);
+  myUnitCB->addItem(tr("STEP_UNITS_MICROMETER"), GEOM::LU_MICROMETER);
+  myUnitCB->addItem(tr("STEP_UNITS_MILE"),       GEOM::LU_MILE);
+  myUnitCB->addItem(tr("STEP_UNITS_FOOT"),       GEOM::LU_FOOT);
+  myUnitCB->addItem(tr("STEP_UNITS_INCH"),       GEOM::LU_INCH);
+  myUnitCB->addItem(tr("STEP_UNITS_MILLIINCH"),  GEOM::LU_MILLIINCH);
+  myUnitCB->addItem(tr("STEP_UNITS_MICROINCH"),  GEOM::LU_MICROINCH);
+
+  // Meters by default.
+  myUnitCB->setCurrentIndex(1);
+
+  layout()->addWidget(aUnitLabel);
+  layout()->addWidget(myUnitCB);
+}
+
+//=============================================================================
+// Destructor
+//=============================================================================
+STEPPlugin_ExportDlg::~STEPPlugin_ExportDlg()
+{
+}
+
+//=============================================================================
+// getUnits
+//=============================================================================
+GEOM::length_unit STEPPlugin_ExportDlg::getUnits() const
+{
+  const GEOM::length_unit anUnit =
+    (GEOM::length_unit) myUnitCB->itemData(myUnitCB->currentIndex()).toInt();
+
+  return anUnit;
+}
+
+//=============================================================================
+// getFileName
+//=============================================================================
+QString STEPPlugin_ExportDlg::getFileName(const QString           &theInitial,
+                                          const QString           &theFilters,
+                                                     const QString           &theCaption,
+                                                QWidget           *theParent,
+                                                GEOM::length_unit &theUnits)
+{
+  QStringList aFls         = theFilters.split(";;", QString::SkipEmptyParts);
+  QString     aTmpFileName = theInitial;
+
+  aTmpFileName = aTmpFileName.simplified();
+  aTmpFileName =
+    aTmpFileName.replace(QRegExp("\\*"), "").replace(QRegExp("\\?"), "");
+
+  STEPPlugin_ExportDlg aDlg(theParent);
+
+  aDlg.setFileMode(AnyFile);
+  aDlg.setFilters(aFls);
+  aDlg.setWindowTitle(theCaption);
+
+  if (!aTmpFileName.isEmpty()) {
+    aDlg.processPath(aTmpFileName);
+  }
+
+  QString aFileName;
+
+  if (aDlg.exec() == QDialog::Accepted) {
+    aFileName = aDlg.selectedFile();
+    theUnits  = aDlg.getUnits();
+  }
+
+  QApplication::processEvents();
+
+  return aFileName;
+}
diff --git a/src/STEPPlugin/STEPPlugin_ExportDlg.h b/src/STEPPlugin/STEPPlugin_ExportDlg.h
new file mode 100644 (file)
index 0000000..d310484
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2014-2015  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, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef STEPPlugin_ExportDlg_H
+#define STEPPlugin_ExportDlg_H
+
+#include <SUIT_FileDlg.h>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(STEPPlugin)
+
+class QComboBox;
+
+class STEPPlugin_ExportDlg: public SUIT_FileDlg
+{
+  Q_OBJECT
+
+public:
+
+  STEPPlugin_ExportDlg(QWidget *parent);
+  ~STEPPlugin_ExportDlg();
+
+  GEOM::length_unit getUnits() const;
+
+  static QString getFileName(const QString           &theInitial,
+                             const QString           &theFilters,
+                                        const QString           &theCaption,
+                                   QWidget           *theParent,
+                                   GEOM::length_unit &theUnits);
+
+private:
+
+  QComboBox *myUnitCB;
+
+};
+
+#endif // STEPPlugin_ExportDlg_H
index 8f5f0db18ca296283bd5fe79cb4015af3fcb97df..0adef6012efb030daa63b2be55395a85e2a01b17 100644 (file)
@@ -20,6 +20,7 @@
 // internal includes
 #include "STEPPlugin_ExportDriver.hxx"
 #include "STEPPlugin_IExport.hxx"
+#include "STEPPlugin_IOperations.hxx"
 
 // KERNEL includes
 #include <utilities.h>
@@ -74,6 +75,43 @@ Standard_Integer STEPPlugin_ExportDriver::Execute( TFunction_Logbook& log ) cons
   aFunction->SetValue( aShape );
 
   TCollection_AsciiString aFileName = aData.GetFileName();
+  Standard_Integer        anUnit    = aData.GetUnit();
+  TCollection_AsciiString aWriteUnit;
+
+  switch (anUnit) {
+  case STEPPlugin_IOperations::LengthUnit_Inch:
+    aWriteUnit = "INCH";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Millimeter:
+    aWriteUnit = "MM";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Foot:
+    aWriteUnit = "FT";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Mile:
+    aWriteUnit = "MI";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Meter:
+    aWriteUnit = "M";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Kilometer:
+    aWriteUnit = "KM";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Milliinch:
+    aWriteUnit = "MIL";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Micrometer:
+    aWriteUnit = "UM";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Centimeter:
+    aWriteUnit = "CM";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Microinch:
+    aWriteUnit = "UIN";
+    break;
+  default:
+    return 0;
+  }
 
   MESSAGE("Export STEP into file " << aFileName.ToCString());
 
@@ -86,7 +124,7 @@ Standard_Integer STEPPlugin_ExportDriver::Execute( TFunction_Logbook& log ) cons
     //VRV: OCC 4.0 migration
     STEPControl_Writer aWriter;
     Interface_Static::SetCVal("xstep.cascade.unit","M");
-    Interface_Static::SetCVal("write.step.unit", "M");
+    Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
     Interface_Static::SetIVal("write.step.nonmanifold", 1);
     status = aWriter.Transfer( aShape, STEPControl_AsIs );
     //VRV: OCC 4.0 migration
index c8f0300e33ece8f43c8eb288f5847bca57cdf8c2..5543266d7845b41240aee421f25afd0948132210 100644 (file)
@@ -37,6 +37,7 @@
 #include "GEOMBase.h"
 #include "GEOM_Displayer.h"
 #include "GEOM_GenericObjPtr.h"
+#include "STEPPlugin_ExportDlg.h"
 
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(STEPPlugin)
@@ -250,11 +251,12 @@ bool STEPPlugin_GUI::exportSTEP( SUIT_Desktop* parent )
     
     if ( CORBA::is_nil( obj ) ) continue;
     
-    QString fileName = app->getFileName( false,
-                                        QString( io->getName() ),
+    GEOM::length_unit anUnit;
+    QString fileName = STEPPlugin_ExportDlg::getFileName
+                                       (QString( io->getName() ),
                                         tr( "STEP_FILES" ),
                                         tr( "EXPORT_TITLE" ),
-                                        parent );
+                                        parent, anUnit);
     
     if ( fileName.isEmpty() )
       return false;
@@ -268,7 +270,7 @@ bool STEPPlugin_GUI::exportSTEP( SUIT_Desktop* parent )
       app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) );
       transaction.start();
       
-      stepOp->ExportSTEP( obj, fileName.toUtf8().constData() );
+      stepOp->ExportSTEP( obj, fileName.toUtf8().constData(), anUnit);
       
       if ( stepOp->IsDone() )
       {
old mode 100755 (executable)
new mode 100644 (file)
index bc5c0ff..ac08697
@@ -52,7 +52,9 @@ STEPPlugin_IECallBack::Export( int                            theDocId,
                               const TCollection_AsciiString& theFormatName )
 {
   STEPPlugin_IOperations* aPluginOperations = STEPPlugin_OperationsCreator::get( GetEngine(), theDocId );
-  aPluginOperations->ExportSTEP( theOriginal, theFileName );
+  const STEPPlugin_IOperations::LengthUnit aUnit = STEPPlugin_IOperations::LengthUnit_Meter;
+
+  aPluginOperations->ExportSTEP( theOriginal, theFileName, aUnit );
   return true;
 }
 
index 020b573adf3136321bab6d6248911d98c8d17ee7..77f01392b3d2808c8bc8449fcdca6eae8ac252f1 100644 (file)
@@ -24,6 +24,7 @@
 
 #define EXPORTSTEP_ARG_ORIGINAL   1
 #define EXPORTSTEP_ARG_FILENAME   2
+#define EXPORTSTEP_ARG_UNIT       3
 
 class STEPPlugin_IExport
 {
@@ -40,6 +41,11 @@ public:
     { _func->SetString( EXPORTSTEP_ARG_FILENAME, theFileName ); }
   TCollection_AsciiString GetFileName()
     { return _func->GetString( EXPORTSTEP_ARG_FILENAME ); }
+
+  void SetUnit(const Standard_Integer theUnit)
+  { _func->SetInteger(EXPORTSTEP_ARG_UNIT, theUnit); }
+  Standard_Integer GetUnit()
+  { return _func->GetInteger(EXPORTSTEP_ARG_UNIT); }
   
 private:
   Handle(GEOM_Function) _func;
index 86d1055e38d050200e17630832dde2ed70840fce..72064e8e3027fb780a0dd0518e3babec2d149d95 100644 (file)
@@ -54,18 +54,66 @@ STEPPlugin_IOperations::~STEPPlugin_IOperations()
   MESSAGE( "STEPPlugin_IOperations::~STEPPlugin_IOperations" );
 }
 
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+static GEOM::TPythonDump& operator<<
+          (GEOM::TPythonDump                        &theDump,
+           const STEPPlugin_IOperations::LengthUnit  theState)
+{
+  switch (theState) {
+  case STEPPlugin_IOperations::LengthUnit_Inch:
+    theDump << "GEOM.LU_INCH";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Millimeter:
+    theDump << "GEOM.LU_MILLIMETER";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Foot:
+    theDump << "GEOM.LU_FOOT";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Mile:
+    theDump << "GEOM.LU_MILE";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Meter:
+    theDump << "GEOM.LU_METER";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Kilometer:
+    theDump << "GEOM.LU_KILOMETER";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Milliinch:
+    theDump << "GEOM.LU_MILLIINCH";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Micrometer:
+    theDump << "GEOM.LU_MICROMETER";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Centimeter:
+    theDump << "GEOM.LU_CENTIMETER";
+    break;
+  case STEPPlugin_IOperations::LengthUnit_Microinch:
+    theDump << "GEOM.LU_MICROINCH";
+    break;
+  default:
+    break;
+  }
+
+  return theDump;
+}
+
 //=============================================================================
 /*!
  *  ExportSTEP
  *  Export a shape to STEP format
  *  \param theOriginal The shape to export
  *  \param theFileName The name of the file to exported
- *  \param theIsASCII The format of the exported file (ASCII or Binary)
- *  \param theDeflection The deflection of the shape to exported
+ *  \param theUnit the length unit
  */
 //=============================================================================
-void STEPPlugin_IOperations::ExportSTEP( const Handle(GEOM_Object)      theOriginal,
-                                        const TCollection_AsciiString& theFileName )
+void STEPPlugin_IOperations::ExportSTEP
+                    (const Handle(GEOM_Object)      theOriginal,
+                     const TCollection_AsciiString &theFileName,
+                     const LengthUnit               theUnit)
 {
   SetErrorCode(KO);
   if( theOriginal.IsNull() ) return;
@@ -87,6 +135,7 @@ void STEPPlugin_IOperations::ExportSTEP( const Handle(GEOM_Object)      theOrigi
   STEPPlugin_IExport aCI( aFunction );
   aCI.SetOriginal( aRefFunction );
   aCI.SetFileName( theFileName );
+  aCI.SetUnit( theUnit );
 
   //Perform the Export
   try {
@@ -104,7 +153,7 @@ void STEPPlugin_IOperations::ExportSTEP( const Handle(GEOM_Object)      theOrigi
 
   //Make a Python command
   GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \""
-    << theFileName.ToCString() << "\" )";
+    << theFileName.ToCString() << "\", " << theUnit << " )";
 
   SetErrorCode(OK);
 }
index ca81fac29c0d04e1842c8ba365e5b9df73d5b3ed..92b3f160e78430fde83aa5b926f8557f17890de6 100644 (file)
 
 class STEPPLUGINENGINE_EXPORT STEPPlugin_IOperations: public GEOMImpl_IBaseIEOperations
 {
+
+public:
+
+  /*!
+   *  \brief Units of length
+   */
+  enum LengthUnit
+  {
+    LengthUnit_Inch,
+    LengthUnit_Millimeter,
+    LengthUnit_Foot,
+    LengthUnit_Mile,
+    LengthUnit_Meter,
+    LengthUnit_Kilometer,
+    LengthUnit_Milliinch,
+    LengthUnit_Micrometer,
+    LengthUnit_Centimeter,
+    LengthUnit_Microinch
+  };
+
+
 public:
   STEPPlugin_IOperations( GEOM_Engine*, int );
   ~STEPPlugin_IOperations();
 
   void ExportSTEP( const Handle(GEOM_Object),
-                  const TCollection_AsciiString& );
+                  const TCollection_AsciiString&, const LengthUnit );
   
   Handle(TColStd_HSequenceOfTransient) ImportSTEP( const TCollection_AsciiString&,
                                                   const bool );
index 7eeee1a944be4b248bacc8a2f0176a9ea42dd99a..fba3ce031e4fd7c2a2ea5d0cf282d4dde8df3daa 100644 (file)
@@ -53,10 +53,12 @@ STEPPlugin_IOperations_i::~STEPPlugin_IOperations_i()
  *  Export a shape to STEP format
  *  \param theOriginal The shape to export
  *  \param theFileName The name of the exported file
+ *  \param theUnit the length unit.
  */
 //=============================================================================
-void STEPPlugin_IOperations_i::ExportSTEP( GEOM::GEOM_Object_ptr theOriginal,
-                                          const char*           theFileName )
+void STEPPlugin_IOperations_i::ExportSTEP(GEOM::GEOM_Object_ptr theOriginal,
+                                          const char*           theFileName,
+                                          GEOM::length_unit     theUnit)
 {
   // duplicate the original shape
   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate( theOriginal );
@@ -68,8 +70,45 @@ void STEPPlugin_IOperations_i::ExportSTEP( GEOM::GEOM_Object_ptr theOriginal,
   Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal );
   if (anOriginal.IsNull()) return;
 
+  STEPPlugin_IOperations::LengthUnit aUnit;
+
+  switch (theUnit) {
+  case GEOM::LU_INCH:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Inch;
+    break;
+  case GEOM::LU_MILLIMETER:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Millimeter;
+    break;
+  case GEOM::LU_FOOT:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Foot;
+    break;
+  case GEOM::LU_MILE:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Mile;
+    break;
+  case GEOM::LU_METER:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Meter;
+    break;
+  case GEOM::LU_KILOMETER:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Kilometer;
+    break;
+  case GEOM::LU_MILLIINCH:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Milliinch;
+    break;
+  case GEOM::LU_MICROMETER:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Micrometer;
+    break;
+  case GEOM::LU_CENTIMETER:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Centimeter;
+    break;
+  case GEOM::LU_MICROINCH:
+    aUnit = STEPPlugin_IOperations::LengthUnit_Microinch;
+    break;
+  default:
+    return;
+  }
+
   //Export the shape to the file
-  GetOperations()->ExportSTEP( anOriginal, theFileName );
+  GetOperations()->ExportSTEP( anOriginal, theFileName, aUnit );
 }
 
 //=============================================================================
index e2c51c79a396c5e275dc8101b573082b974df85c..16e000909c8b134ce81573a3bd0640a06e789606 100644 (file)
@@ -43,7 +43,8 @@ public:
                            STEPPlugin_IOperations* theImpl );
   ~STEPPlugin_IOperations_i();
 
-  void            ExportSTEP( GEOM::GEOM_Object_ptr, const char* );
+  void            ExportSTEP( GEOM::GEOM_Object_ptr, const char*,
+                              GEOM::length_unit );
   GEOM::ListOfGO* ImportSTEP( const char*, const bool );
   char*           ReadValue( const char*, const char* );
 
index d24fc901469340d145f11cebcbafc8d7cf471f03..47d15c8f83ad0a3a55948f13613d4afd92fe57c3 100644 (file)
 Ignoring units will cause model scaling (as dimensions are supposed to be specified in meters).</translation>
     </message>
 </context>
+<context>
+    <name>STEPPlugin_ExportDlg</name>
+    <message>
+        <source>STEP_LENGTH_UNITS</source>
+        <translation>Length units</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_INCH</source>
+        <translation>inch</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_MILLIMETER</source>
+        <translation>millimeter</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_FOOT</source>
+        <translation>foot</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_MILE</source>
+        <translation>mile</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_METER</source>
+        <translation>meter</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_KILOMETER</source>
+        <translation>kilometer</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_MILLIINCH</source>
+        <translation>milliinch</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_MICROMETER</source>
+        <translation>micrometer</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_CENTIMETER</source>
+        <translation>centimeter</translation>
+    </message>
+    <message>
+        <source>STEP_UNITS_MICROINCH</source>
+        <translation>microinch</translation>
+    </message>
+</context>
 </TS>