View Issue Details

IDProjectCategoryView StatusLast Update
0032132CommunityOCCT:Data Exchangepublic2023-01-20 13:52
Reportergeuzaine Assigned Togka 
PrioritynormalSeverityminor 
Status newResolutionopen 
Product Version7.5.0 
Summary0032132: Data Exchange - STEP export duplicates surfaces, leading to non-conformal geometry
DescriptionDear OCCT team,

When I import a BREP file that contains several solids that share faces, then export it as STEP, the STEP file duplicates the shared faces, leading to a non-conformal (topologically) model.

I've tried the various STEP export modes, but so far without success.

Is this a know issue/limitation of the STEP exporter?

Thanks,

Christophe
Steps To ReproduceCompile and run the following C++ code, which loads a BREP file (input.brep - attached to this report) and outputs both BREP (output.brep) and STEP (output.step) files :

// g++ io.cpp -I/usr/local/occt/include/opencascade -L/usr/local/occt/lib -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase -lTKShHealing -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKMath -lTKernel -lfreetype

#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <STEPControl_Writer.hxx>

int main()
{
  TopoDS_Shape shape;
  BRep_Builder builder;
  BRepTools::Read(shape, "input.brep", builder);
  BRepTools::Write(shape, "output.brep");
  STEPControl_Writer writer;
  writer.Transfer(shape, STEPControl_AsIs);
  writer.Write("output.step");
  return 0;
}


The output STEP file contains duplicate surfaces, while the output BREP file is correct.
Additional information
and documentation updates
See e.g. https://gitlab.onelab.info/gmsh/gmsh/-/issues/906 for a related bug report in Gmsh.
TagsNo tags attached.
Test case number

Attached Files

  • input.brep (47,079 bytes)
  • i1.stp (391,581 bytes)
  • i2.stp (268,787 bytes)
  • output.step (262,453 bytes)

Relationships

related to 0025092 closedbugmaster Open CASCADE COMPSOLIDs are not exported to STEP 

Activities

geuzaine

2021-02-15 21:55

reporter  

input.brep (47,079 bytes)

kgv

2021-02-16 12:26

developer   ~0098888

Maybe parameters "write.step.nonmanifold" and "read.step.nonmanifold" might be helpful.

pload XDE MODELING
restore input.brep i
testwritestep i1.stp i
testreadstep i1.stp i1

param write.step.nonmanifold 1
param read.step.nonmanifold 1
testwritestep i2.stp i
testreadstep i2.stp i2

geuzaine

2021-02-16 14:47

reporter   ~0098891

Last edited: 2021-02-16 14:48

I've tried the various options listed here https://dev.opencascade.org/doc/refman/html/_s_t_e_p_control___step_model_type_8hxx.html#a032affe8dae498d429a83225f8c5da4e but none produced a file with non-duplicated faces (and some just fail).

What are the C++ options that correspond to write.step.nonmanifold/read.step.nonmanifold?

If there are no direct equivalents, could you attach your files i1.stp and i2.stp so I could examine them?

kgv

2021-02-16 14:49

developer  

i1.stp (391,581 bytes)

kgv

2021-02-16 14:49

developer  

i2.stp (268,787 bytes)

kgv

2021-02-16 14:53

developer   ~0098892

> What are the C++ options that correspond to write.step.nonmanifold/read.step.nonmanifold?
STEP/IGES parameters are managed via Interface_Static interface (exposed by "param" command in Draw Harness) - something like that:
STEPCAFControl_Controller::Init();
STEPControl_Controller::Init();
Interface_Static::SetIVal ("write.step.nonmanifold", 1);
Interface_Static::SetIVal ("read.step.nonmanifold",  1);

geuzaine

2021-02-16 15:53

reporter  

output.step (262,453 bytes)

geuzaine

2021-02-16 15:55

reporter   ~0098896

I've attached the output.step file that I obtain after modifying the test-case to set the global "write.step.nonmanifold" option:

// g++ io.cpp -I/usr/local/occt/include/opencascade -L/usr/local/occt/lib -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase -lTKShHealing -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKMath -lTKernel -lfreetype

#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <Interface_Static.hxx>
#include <STEPControl_Controller.hxx>
#include <STEPControl_Writer.hxx>

int main()
{
  TopoDS_Shape shape;
  BRep_Builder builder;
  BRepTools::Read(shape, "input.brep", builder);
  BRepTools::Write(shape, "output.brep");

  STEPControl_Controller::Init();
  Interface_Static::SetIVal("write.step.nonmanifold", 1);
  STEPControl_Writer writer;
  writer.Transfer(shape, STEPControl_AsIs);
  writer.Write("output.step");
  return 0;
}


Unfortunately the new STEP output file now only contains 11 volumes (instead if 12).

kgv

2021-02-16 16:02

developer   ~0098897

> Unfortunately the new STEP output file now only contains 11 volumes (instead if 12).
How you've counted them? Have you used
> Interface_Static::SetIVal ("read.step.nonmanifold", 1);
option to read STEP back?

geuzaine

2021-02-16 16:14

reporter   ~0098898

Yes, I've tried both with and without setting "read.step.nonmanifold". Here's the updated test-case so you can directly give it a try on your side:

// g++ io.cpp -I/usr/local/occt/include/opencascade -L/usr/local/occt/lib -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKXSBase -lTKShHealing -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKMath -lTKernel -lfreetype

#include <iostream>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <Interface_Static.hxx>
#include <STEPControl_Controller.hxx>
#include <STEPControl_Writer.hxx>
#include <STEPControl_Reader.hxx>
#include <TopExp_Explorer.hxx>

int main()
{
  TopoDS_Shape shape;
  BRep_Builder builder;
  BRepTools::Read(shape, "input.brep", builder);

  TopExp_Explorer exp;
  int in = 0;
  for(exp.Init(shape, TopAbs_SOLID); exp.More(); exp.Next()) in++;

  BRepTools::Write(shape, "output.brep");

  STEPControl_Controller::Init();
  Interface_Static::SetIVal("write.step.nonmanifold", 1);
  STEPControl_Writer writer;
  writer.Transfer(shape, STEPControl_AsIs);
  writer.Write("output.step");

  Interface_Static::SetIVal("read.step.nonmanifold", 1);
  STEPControl_Reader reader;
  reader.ReadFile("output.step");
  reader.NbRootsForTransfer();
  reader.TransferRoots();
  TopoDS_Shape result = reader.OneShape();

  int out = 0;
  for(exp.Init(result, TopAbs_SOLID); exp.More(); exp.Next()) out++;

  std::cout << in << " input solids, " << out << " output solids\n";

  return 0;
}

grey.christoforo_170262

2021-03-29 14:03

reporter   ~0099813

Here's a downstream bug report that I think stems from this issue: https://github.com/CadQuery/cadquery/issues/697

Is there anything we can do to work around the problem today? Incorrect step file generation feels like an important issue (to me personally).

kgv

2021-03-29 14:18

developer   ~0099814

Last edited: 2021-03-29 14:19

grey.christoforo,

> Here's a downstream bug report that I think stems from this issue
I may be wrong, but I don't see how your issue is relevant to this one.
Please register a dedicated bug - if it will be found that these bugs correlate to each other, this can be indicated later via bugs relations.

geuzaine

2022-05-02 10:20

reporter   ~0108282

Any news about this?

The issue is exactly the same as the one discussed here: This issue https://dev.opencascade.org/content/saving-compsolid-object

mawoznia

2023-01-20 13:42

reporter   ~0112902

Dear OCCT team,
I work at CERN and also would like to see this OCCT issue with the export to .step from .brep fixed.
Is there any news on what could cause the issue and how much work it would be to fix it?
Many thanks,
Mariusz

Issue History

Date Modified Username Field Change
2021-02-15 21:55 geuzaine New Issue
2021-02-15 21:55 geuzaine Assigned To => gka
2021-02-15 21:55 geuzaine File Added: input.brep
2021-02-15 22:01 kgv Summary STEP export duplicates surfaces, leading to non-conformal geometry => Data Exchange - STEP export duplicates surfaces, leading to non-conformal geometry
2021-02-15 22:01 kgv Steps to Reproduce Updated
2021-02-15 22:08 kgv Relationship added related to 0025092
2021-02-16 12:26 kgv Note Added: 0098888
2021-02-16 14:47 geuzaine Note Added: 0098891
2021-02-16 14:48 geuzaine Note Edited: 0098891
2021-02-16 14:49 kgv File Added: i1.stp
2021-02-16 14:49 kgv File Added: i2.stp
2021-02-16 14:53 kgv Note Added: 0098892
2021-02-16 15:53 geuzaine File Added: output.step
2021-02-16 15:55 geuzaine Note Added: 0098896
2021-02-16 16:02 kgv Note Added: 0098897
2021-02-16 16:14 geuzaine Note Added: 0098898
2021-03-29 14:03 grey.christoforo_170262 Note Added: 0099813
2021-03-29 14:18 kgv Note Added: 0099814
2021-03-29 14:19 kgv Note Edited: 0099814
2022-05-02 10:20 geuzaine Note Added: 0108282
2023-01-20 13:42 mawoznia Note Added: 0112902