Description
--- Migrating former mantis ticket 32819 ---
Correct:

Incorrect:

I have a simple App, which tells OCCT to read and mesh a STEP file. The result is written to a VRML file.
The writer seems not to find the material. According to 0032728, I tried XCAFPrs_DocumentExplorer. It finds shapes with colors, but VrmlAPI_Writer does not use this explorer. Don't know, how to fix this on my own.
Expected Behavior
Colors on all levels of the hierarchy should be found and written into the VRML file
Actual Behavior
Appearances defined directly on meshes are being converted correctly, inherited colors not
Sample Code or DRAW Tcl Script
int Step2WrlConverter::Convert(char* input, char* output, double deflection, double angularDeflection)
{
std::cout << "Reading " << input << ".. ";
auto start_timestamp = hrclock::now();
STEPCAFControl_Reader reader;
reader.SetColorMode(true);
reader.SetNameMode(true);
Interface_Static::SetCVal("xstep.cascade.unit", "M");
Interface_Static::SetIVal("read.precision.mode", 1);
Interface_Static::SetRVal("read.precision.val", 0.0001);
Interface_Static::SetIVal("read.step.product.mode", 214);
Handle(TDocStd_Document) doc;
Handle(XCAFApp_Application) app = XCAFApp_Application::GetApplication();
app->NewDocument("MDTV-XCAF", doc);
auto success = reader.Perform(input, doc);
if (!success)
{
std::cout << "ERROR!\n";
return -1;
}
std::cout << "Done in " << std::chrono::duration_cast<std::chrono::milliseconds>(hrclock::now() - start_timestamp).count() / 1000.0f << "s!\nTriangulating.. ";
shapeTool = XCAFDoc_DocumentTool::ShapeTool(doc->Main());
NCollection_Sequence<TDF_Label> shapeLabels;
shapeTool->GetFreeShapes(shapeLabels);
auto count = shapeLabels.Length();
for (int i = 1; i <= count; ++i)
{
auto shape = shapeTool->GetShape(shapeLabels.Value(i));
BRepMesh_IncrementalMesh mesh(shape, deflection, false, angularDeflection);
}
std::cout << "Done in " << std::chrono::duration_cast<std::chrono::milliseconds>(hrclock::now() - start_timestamp).count() / 1000.0f << "s!\nWriting output file.. ";
start_timestamp = hrclock::now();
VrmlAPI_Writer writer;
writer.SetRepresentation(VrmlAPI_RepresentationOfShape::VrmlAPI_ShadedRepresentation);
writer.WriteDoc(doc, output, 1);
std::cout << "Done in " << std::chrono::duration_cast<std::chrono::milliseconds>(hrclock::now() - start_timestamp).count() / 1000.0f << "s!";
return 0;
}
Operating System
Windows
Compiler
MSVC
Bitness
64-bit
OCCT Version
latest
Additional Files
Interroll_R391035_DE30_BC4727_Portec_Belt_Curve.zip
Description
--- Migrating former mantis ticket 32819 ---
Correct:

Incorrect:

I have a simple App, which tells OCCT to read and mesh a STEP file. The result is written to a VRML file.
The writer seems not to find the material. According to 0032728, I tried XCAFPrs_DocumentExplorer. It finds shapes with colors, but VrmlAPI_Writer does not use this explorer. Don't know, how to fix this on my own.
Expected Behavior
Colors on all levels of the hierarchy should be found and written into the VRML file
Actual Behavior
Appearances defined directly on meshes are being converted correctly, inherited colors not
Sample Code or DRAW Tcl Script
int Step2WrlConverter::Convert(char* input, char* output, double deflection, double angularDeflection)
{
std::cout << "Reading " << input << ".. ";
auto start_timestamp = hrclock::now();
}
Operating System
Windows
Compiler
MSVC
Bitness
64-bit
OCCT Version
latest
Additional Files
Interroll_R391035_DE30_BC4727_Portec_Belt_Curve.zip