(void)theWS;
if (theDocument.IsNull())
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
- thePath << "\t: theDocument shouldn't be null";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : "
+ << "Null document";
return false;
}
TopoDS_Shape aShape;
{
return false;
}
- Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
+ Handle(XCAFDoc_ShapeTool) aShTool =
+ XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShTool->AddShape(aShape);
return true;
}
(void)theWS;
TopoDS_Shape aShape;
TDF_LabelSequence aLabels;
- Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
+ Handle(XCAFDoc_ShapeTool) aSTool =
+ XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aSTool->GetFreeShapes(aLabels);
if (aLabels.Length() <= 0)
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Document contain no shapes";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
bool isBinaryFormat = true;
{
// probe file header to recognize format
- const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
- std::shared_ptr<std::istream> aFile = aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
+ const Handle(OSD_FileSystem)& aFileSystem =
+ OSD_FileSystem::DefaultFileSystem();
+ std::shared_ptr<std::istream> aFile =
+ aFileSystem->OpenIStream(thePath, std::ios::in | std::ios::binary);
if (aFile.get() == NULL)
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
- thePath << "\t: Cannot read the file";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Cannot open the file";
return false;
}
-
char aStringBuf[255] = {};
aFile->read(aStringBuf, 255);
if (aFile->fail())
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
- thePath << "\t: Cannot read the file";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Cannot open the file";
return false;
}
isBinaryFormat = !(::strncmp(aStringBuf, "DBRep_DrawableShape", 19) == 0);
}
-
+ Standard_Boolean aReadStatus = Standard_True;
if (isBinaryFormat)
{
- if (!BinTools::Read(theShape, thePath.ToCString(), theProgress))
- {
- Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
- thePath << "\t: Cannot read from the file";
- return false;
- }
+ aReadStatus = BinTools::Read(theShape, thePath.ToCString(), theProgress);
}
else
{
- if (!BRepTools::Read(theShape, thePath.ToCString(), BRep_Builder(), theProgress))
- {
- Message::SendFail() << "Error in the DEBRepCascade_Provider during reading the file " <<
- thePath << "\t: Cannot read from the file";
- return false;
- }
+ aReadStatus =
+ BRepTools::Read(theShape, thePath.ToCString(), BRep_Builder(), theProgress);
}
-
- return true;
+ if (!aReadStatus)
+ {
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Cannot read data from the file";
+ }
+ return aReadStatus;
}
//=======================================================================
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(DEBRepCascade_ConfigurationNode)))
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(DEBRepCascade_ConfigurationNode) aNode = Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
+ Handle(DEBRepCascade_ConfigurationNode) aNode =
+ Handle(DEBRepCascade_ConfigurationNode)::DownCast(GetNode());
if (aNode->InternalParameters.WriteBinary)
{
- if (aNode->InternalParameters.WriteVersionBin > static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||
- aNode->InternalParameters.WriteVersionBin < static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_LOWER))
+ if (aNode->InternalParameters.WriteVersionBin >
+ static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_UPPER) ||
+ aNode->InternalParameters.WriteVersionBin <
+ static_cast<BinTools_FormatVersion>(BinTools_FormatVersion_LOWER))
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Unknown format version";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Unknown format version";
return false;
}
if (aNode->InternalParameters.WriteNormals &&
aNode->InternalParameters.WriteVersionBin < BinTools_FormatVersion_VERSION_4)
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Vertex normals require binary format version 4 or later";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Vertex normals require binary format version 4 or later";
return false;
}
- if (!BinTools::Write(theShape, thePath.ToCString(), aNode->InternalParameters.WriteTriangles,
- aNode->InternalParameters.WriteNormals, aNode->InternalParameters.WriteVersionBin, theProgress))
+ if (!BinTools::Write(theShape, thePath.ToCString(),
+ aNode->InternalParameters.WriteTriangles,
+ aNode->InternalParameters.WriteNormals,
+ aNode->InternalParameters.WriteVersionBin, theProgress))
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Cannot write the file";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Cannot write the file";
return false;
}
}
else
{
- if (aNode->InternalParameters.WriteVersionAscii > static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_UPPER) ||
- aNode->InternalParameters.WriteVersionAscii < static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_LOWER))
+ if (aNode->InternalParameters.WriteVersionAscii >
+ static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_UPPER) ||
+ aNode->InternalParameters.WriteVersionAscii <
+ static_cast<TopTools_FormatVersion>(TopTools_FormatVersion_LOWER))
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Unknown format version";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Unknown format version";
return false;
}
if (aNode->InternalParameters.WriteNormals &&
aNode->InternalParameters.WriteVersionAscii < TopTools_FormatVersion_VERSION_3)
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Error: vertex normals require ascii format version 3 or later";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Vertex normals require ascii format version 3 or later";
return false;
}
- if (!BRepTools::Write(theShape, thePath.ToCString(), aNode->InternalParameters.WriteTriangles,
- aNode->InternalParameters.WriteNormals, aNode->InternalParameters.WriteVersionAscii, theProgress))
+ if (!BRepTools::Write(theShape, thePath.ToCString(),
+ aNode->InternalParameters.WriteTriangles,
+ aNode->InternalParameters.WriteNormals,
+ aNode->InternalParameters.WriteVersionAscii, theProgress))
{
- Message::SendFail() << "Error in the DEBRepCascade_Provider during writing the file " <<
- thePath << "\t: Cannot write the file";
+ Message::SendFail() << "Error: DEBRepCascade_Provider : ["
+ << thePath << "] : Cannot write the file";
return false;
}
}
(void)theWS;
if (theDocument.IsNull())
{
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " <<
- thePath << "\t: theDocument shouldn't be null";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : "
+ << "Null document";
return false;
}
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
{
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
- << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(DEXCAFCascade_ConfigurationNode) aNode = Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
+ Handle(DEXCAFCascade_ConfigurationNode) aNode =
+ Handle(DEXCAFCascade_ConfigurationNode)::DownCast(GetNode());
Handle(TDocStd_Document) aDocument;
Handle(TDocStd_Application) anApp = new TDocStd_Application();
BinDrivers::DefineFormat(anApp);
XmlLDrivers::DefineFormat(anApp);
XmlTObjDrivers::DefineFormat(anApp);
XmlXCAFDrivers::DefineFormat(anApp);
- Handle(PCDM_ReaderFilter) aFilter = new PCDM_ReaderFilter(aNode->InternalParameters.ReadAppendMode);
- for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadSkipValues); anIt.More(); anIt.Next())
+ Handle(PCDM_ReaderFilter) aFilter =
+ new PCDM_ReaderFilter(aNode->InternalParameters.ReadAppendMode);
+ for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadSkipValues);
+ anIt.More(); anIt.Next())
{
aFilter->AddSkipped(anIt.Value());
}
- for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadValues); anIt.More(); anIt.Next())
+ for (TColStd_ListOfAsciiString::Iterator anIt(aNode->InternalParameters.ReadValues);
+ anIt.More(); anIt.Next())
{
if (anIt.Value().StartsWith("0"))
{
if (anApp->Open(thePath, aDocument, aFilter, theProgress) != PCDM_RS_OK)
{
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file : " << thePath
- << "\t: Cannot open XDE document";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Cannot open XDE document";
return false;
}
theDocument->SetData(aDocument->GetData());
}
else if (!theDocument->IsSaved())
{
- Message::SendFail() << "Storage error in the DEXCAFCascade_Provider during writing the file " <<
- thePath << "\t: Storage error : this document has never been saved";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : Document has never been saved";
return false;
}
else
{
aStatus = anApp->Save(theDocument, theProgress);
}
-
switch (aStatus)
{
case PCDM_SS_OK:
return true;
case PCDM_SS_DriverFailure:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error : driver failure";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : driver failure";
break;
case PCDM_SS_WriteFailure:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during the writing the file : " << thePath
- << "\t: Storage error : write failure";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : write failure";
break;
case PCDM_SS_Failure:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error : general failure";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : general failure";
break;
case PCDM_SS_Doc_IsNull:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error :: document is NULL";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : document is NULL";
break;
case PCDM_SS_No_Obj:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error : no object";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : no object";
break;
case PCDM_SS_Info_Section_Error:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error : section error";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : section error";
break;
case PCDM_SS_UserBreak:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error : user break";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : user break";
break;
case PCDM_SS_UnrecognizedFormat:
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during writing the file : " << thePath
- << "\t: Storage error : unrecognized document storage format : " << theDocument->StorageFormat();
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : unrecognized document storage format : "
+ << theDocument->StorageFormat();
break;
}
return false;
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(DEXCAFCascade_ConfigurationNode)))
{
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file " << thePath
- << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
Handle(TDocStd_Document) aDocument;
aSTool->GetFreeShapes(aLabels);
if (aLabels.Length() <= 0)
{
- Message::SendFail() << "Error in the DEXCAFCascade_Provider during reading the file : " << thePath
- << "\t: Document contain no shapes";
+ Message::SendFail() << "Error: DEXCAFCascade_Provider : [" <<
+ thePath << "] : Storage error : Document contain no shapes";
return false;
}
myOldValues.WriteOffsetMode =
Interface_Static::IVal("write.iges.offset.mode") == 1;
- myOldGlobalValues.LengthUnit = Interface_Static::IVal("xstep.cascade.unit");
-
+ myOldGlobalValues.LengthUnit = 0.001 *
+ UnitsMethods::GetLengthFactorValue(Interface_Static::IVal("xstep.cascade.unit"));
// Set new values
- UnitsMethods::SetCasCadeLengthUnit(aNode->GlobalParameters.LengthUnit,
- UnitsMethods_LengthUnit_Millimeter);
TCollection_AsciiString aStrUnit(
- UnitsMethods::DumpLengthUnit(aNode->GlobalParameters.LengthUnit));
+ UnitsMethods::DumpLengthUnit(aNode->GlobalParameters.LengthUnit,
+ UnitsMethods_LengthUnit_Meter));
aStrUnit.UpperCase();
Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
setStatic(aNode->InternalParameters);
{
return;
}
- Interface_Static::SetIVal("xstep.cascade.unit", myOldGlobalValues.LengthUnit);
- UnitsMethods::SetCasCadeLengthUnit(myOldGlobalValues.LengthUnit);
+ // Set new values
+ TCollection_AsciiString aStrUnit(
+ UnitsMethods::DumpLengthUnit(myOldGlobalValues.LengthUnit,
+ UnitsMethods_LengthUnit_Meter));
+ aStrUnit.UpperCase();
+ Interface_Static::SetCVal("xstep.cascade.unit", aStrUnit.ToCString());
setStatic(myOldValues);
}
initStatic(aNode);
personizeWS(theWS);
- XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
- aNode->InternalParameters.WriteUnit,
- UnitsMethods_LengthUnit_Millimeter);
+ TCollection_AsciiString aUnit(
+ UnitsMethods::DumpLengthUnit(aNode->InternalParameters.WriteUnit));
+ aUnit.UpperCase();
+
IGESCAFControl_Writer aWriter(theWS, Standard_True);
+ if (aNode->InternalParameters.WriteUnit > UnitsMethods_LengthUnit_Undefined &&
+ aNode->InternalParameters.WriteUnit <= UnitsMethods_LengthUnit_Microinch)
+ {
+ Handle(IGESData_IGESModel) aModel = aWriter.Model();
+ IGESData_GlobalSection aGSesction = aModel->GlobalSection();
+ Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(
+ IGESData_BasicEditor::UnitFlagName(aNode->InternalParameters.WriteUnit));
+ if (aGSesction.UnitFlag() == 3)
+ {
+ aGSesction.SetUnitName(aName);
+ }
+ else if (aGSesction.UnitFlag() > 0)
+ {
+ aGSesction.SetUnitFlag(aNode->InternalParameters.WriteUnit);
+ }
+ aModel->SetGlobalSection(aGSesction);
+ }
aWriter.SetColorMode(aNode->InternalParameters.WriteColor);
aWriter.SetNameMode(aNode->InternalParameters.WriteName);
aWriter.SetLayerMode(aNode->InternalParameters.WriteLayer);
// function : SetReaderParameters
// purpose :
//=======================================================================
- static void SetReaderParameters(RWGltf_CafReader& theReader, const Handle(RWGltf_ConfigurationNode) theNode)
+ static void SetReaderParameters(RWGltf_CafReader& theReader,
+ const Handle(RWGltf_ConfigurationNode) theNode)
{
theReader.SetDoublePrecision(!theNode->InternalParameters.ReadSinglePrecision);
theReader.SetSystemLengthUnit(theNode->GlobalParameters.LengthUnit / 1000);
(void)theWS;
if (theDocument.IsNull())
{
- Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
- thePath << "\t: theDocument shouldn't be null";
+ Message::SendFail() << "Error: RWGltf_Provider : "
+ << "Null document";
return false;
}
- if (GetNode().IsNull() || (!GetNode().IsNull() && !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode))))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWGltf_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWGltf_ConfigurationNode) aNode =
+ Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWGltf_CafReader aReader;
aReader.SetDocument(theDocument);
SetReaderParameters(aReader, aNode);
- XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
+ XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
+ aNode->GlobalParameters.LengthUnit,
+ UnitsMethods_LengthUnit_Millimeter);
if (!aReader.Perform(thePath, theProgress))
{
- Message::SendFail() << "Error in the RWGltf_Provider during reading the file " << thePath;
+ Message::SendFail() << "Error: RWGltf_Provider : [" <<
+ thePath << "] : Cannot read any relevant data from the GLTF file";
return false;
}
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWGltf_Provider during writing the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWGltf_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWGltf_ConfigurationNode) aNode =
+ Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aWriter.SetSplitIndices16(aNode->InternalParameters.WriteSplitIndices16);
if (!aWriter.Perform(theDocument, aFileInfo, theProgress))
{
- Message::SendFail() << "Error in the RWGltf_Provider during writing the file " << thePath;
+ Message::SendFail() << "Error: RWGltf_Provider : [" <<
+ thePath << "] : Cannot write any relevant data to the GLTF file";
return false;
}
return true;
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWGltf_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWGltf_Provider during reading the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWGltf_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWGltf_ConfigurationNode) aNode = Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWGltf_ConfigurationNode) aNode =
+ Handle(RWGltf_ConfigurationNode)::DownCast(GetNode());
RWGltf_CafReader aReader;
SetReaderParameters(aReader, aNode);
if (!aReader.Perform(thePath, theProgress))
{
- Message::SendFail() << "Error in the RWGltf_Provider during reading the file " << thePath;
+ Message::SendFail() << "Error: RWGltf_Provider : [" <<
+ thePath << "] : Cannot read any relevant data from the GLTF file";
return false;
}
theShape = aReader.SingleShape();
(void)theWS;
if (theDocument.IsNull())
{
- Message::SendFail() << "Error in the RWObj_Provider during reading the file " <<
- thePath << "\t: theDocument shouldn't be null";
+ Message::SendFail() << "Error: RWObj_Provider : "
+ << "Null document";
return false;
}
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWObj_ConfigurationNode during reading the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWObj_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWObj_ConfigurationNode) aNode = Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWObj_ConfigurationNode) aNode =
+ Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
RWObj_CafReader aReader;
aReader.SetSinglePrecision(aNode->InternalParameters.ReadSinglePrecision);
aReader.SetSystemLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aReader.SetMemoryLimitMiB(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aReader.Perform(thePath, theProgress))
{
- Message::SendFail() << "Error in the RWObj_ConfigurationNode during reading the file " << thePath;
+ Message::SendFail() << "Error: RWObj_Provider : [" <<
+ thePath << "] : Cannot read any relevant data from the Obj file";
return false;
}
- XCAFDoc_DocumentTool::SetLengthUnit(theDocument, aNode->GlobalParameters.LengthUnit, UnitsMethods_LengthUnit_Millimeter);
+ XCAFDoc_DocumentTool::SetLengthUnit(theDocument,
+ aNode->GlobalParameters.LengthUnit,
+ UnitsMethods_LengthUnit_Millimeter);
return true;
}
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWObj_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWObj_ConfigurationNode) aNode = Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWObj_ConfigurationNode) aNode =
+ Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
TColStd_IndexedDataMapOfStringString aFileInfo;
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
{
aFileInfo.Add("Comments", aNode->InternalParameters.WriteComment);
}
-
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetInputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aConverter.SetInputCoordinateSystem(aNode->InternalParameters.SystemCS);
aWriter.SetCoordinateSystemConverter(aConverter);
if (!aWriter.Perform(theDocument, aFileInfo, theProgress))
{
- Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " << thePath;
+ Message::SendFail() << "Error: RWObj_Provider : [" <<
+ thePath << "] : Cannot write any relevant data to the Obj file";
return false;
}
return true;
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWObj_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWObj_ConfigurationNode during writing the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWObj_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWObj_ConfigurationNode) aNode = Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWObj_ConfigurationNode) aNode =
+ Handle(RWObj_ConfigurationNode)::DownCast(GetNode());
RWMesh_CoordinateSystemConverter aConverter;
aConverter.SetOutputLengthUnit(aNode->GlobalParameters.LengthUnit / 1000);
aConverter.SetOutputCoordinateSystem(aNode->InternalParameters.SystemCS);
aSimpleReader.SetMemoryLimit(aNode->InternalParameters.ReadMemoryLimitMiB);
if (!aSimpleReader.Read(thePath, theProgress))
{
- Message::SendFail() << "Error in the RWObj_ConfigurationNode during reading the file " << thePath;
+ Message::SendFail() << "Error: RWObj_Provider : [" <<
+ thePath << "] : Cannot read any relevant data from the Obj file";
return false;
}
Handle(Poly_Triangulation) aTriangulation = aSimpleReader.GetTriangulation();
{
(void)theWS;
Handle(TDocStd_Document) aDoc = new TDocStd_Document("BinXCAF");
- Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
+ Handle(XCAFDoc_ShapeTool) aShTool =
+ XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
aShTool->AddShape(theShape);
return Write(thePath, aDoc, theWS, theProgress);
}
const Message_ProgressRange& theProgress)
{
(void)theWS;
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWPly_ConfigurationNode)))
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWPly_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWPly_Provider during writing the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWPly_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWPly_ConfigurationNode) aNode = Handle(RWPly_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWPly_ConfigurationNode) aNode =
+ Handle(RWPly_ConfigurationNode)::DownCast(GetNode());
TDF_LabelSequence aRootLabels;
- Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool =
+ XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShapeTool->GetFreeShapes(aRootLabels);
if (aRootLabels.IsEmpty())
{
return Standard_True;
}
-
TColStd_IndexedDataMapOfStringString aFileInfo;
if (!aNode->InternalParameters.WriteAuthor.IsEmpty())
{
aPlyCtx.SetFaceId(aNode->InternalParameters.WriteFaceId);
if (!aPlyCtx.Perform(theDocument, aFileInfo, theProgress))
{
- Message::SendFail() << "Error in the RWPly_Provider during writing the file "
- << thePath << "\t: Cannot perform the document";
+ Message::SendFail() << "Error: RWObj_Provider : [" <<
+ thePath << "] : Cannot write any relevant data to the Ply file";
return false;
}
(void)theWS;
if (theDocument.IsNull())
{
- Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
- thePath << "\t: theDocument shouldn't be null";
+ Message::SendFail() << "Error: RWStl_Provider : "
+ << "Null document";
return false;
}
TopoDS_Shape aShape;
{
return false;
}
- Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
+ Handle(XCAFDoc_ShapeTool) aShapeTool =
+ XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aShapeTool->AddShape(aShape);
return true;
}
(void)theWS;
TopoDS_Shape aShape;
TDF_LabelSequence aLabels;
- Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
+ Handle(XCAFDoc_ShapeTool) aSTool =
+ XCAFDoc_DocumentTool::ShapeTool(theDocument->Main());
aSTool->GetFreeShapes(aLabels);
if (aLabels.Length() <= 0)
{
- Message::SendFail() << "Error in the RWStl_Provider during writing the file " <<
- thePath << "\t: Document contain no shapes";
+ Message::SendFail() << "Error: RWStl_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
const Message_ProgressRange& theProgress)
{
(void)theWS;
- Message::SendWarning() << "OCCT Stl reader does not support model scaling according to custom length unit";
+ Message::SendWarning()
+ << "OCCT Stl reader does not support model scaling according to custom length unit";
if (!GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
- return true;
+ Message::SendFail() << "Error: RWStl_Provider : "
+ << "Incorrect or empty Configuration Node";
+ return false;
}
- Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWStl_ConfigurationNode) aNode =
+ Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
double aMergeAngle = aNode->InternalParameters.ReadMergeAngle * M_PI / 180.0;
if (aMergeAngle != M_PI_2)
{
if (aMergeAngle < 0.0 || aMergeAngle > M_PI_2)
{
- Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
- thePath << "\t: The merge angle is out of the valid range";
+ Message::SendFail() << "Error: RWStl_Provider : ["
+ << aMergeAngle << "] The merge angle is out of the valid range";
return false;
}
}
if (!aNode->InternalParameters.ReadBRep)
{
- Handle(Poly_Triangulation) aTriangulation = RWStl::ReadFile(thePath.ToCString(), aMergeAngle, theProgress);
+ Handle(Poly_Triangulation) aTriangulation =
+ RWStl::ReadFile(thePath.ToCString(), aMergeAngle, theProgress);
TopoDS_Face aFace;
BRep_Builder aB;
Standard_DISABLE_DEPRECATION_WARNINGS
if (!StlAPI::Read(theShape, thePath.ToCString()))
{
- Message::SendFail() << "Error in the RWStl_Provider during reading the file " << thePath;
+ Message::SendFail() << "Error: RWStl_Provider : [" <<
+ thePath << "] : Cannot read any relevant data from the STL file";
return false;
}
Standard_ENABLE_DEPRECATION_WARNINGS
const Message_ProgressRange& theProgress)
{
(void)theWS;
- Message::SendWarning() << "OCCT Stl writer does not support model scaling according to custom length unit";
- if (GetNode().IsNull() || !GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
+ Message::SendWarning() <<
+ "OCCT Stl writer does not support model scaling according to custom length unit";
+ if (GetNode().IsNull() ||
+ !GetNode()->IsKind(STANDARD_TYPE(RWStl_ConfigurationNode)))
{
- Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
- thePath << "\t: Incorrect or empty Configuration Node";
+ Message::SendFail() << "Error: RWStl_Provider : "
+ << "Incorrect or empty Configuration Node";
return false;
}
- Handle(RWStl_ConfigurationNode) aNode = Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
+ Handle(RWStl_ConfigurationNode) aNode =
+ Handle(RWStl_ConfigurationNode)::DownCast(GetNode());
StlAPI_Writer aWriter;
aWriter.ASCIIMode() = aNode->InternalParameters.WriteAscii;
if (!aWriter.Write(theShape, thePath.ToCString(), theProgress))
{
- Message::SendFail() << "Error in the RWStl_Provider during reading the file " <<
- thePath << "\t: Mesh writing has been failed";
+ Message::SendFail() << "Error: RWStl_Provider : [" <<
+ thePath << "] : Mesh writing has been failed";
return false;
}
return true;