Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics

how does solome do this ???

how does solome do this ???
hylkema 2012/10/22 19:26
Please look at my previous post about offsetting a solid. The same geometry works perfectly in Salome but I can't get it to work using BRepOffset_MakeOffset. How do they do this ????

Thanks in advance,

You have to be logged in to download the attached file
Mark Blome 2012/10/22 20:09

Hi Jouke,

that's interesting. Taking a quick look at GEOMImpl_OffsetDriver.cpp the difference seems to be that they perform a ShapeFix_ShapeTolerance on the resulting shape if required.
Here are the corresponding lines of code:
BRepOffsetAPI_MakeOffsetShape MO (aShapeBase,
if (MO.IsDone()) {
aShape = MO.Shape();
// 23.04.2010 skl for bug 21699 from Mantis
BRepCheck_Analyzer ana (aShape, Standard_True);
if (!ana.IsValid()) {
ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance(aShape, Precision::Confusion(),
Precision::Confusion(), TopAbs_SHAPE);
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
aShape = aSfs->Shape();
if (!ana.IsValid())
Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");

Or maybe the difference is that Salome uses BRepOffsetAPI_MakeOffsetShape instead of the BRepOffset_MakeOffset you use ?
Good luck with your offset issue,
hylkema 2012/10/23 11:07
Hi Mark,

Thanks a lot for your answer. I Implemented the changes but no success :-( This is driving me mad ...

hylkema 2012/10/23 11:57
This is what I do:

for (int i = 1;i<20;i++) {
Kernel = offset(0.1,Kernel);

with :

TopoDS_Shape Model2::offset(double dist,TopoDS_Shape original) {

double res = Precision::Confusion();
BRepOffsetAPI_MakeOffsetShape mkOffset(original,dist,res);
TopoDS_Shape tmp;
if (mkOffset.IsDone()) {
tmp = mkOffset.Shape();
} else {
StdFail_NotDone::Raise("Offset construction failed");

return Fix(tmp);

and :

TopoDS_Shape Model2::Fix(TopoDS_Shape shape){
BRepCheck_Analyzer ana (shape, Standard_True);
if (!ana.IsValid()) {
cout&lt;&lt;"Fixing the shape"&lt;&lt;"n";
ShapeFix_ShapeTolerance aSFT;
aSFT.LimitTolerance(shape, Precision::Confusion(),Precision::Confusion(), TopAbs_SHAPE);
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(shape);
shape = aSfs->Shape();
if (!ana.IsValid()) {
Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
return shape;

It goes OK for the first 4 and then it crashes ...
Mark Blome 2012/10/23 12:27

Hi Jouke,

Which version of Salome did you use for your tests ? And which version of Opencascade do you compile your program with ?

hylkema 2012/10/23 12:46
Goodmorning Mark,

Salome: 6.5.0
OCC:6.5.0 (installed from the ubuntu repositories, not compiled my self)
Mark Blome 2012/10/23 17:08
Hi Jouke,

maybe there is a difference in the way how Salome reads in your STEP file compared to the method you use with OCC ?
If you can get the job done using Salome, why not use Salome through it's python interface or the standalone GEOM library available at in your project ?

Good luck,
hylkema 2012/10/23 18:26

That might be the problem. However the rest of my project is in C++ so mixing this with pyton might not be easy but I give it a try.


hylkema 2012/10/23 18:34
It's strange though. The error is :

Error making offset :BRepOffset_MakeOffset : Tol > Offset

however :
Offset = 0.1
Tol = 1e-06

Go figure :-(
hylkema 2012/10/26 16:41
      Hi Mark,

I'm afraid I need more help. Have you tried to install the python interface ? It complains at compilation and I realy don't get what is bugging it ...

make[1]: Entering directory `/Software/GEOM/'
/bin/bash ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I/usr/local/inc -I./inc/ -I./src/GEOMAlgo -I./src/BlockFix -I./src/GEOM -I./src/NMTTools -I./src/NMTDS -I./src/Exchange3DS -D_OCC64 -g -O2 -MT NMTDS_CArray1OfIndexRange_0.lo -MD -MP -MF .deps/NMTDS_CArray1OfIndexRange_0.Tpo -c -o NMTDS_CArray1OfIndexRange_0.lo `test -f './src/NMTDS/NMTDS_CArray1OfIndexRange_0.cpp' || echo './'`./src/NMTDS/NMTDS_CArray1OfIndexRange_0.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/usr/local/inc -I./inc/ -I./src/GEOMAlgo -I./src/BlockFix -I./src/GEOM -I./src/NMTTools -I./src/NMTDS -I./src/Exchange3DS -D_OCC64 -g -O2 -MT NMTDS_CArray1OfIndexRange_0.lo -MD -MP -MF .deps/NMTDS_CArray1OfIndexRange_0.Tpo -c ./src/NMTDS/NMTDS_CArray1OfIndexRange_0.cpp -fPIC -DPIC -o .libs/NMTDS_CArray1OfIndexRange_0.o
In file included from ./src/NMTDS/NMTDS_CArray1OfIndexRange_0.cpp:39:0:
/usr/local/inc/BOPTColStd_CArray1.gxx:243:32: error: no 'void NMTDS_CArray1OfIndexRange::Purge()' member function declared in class 'NMTDS_CArray1OfIndexRange'
make[1]: *** [NMTDS_CArray1OfIndexRange_0.lo] Error 1
make[1]: Leaving directory `/Software/GEOM/'
make: *** [all] Error 2
Mark Blome 2012/10/26 17:35
Hi Jouke,

looking at your post I assume you are trying to compile the latest version of the standalone GEOM module found on sourceforge, right ?
The compile error looks like as if you are compiling the geom module with the wrong version of the Opencascade library.
Not sure which version of OCC (my guess: 6.3.0) this GEOM module relies on, but I guess it's not the one you are working with for your project (6.5.0 ?).

My guess is you would need to switch to OCC 6.3.0 for your project in order to integrate the GEOM module. Note that once you have compiled everything you can of course use the GEOM classes directly in your c++ project, i.e. there's no need to mix python and c++.


Latest news
  • Open CASCADE CAD Assistant for iOS platform is available!
  • Open CASCADE Technology 6.9.0 is available for download!
  • JT Assistant for Android

  • © OPEN CASCADE 2000 - 2015  |  Search  |  Contacts   |  Site map