Skip to content

Commit

Permalink
Merge pull request #1251 from snoyer/occt-fixes
Browse files Browse the repository at this point in the history
OCCT fixes for edges and colors
  • Loading branch information
mwestphal authored Feb 2, 2024
2 parents 3047eb2 + efe67a6 commit a16f7e0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ if(F3D_PLUGIN_BUILD_OCCT)
f3d_test(NAME TestInvalidBREP DATA invalid.brep ARGS --verbose --load-plugins=occt NO_BASELINE)

if(F3D_PLUGIN_OCCT_COLORING_SUPPORT AND NOT F3D_MACOS_BUNDLE)
f3d_test(NAME TestXCAFColors DATA xcaf-colors.stp DEFAULT_LIGHTS ARGS --load-plugins=occt -csy --up=+Z --camera-direction=-1,-1,-1)

file(COPY "${F3D_SOURCE_DIR}/plugins/occt/configs/config.d/" DESTINATION "${CMAKE_BINARY_DIR}/share/f3d/configs/config_build.d")
f3d_test(NAME TestDefaultConfigFileOCCT DATA f3d.stp CONFIG config_build LONG_TIMEOUT DEFAULT_LIGHTS)

Expand Down
8 changes: 5 additions & 3 deletions plugins/occt/module/vtkF3DOCCTReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class vtkF3DOCCTReader::vtkInternals
uvs->InsertNextTypedTuple(fn);
}

std::vector<vtkIdType> polyline(nbV - 1);
std::vector<vtkIdType> polyline(nbV);
std::iota(polyline.begin(), polyline.end(), shift);
linesCells->InsertNextCell(polyline.size(), polyline.data());

Expand All @@ -143,7 +143,8 @@ class vtkF3DOCCTReader::vtkInternals
{
std::array<unsigned char, 3> rgb = { 0, 0, 0 };
Quantity_Color aColor;
if (this->ColorTool->GetColor(edge, XCAFDoc_ColorCurv, aColor))
if (this->ColorTool->GetColor(edge, XCAFDoc_ColorCurv, aColor) ||
this->ColorTool->GetColor(shape, XCAFDoc_ColorCurv, aColor))
{
rgb[0] = static_cast<unsigned char>(255.0 * aColor.Red());
rgb[1] = static_cast<unsigned char>(255.0 * aColor.Green());
Expand Down Expand Up @@ -249,7 +250,8 @@ class vtkF3DOCCTReader::vtkInternals
{
std::array<unsigned char, 3> rgb = { 255, 255, 255 };
Quantity_Color aColor;
if (this->ColorTool->GetColor(face, XCAFDoc_ColorSurf, aColor))
if (this->ColorTool->GetColor(face, XCAFDoc_ColorSurf, aColor) ||
this->ColorTool->GetColor(shape, XCAFDoc_ColorSurf, aColor))
{
rgb[0] = static_cast<unsigned char>(255.0 * aColor.Red());
rgb[1] = static_cast<unsigned char>(255.0 * aColor.Green());
Expand Down
4 changes: 2 additions & 2 deletions testing/baselines/TestSTEP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/baselines/TestXCAFColors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions testing/data/xcaf-colors.stp
Git LFS file not shown

0 comments on commit a16f7e0

Please sign in to comment.