mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-03 00:44:29 +05:00
Correction of next problem from bug NPAL14857.
This commit is contained in:
parent
2c83fef4e1
commit
ce39340ec9
@ -39,6 +39,8 @@
|
|||||||
#include <BRepCheck_Analyzer.hxx>
|
#include <BRepCheck_Analyzer.hxx>
|
||||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||||
#include <BRepOffsetAPI_MakePipeShell.hxx>
|
#include <BRepOffsetAPI_MakePipeShell.hxx>
|
||||||
|
#include <GProp_GProps.hxx>
|
||||||
|
#include <BRepGProp.hxx>
|
||||||
|
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
@ -69,7 +71,7 @@
|
|||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
#include "BRepTools.hxx"
|
//#include "BRepTools.hxx"
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -586,6 +588,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
CreateFewSolids = true;
|
CreateFewSolids = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// check orientation of sections
|
// check orientation of sections
|
||||||
bool NeedReverse = false;
|
bool NeedReverse = false;
|
||||||
{
|
{
|
||||||
@ -653,9 +656,9 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//cout<<"VN("<<VN.X()<<","<<VN.Y()<<","<<VN.Z()<<")"<<endl;
|
cout<<"VN("<<VN.X()<<","<<VN.Y()<<","<<VN.Z()<<")"<<endl;
|
||||||
//cout<<"PathNorm("<<PathNorm.X()<<","<<PathNorm.Y()<<","<<PathNorm.Z()<<")"<<endl;
|
cout<<"PathNorm("<<PathNorm.X()<<","<<PathNorm.Y()<<","<<PathNorm.Z()<<")"<<endl;
|
||||||
if(fabs(VN.Angle(PathNorm)>PI/2.)) {
|
if(fabs(VN.Angle(PathNorm))>PI/2.) {
|
||||||
NeedReverse = true;
|
NeedReverse = true;
|
||||||
aShBase1.Reverse();
|
aShBase1.Reverse();
|
||||||
}
|
}
|
||||||
@ -727,10 +730,10 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
}
|
}
|
||||||
//cout<<"VN("<<VN.X()<<","<<VN.Y()<<","<<VN.Z()<<")"<<endl;
|
//cout<<"VN("<<VN.X()<<","<<VN.Y()<<","<<VN.Z()<<")"<<endl;
|
||||||
//cout<<"PathNorm("<<PathNorm.X()<<","<<PathNorm.Y()<<","<<PathNorm.Z()<<")"<<endl;
|
//cout<<"PathNorm("<<PathNorm.X()<<","<<PathNorm.Y()<<","<<PathNorm.Z()<<")"<<endl;
|
||||||
if(fabs(VN.Angle(PathNorm)>PI/2.))
|
if(fabs(VN.Angle(PathNorm))>PI/2.)
|
||||||
aShBase2.Reverse();
|
aShBase2.Reverse();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if(!CreateFewSolids) {
|
if(!CreateFewSolids) {
|
||||||
// we can create only one solid
|
// we can create only one solid
|
||||||
@ -804,10 +807,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) {
|
for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) {
|
||||||
B.Add(aShell,anExp.Current());
|
B.Add(aShell,anExp.Current());
|
||||||
}
|
}
|
||||||
if(NeedReverse) {
|
|
||||||
cout<<"shell is reversed"<<endl;
|
|
||||||
aShell.Reverse();
|
|
||||||
}
|
|
||||||
// make sewing for this shell
|
// make sewing for this shell
|
||||||
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
|
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
|
||||||
aSewing->SetTolerance(Precision::Confusion());
|
aSewing->SetTolerance(Precision::Confusion());
|
||||||
@ -821,6 +820,11 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
const TopoDS_Shape aSewShape = aSewing->SewedShape();
|
const TopoDS_Shape aSewShape = aSewing->SewedShape();
|
||||||
if( aSewShape.ShapeType() == TopAbs_SHELL ) {
|
if( aSewShape.ShapeType() == TopAbs_SHELL ) {
|
||||||
aShell = TopoDS::Shell(aSewShape);
|
aShell = TopoDS::Shell(aSewShape);
|
||||||
|
GProp_GProps aSystem;
|
||||||
|
BRepGProp::VolumeProperties(aShell, aSystem);
|
||||||
|
if(aSystem.Mass()<0) {
|
||||||
|
aShell.Reverse();
|
||||||
|
}
|
||||||
if(BRep_Tool::IsClosed(aShell)) {
|
if(BRep_Tool::IsClosed(aShell)) {
|
||||||
TopoDS_Solid aSolid;
|
TopoDS_Solid aSolid;
|
||||||
B.MakeSolid(aSolid);
|
B.MakeSolid(aSolid);
|
||||||
@ -1006,7 +1010,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
|
|
||||||
|
|
||||||
// make pipe for each pair of faces
|
// make pipe for each pair of faces
|
||||||
//BRepTools::Write(WPath,"/dn02/users_Linux/skl/work/Bugs/14857/wpath.brep");
|
|
||||||
for(j=1; j<=FF.Extent(); j++) {
|
for(j=1; j<=FF.Extent(); j++) {
|
||||||
TopoDS_Shape F1 = FF.FindKey(j);
|
TopoDS_Shape F1 = FF.FindKey(j);
|
||||||
if( F1.ShapeType() != TopAbs_FACE )
|
if( F1.ShapeType() != TopAbs_FACE )
|
||||||
@ -1031,18 +1034,12 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
TopoDS_Shape aShape = aBuilder.Shape();
|
TopoDS_Shape aShape = aBuilder.Shape();
|
||||||
TopoDS_Shell aShell;
|
TopoDS_Shell aShell;
|
||||||
B.MakeShell(aShell);
|
B.MakeShell(aShell);
|
||||||
//int nbf=0;
|
|
||||||
for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) {
|
for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) {
|
||||||
//nbf++;
|
|
||||||
//cout<<"nbf="<<nbf<<endl;
|
|
||||||
B.Add(aShell,anExp.Current());
|
B.Add(aShell,anExp.Current());
|
||||||
}
|
}
|
||||||
|
|
||||||
B.Add(aShell,F1);
|
B.Add(aShell,F1);
|
||||||
B.Add(aShell,F2);
|
B.Add(aShell,F2);
|
||||||
if(NeedReverse) {
|
|
||||||
//cout<<"shell is reversed"<<endl;
|
|
||||||
aShell.Reverse();
|
|
||||||
}
|
|
||||||
// make sewing for this shell
|
// make sewing for this shell
|
||||||
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
|
Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing;
|
||||||
aSewing->SetTolerance(Precision::Confusion());
|
aSewing->SetTolerance(Precision::Confusion());
|
||||||
@ -1056,6 +1053,12 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
const TopoDS_Shape aSewShape = aSewing->SewedShape();
|
const TopoDS_Shape aSewShape = aSewing->SewedShape();
|
||||||
if( aSewShape.ShapeType() == TopAbs_SHELL ) {
|
if( aSewShape.ShapeType() == TopAbs_SHELL ) {
|
||||||
aShell = TopoDS::Shell(aSewShape);
|
aShell = TopoDS::Shell(aSewShape);
|
||||||
|
GProp_GProps aSystem;
|
||||||
|
BRepGProp::VolumeProperties(aShell, aSystem);
|
||||||
|
if(aSystem.Mass()<0) {
|
||||||
|
//cout<<"aSewShape is reversed"<<endl;
|
||||||
|
aShell.Reverse();
|
||||||
|
}
|
||||||
if(BRep_Tool::IsClosed(aShell)) {
|
if(BRep_Tool::IsClosed(aShell)) {
|
||||||
TopoDS_Solid aSolid;
|
TopoDS_Solid aSolid;
|
||||||
B.MakeSolid(aSolid);
|
B.MakeSolid(aSolid);
|
||||||
@ -1075,6 +1078,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//BRepTools::Write(aComp,"/dn02/users_Linux/skl/work/Bugs/14857/comp.brep");
|
||||||
return aComp;
|
return aComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user