View Issue Details

IDProjectCategoryView StatusLast Update
0032819CommunityOCCT:Data Exchangepublic2022-02-10 00:58
Reporterhcermann Assigned Todpasukhi  
PrioritynormalSeverityminor 
Status resolvedResolutionopen 
Product Version7.4.0 
Target Version7.7.0 
Summary0032819: Data Exchange - VrmlAPI_Writer does not write all colors
DescriptionHi,

I have a simple App, which tells OCCT to read and mesh a STEP file. The result is written to a VRML file:

app->NewDocument("BinXCAF", doc);
auto success = reader.Perform(input, doc);

if (!success)
{
    std::cout << "ERROR!\n";
    return -1;
}
shapeTool = XCAFDoc_DocumentTool::ShapeTool(doc->Main());
TDF_LabelSequence 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, Standard_False, angularDeflection);
}
VrmlAPI_Writer writer;
writer.SetRepresentation(VrmlAPI_RepresentationOfShape::VrmlAPI_ShadedRepresentation);

writer.WriteDoc(doc, output, 1);


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.
Steps To Reproduce
pload OCAF XDE MODELING VISUALIZATION
ReadStep D Interroll_R391035_DE30_BC4727_Portec_Belt_Curve.step
XGetOneShape s D
incmesh s 1
WriteVrml D test1.wrl
# KO - colors are lost
XExpand D 1
WriteVrml D test2.wrl
# OK - colors preserved
TagsNo tags attached.
Test case numberN/A

Attached Files

  • withColor.png (39,541 bytes)
  • withoutColor.png (18,733 bytes)
  • Interroll_R391035_DE30_BC4727_Portec_Belt_Curve.step (353,333 bytes)

Relationships

related to 0032820 newdpasukhi Open CASCADE Data Exchange - add VRML reader to XCAF document 
child of 0030115 closedbugmaster Open CASCADE Data Exchange - Implementation of import from XCAF to VRML. 

Activities

kgv

2022-02-07 13:47

developer   ~0106775

@hcermann, please provide a sample model reproducing the issue.

hcermann

2022-02-07 13:56

reporter   ~0106776

I attached a file and two images.
withColor.png (39,541 bytes)
withoutColor.png (18,733 bytes)
Interroll_R391035_DE30_BC4727_Portec_Belt_Curve.step (353,333 bytes)

git

2022-02-07 15:03

administrator   ~0106779

Branch CR32819 has been created by kgv.

SHA-1: 46ca858d073c21ef0d75e334e28f0a027cc2ca98


Detailed log of new commits:

Author: kgv
Date: Mon Feb 7 15:02:42 2022 +0300

    0032819: Data Exchange - VrmlAPI_Writer does not write all colors
    
    VrmlData_ShapeConvert::addShape() - fixed handling of colors assigned to Compound instead of a Face.
    RWMesh_FaceIterator is now used to dispatch colors and skip Faces without triangulation.

kgv

2022-02-07 15:04

developer   ~0106781

@dpasukhi, bugfix pushed to CR32819 - to be considered after 0032820.

git

2022-02-09 23:33

administrator   ~0106836

Branch CR32819 has been updated forcibly by kgv.

SHA-1: 3a0ab2bfb14855c74c0663f64186290de0102833

kgv

2022-02-10 00:58

developer   ~0106840

Patch is ready for review
- OCCT: branch CR32819.

http://jenkins-test-occt.nnov.opencascade.com/view/CR32819-master-KGV/

Issue History

Date Modified Username Field Change
2022-02-07 13:33 hcermann New Issue
2022-02-07 13:33 hcermann Assigned To => gka
2022-02-07 13:46 kgv Summary VrmlAPI_Writer does not write all colors => Data Exchange - VrmlAPI_Writer does not write all colors
2022-02-07 13:46 kgv Description Updated
2022-02-07 13:47 kgv Note Added: 0106775
2022-02-07 13:56 hcermann Note Added: 0106776
2022-02-07 13:56 hcermann File Added: withColor.png
2022-02-07 13:56 hcermann File Added: withoutColor.png
2022-02-07 13:56 hcermann File Added: Interroll_R391035_DE30_BC4727_Portec_Belt_Curve.step
2022-02-07 14:02 kgv Steps to Reproduce Updated
2022-02-07 14:06 kgv Product Version 7.6.0 => 7.4.0
2022-02-07 14:06 kgv Relationship added child of 0030115
2022-02-07 14:19 kgv Steps to Reproduce Updated
2022-02-07 14:29 kgv Relationship added related to 0032820
2022-02-07 15:03 git Note Added: 0106779
2022-02-07 15:03 kgv Assigned To gka => dpasukhi
2022-02-07 15:03 kgv Target Version => 7.7.0
2022-02-07 15:04 kgv Note Added: 0106781
2022-02-09 23:33 git Note Added: 0106836
2022-02-10 00:58 kgv Status new => resolved
2022-02-10 00:58 kgv Test case number => N/A
2022-02-10 00:58 kgv Note Added: 0106840