mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
0023125: EDF 11112 GEOM: Choose the unity of length when exporting to STEP
This commit is contained in:
parent
f83b8bcd3a
commit
80a0257573
@ -24,6 +24,23 @@
|
||||
|
||||
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.
|
||||
|
@ -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" );
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
109
src/STEPPlugin/STEPPlugin_ExportDlg.cxx
Normal file
109
src/STEPPlugin/STEPPlugin_ExportDlg.cxx
Normal file
@ -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;
|
||||
}
|
52
src/STEPPlugin/STEPPlugin_ExportDlg.h
Normal file
52
src/STEPPlugin/STEPPlugin_ExportDlg.h
Normal file
@ -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
|
@ -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
|
||||
|
@ -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() )
|
||||
{
|
||||
|
4
src/STEPPlugin/STEPPlugin_IECallBack.cxx
Executable file → Normal file
4
src/STEPPlugin/STEPPlugin_IECallBack.cxx
Executable file → Normal file
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -29,12 +29,33 @@
|
||||
|
||||
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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -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* );
|
||||
|
||||
|
@ -48,4 +48,51 @@
|
||||
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>
|
||||
|
Loading…
Reference in New Issue
Block a user