Back to index

salome-geom  6.5.0
Public Member Functions | Static Public Member Functions | Friends
BlockFix Class Reference

#include <BlockFix.hxx>

List of all members.

Public Member Functions

void * operator new (size_t, void *anAddress)
void * operator new (size_t size)
void operator delete (void *anAddress)

Static Public Member Functions

static Standard_EXPORT TopoDS_Shape RotateSphereSpace (const TopoDS_Shape &S, const Standard_Real Tol)
static Standard_EXPORT TopoDS_Shape RefillProblemFaces (const TopoDS_Shape &S)
static Standard_EXPORT TopoDS_Shape FixRanges (const TopoDS_Shape &S, const Standard_Real Tol)

Friends

class BlockFix_SphereSpaceModifier
class BlockFix_UnionFaces
class BlockFix_UnionEdges
class BlockFix_BlockFixAPI
class BlockFix_PeriodicSurfaceModifier
class BlockFix_CheckTool

Detailed Description

Definition at line 45 of file BlockFix.hxx.


Member Function Documentation

TopoDS_Shape BlockFix::FixRanges ( const TopoDS_Shape &  S,
const Standard_Real  Tol 
) [static]

Definition at line 320 of file BlockFix.cxx.

{
  // Create a modification description
  Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier;
  SR->SetTolerance(Tol);

  TopTools_DataMapOfShapeShape context;
  BRepTools_Modifier MD;
  TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );

  Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
  FixResult(result,RS,Tol);
  result = RS->Apply(result);

  ShapeFix_Edge sfe;
  for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
    TopoDS_Edge E = TopoDS::Edge(exp.Current());
    sfe.FixVertexTolerance (E);
  }

  ShapeFix::SameParameter(result,Standard_False);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void BlockFix::operator delete ( void *  anAddress) [inline]

Definition at line 57 of file BlockFix.hxx.

  {
    if (anAddress) Standard::Free((Standard_Address&)anAddress);
  }
void* BlockFix::operator new ( size_t  ,
void *  anAddress 
) [inline]

Definition at line 49 of file BlockFix.hxx.

  {
    return anAddress;
  }
void* BlockFix::operator new ( size_t  size) [inline]

Definition at line 53 of file BlockFix.hxx.

  {
    return Standard::Allocate(size);
  }
TopoDS_Shape BlockFix::RefillProblemFaces ( const TopoDS_Shape &  S) [static]

Definition at line 201 of file BlockFix.cxx.

{
  Standard_Integer NbSamples = 10;

  TopTools_ListOfShape theFaces;

  TopExp_Explorer Explo(aShape, TopAbs_FACE);
  for (; Explo.More(); Explo.Next())
  {
    TopoDS_Face aFace = TopoDS::Face(Explo.Current());
    BRepAdaptor_Surface BAsurf(aFace);
    GeomAbs_SurfaceType SurfType = BAsurf.GetType();
    if (SurfType >= GeomAbs_BezierSurface)
    {
      TopExp_Explorer fexp(aFace, TopAbs_EDGE);
      for (; fexp.More(); fexp.Next())
      {
        const TopoDS_Edge& anEdge = TopoDS::Edge(fexp.Current());
        if (BRep_Tool::Degenerated(anEdge))
        {
          TopoDS_Vertex V1, V2;
          TopExp::Vertices(anEdge, V1, V2);
          if (V1.IsSame(V2))
          {
            gp_Pnt aPnt = BRep_Tool::Pnt(V1);
            Standard_Real TolV = BRep_Tool::Tolerance(V1);
            Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
            Handle(ShapeAnalysis_Surface) Analyser = new ShapeAnalysis_Surface(aSurf);
            if (Analyser->IsDegenerated(aPnt, TolV))
            {
              theFaces.Append(aFace);
              break;
            }
          }
        }
      }
    }
  }

  //Now all problem faces are collected in the list "theFaces"
  BRepTools_Substitution aSubst;
  TopTools_ListIteratorOfListOfShape itl(theFaces);
  for (; itl.More(); itl.Next())
  {
    const TopoDS_Face& aFace = TopoDS::Face(itl.Value());
    BRepOffsetAPI_MakeFilling Filler;
    for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next())
    {
      const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
      if (!BRep_Tool::Degenerated(anEdge))
        Filler.Add(anEdge, GeomAbs_C0);
    }
    Standard_Real Umin, Umax, Vmin, Vmax;
    BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
    //Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
    Standard_Integer i, j;
    for (i = 1; i < NbSamples; i++)
      for (j = 1; j < NbSamples; j++) {
        /*
        gp_Pnt aPoint = aSurf->Value(Umin + i*(Umax-Umin)/NbSamples,
                                     Vmin + j*(Vmax-Vmin)/NbSamples);
        Filler.Add(aPoint);
        */
        Filler.Add(Umin + i*(Umax-Umin)/NbSamples,
                   Vmin + j*(Vmax-Vmin)/NbSamples,
                   aFace, GeomAbs_G1);
      }

    Filler.Build();
    if (Filler.IsDone())
    {
      for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next())
      {
        const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
        TopTools_ListOfShape Ledge;
        if (!BRep_Tool::Degenerated(anEdge))
        {
          const TopTools_ListOfShape& Ledges = Filler.Generated(anEdge);
          if (!Ledges.IsEmpty()) {
            TopoDS_Shape NewEdge = Ledges.First();
            Ledge.Append(NewEdge.Oriented(TopAbs_FORWARD));
          }
        }
        aSubst.Substitute(anEdge, Ledge);
      }
      TopTools_ListOfShape Lface;
      TopoDS_Face NewFace = TopoDS::Face(Filler.Shape());
      NewFace.Orientation(TopAbs_FORWARD);
      BRepAdaptor_Surface NewBAsurf(NewFace);
      gp_Pnt MidPnt;
      gp_Vec D1U, D1V, Normal, NewNormal;
      Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
      aSurf->D1((Umin+Umax)*0.5, (Vmin+Vmax)*0.5, MidPnt, D1U, D1V);
      Normal = D1U ^ D1V;
      NewBAsurf.D1((NewBAsurf.FirstUParameter() + NewBAsurf.LastUParameter())*0.5,
                   (NewBAsurf.FirstVParameter() + NewBAsurf.LastVParameter())*0.5,
                   MidPnt, D1U, D1V);
      NewNormal = D1U ^ D1V;
      if (Normal * NewNormal < 0.)
        NewFace.Reverse();
      Lface.Append(NewFace);
      aSubst.Substitute(aFace, Lface);
    }
  }
  aSubst.Build(aShape);

  TopoDS_Shape Result = aShape;
  if (aSubst.IsCopied(aShape))
    Result = aSubst.Copy(aShape).First();

  BRepTools::RemoveUnusedPCurves(Result);

  return Result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TopoDS_Shape BlockFix::RotateSphereSpace ( const TopoDS_Shape &  S,
const Standard_Real  Tol 
) [static]

Definition at line 172 of file BlockFix.cxx.

{
  // Create a modification description
  Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier;
  SR->SetTolerance(Tol);

  TopTools_DataMapOfShapeShape context;
  BRepTools_Modifier MD;
  TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );

  Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
  FixResult(result,RS,Tol);
  result = RS->Apply(result);

  ShapeFix_Edge sfe;
  for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
    TopoDS_Edge E = TopoDS::Edge(exp.Current());
    sfe.FixVertexTolerance (E);
  }

  ShapeFix::SameParameter(result,Standard_False);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class BlockFix_BlockFixAPI [friend]

Definition at line 73 of file BlockFix.hxx.

friend class BlockFix_CheckTool [friend]

Definition at line 75 of file BlockFix.hxx.

friend class BlockFix_PeriodicSurfaceModifier [friend]

Definition at line 74 of file BlockFix.hxx.

friend class BlockFix_SphereSpaceModifier [friend]

Definition at line 70 of file BlockFix.hxx.

friend class BlockFix_UnionEdges [friend]

Definition at line 72 of file BlockFix.hxx.

friend class BlockFix_UnionFaces [friend]

Definition at line 71 of file BlockFix.hxx.


The documentation for this class was generated from the following files: