+ aCurrentType = fileType;
+ }
+
+ if ( aCurrentType.isEmpty() ) {
+ errors.append( QString( "%1 : %2" ).arg( fileName ).arg( tr( "GEOM_UNSUPPORTED_TYPE" ) ) );
+ continue;
+ }
+
+ GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
+ try {
+ app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( fileName, /*withExten=*/true ) ) );
+ anOp->start();
+
+ CORBA::String_var fileN = fileName.toLatin1().constData();
+ CORBA::String_var fileT = aCurrentType.toLatin1().constData();
+
+ // jfa 21.08.2012 for mantis issue 21511 (STEP file units)
+ CORBA::String_var aUnits = aInsOp->ReadValue(fileN, fileT, "LEN_UNITS");
+ TCollection_AsciiString aUnitsStr (aUnits.in());
+ bool needConvert = true;
+ if (aUnitsStr.IsEmpty() || aUnitsStr == "UNIT_M")
+ needConvert = false;
+
+ if (needConvert) {
+ if (igesAnswer == SUIT_MessageBox::NoToAll) {
+ // converting for all files is already approved
+ fileT = (aCurrentType + "_SCALE").toLatin1().constData();
+ }
+ else if (igesAnswer != SUIT_MessageBox::YesToAll) {
+ SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
+ if (i < fileNames.count() - 1) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
+ igesAnswer = SUIT_MessageBox::question(app->desktop(),
+ "Question",//tr("WRN_WARNING"),
+ tr("GEOM_SCALE_DIMENSIONS"),
+ btns | SUIT_MessageBox::Cancel,
+ SUIT_MessageBox::No);
+ switch (igesAnswer) {
+ case SUIT_MessageBox::Cancel:
+ return false; // cancel (break) import operation
+ case SUIT_MessageBox::Yes:
+ case SUIT_MessageBox::YesToAll:
+ break; // scaling is confirmed
+ case SUIT_MessageBox::No:
+ case SUIT_MessageBox::NoAll:
+ fileT = (aCurrentType + "_SCALE").toLatin1().constData();
+ default:
+ break; // scaling is rejected
+ } // switch ( igesAnswer )
+ } // if ( igeAnswer != NoToAll )
+ } // if ( needConvert )
+
+ /*
+ // skl 29.05.2009
+ if ( aCurrentType == "IGES" ) {
+ GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, "IGES_UNIT" );
+ bool needConvert = false;
+ TCollection_AsciiString aUnitName = aInsOp->GetErrorCode();
+ if ( aUnitName.SubString( 1, 4 ) == "UNIT" )
+ needConvert = aUnitName.SubString( 6, aUnitName.Length() ) != "M";
+
+ if ( needConvert ) {
+ if ( igesAnswer == SUIT_MessageBox::NoToAll ) {
+ // converting for all files is already approved
+ fileT = "IGES_SCALE";
+ }
+ else if ( igesAnswer != SUIT_MessageBox::YesToAll ) {
+ SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
+ if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
+ igesAnswer = SUIT_MessageBox::question( app->desktop(),
+ "Question",//tr("WRN_WARNING"),
+ tr("GEOM_SCALE_DIMENSIONS"),
+ btns | SUIT_MessageBox::Cancel,
+ SUIT_MessageBox::No );
+ switch ( igesAnswer ) {
+ case SUIT_MessageBox::Cancel:
+ return false; // cancel (break) import operation
+ case SUIT_MessageBox::Yes:
+ case SUIT_MessageBox::YesToAll:
+ break; // scaling is confirmed
+ case SUIT_MessageBox::No:
+ case SUIT_MessageBox::NoAll:
+ fileT = "IGES_SCALE";
+ default:
+ break; // scaling is rejected
+ } // switch ( igesAnswer )
+ } // if ( igeAnswer != NoToAll )
+ } // if ( needConvert )
+ } // if ( aCurrentType == "IGES" )
+ else if ( aCurrentType == "ACIS" ) {
+ */
+
+ if ( aCurrentType == "ACIS" ) {
+ if ( acisAnswer != SUIT_MessageBox::YesToAll && acisAnswer != SUIT_MessageBox::NoToAll ) {
+ SUIT_MessageBox::StandardButtons btns = SUIT_MessageBox::Yes | SUIT_MessageBox::No;
+ if ( i < fileNames.count()-1 ) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
+ acisAnswer = SUIT_MessageBox::question( app->desktop(),
+ "Question",//tr("WRN_WARNING"),
+ tr("GEOM_PUBLISH_NAMED_SHAPES"),
+ btns | SUIT_MessageBox::Cancel,
+ SUIT_MessageBox::No );
+ if ( acisAnswer == SUIT_MessageBox::Cancel )
+ return false; // cancel (break) import operation
+ } // if ( acisAnswer != YesToAll && acisAnswer != NoToAll )
+ } // else if ( aCurrentType == "ACIS" )
+
+ // IMPORT
+ GEOM::GEOM_Object_var anObj = aInsOp->ImportFile( fileN, fileT );
+
+ if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
+ QString aPublishObjName =
+ GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, /*withExten=*/true ) );
+
+ SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy );
+ SALOMEDS::SObject_var aSO =
+ GeometryGUI::GetGeomGen()->PublishInStudy( aDSStudy,
+ SALOMEDS::SObject::_nil(),
+ anObj,
+ aPublishObjName.toLatin1().constData() );
+ if ( ( !aSO->_is_nil() ) )
+ anEntryList.append( aSO->GetID() );
+
+ objsForDisplay.append( anObj );
+
+ if ( aCurrentType == "ACIS" ) {
+ if ( acisAnswer == SUIT_MessageBox::Yes || acisAnswer == SUIT_MessageBox::YesToAll )
+ GeometryGUI::GetGeomGen()->PublishNamedShapesInStudy( aDSStudy, anObj );
+ }
+
+ anOp->commit();
+ }
+ else {
+ anOp->abort();
+ errors.append( QString( "%1 : %2" ).arg( fileName ).arg( aInsOp->GetErrorCode() ) );
+ }
+ }
+ catch( const SALOME::SALOME_Exception& S_ex ) {