mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-05-22 20:59:38 +08:00
0031148: Modeling Algorithms - Offset adjacent co-planar faces with different offset values
Extend the Offset operation (Join Type "Intersection", mode "Complete") to allow different offset values on adjacent co-planar faces. The gap between adjacent faces is closed by creating artificial face perpendicular to the face. Adding test cases.
This commit is contained in:
@@ -118,24 +118,14 @@ void BRepOffsetAPI_MakeOffsetShape::Build()
|
||||
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::Generated (const TopoDS_Shape& S)
|
||||
{
|
||||
myGenerated.Clear();
|
||||
|
||||
if (myLastUsedAlgo == OffsetAlgo_JOIN && !myOffsetShape.ClosingFaces().Contains(S))
|
||||
if (myLastUsedAlgo == OffsetAlgo_JOIN)
|
||||
{
|
||||
myOffsetShape.OffsetFacesFromShapes ().LastImage (S, myGenerated);
|
||||
|
||||
if (!myOffsetShape.ClosingFaces().IsEmpty())
|
||||
{
|
||||
// Reverse generated shapes in case of small solids.
|
||||
// Useful only for faces without influence on others.
|
||||
TopTools_ListIteratorOfListOfShape it(myGenerated);
|
||||
for (; it.More(); it.Next())
|
||||
it.Value().Reverse();
|
||||
}
|
||||
myGenerated = myOffsetShape.Generated (S);
|
||||
}
|
||||
else if (myLastUsedAlgo == OffsetAlgo_SIMPLE)
|
||||
{
|
||||
TopoDS_Shape aGenShape = mySimpleOffsetShape.Generated(S);
|
||||
if (!aGenShape.IsNull())
|
||||
if (!aGenShape.IsNull() && !aGenShape.IsSame (S))
|
||||
myGenerated.Append(aGenShape);
|
||||
}
|
||||
|
||||
@@ -143,33 +133,39 @@ const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::Generated (const Topo
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GeneratedEdge
|
||||
//function : Modified
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::GeneratedEdge (const TopoDS_Shape& S)
|
||||
const TopTools_ListOfShape& BRepOffsetAPI_MakeOffsetShape::Modified (const TopoDS_Shape& S)
|
||||
{
|
||||
myGenerated.Clear();
|
||||
|
||||
if (myLastUsedAlgo == OffsetAlgo_JOIN)
|
||||
{
|
||||
myOffsetShape.OffsetEdgesFromShapes().LastImage (S, myGenerated);
|
||||
|
||||
if (!myGenerated.IsEmpty())
|
||||
{
|
||||
if (S.IsSame(myGenerated.First()))
|
||||
myGenerated.RemoveFirst();
|
||||
}
|
||||
myGenerated = myOffsetShape.Modified (S);
|
||||
}
|
||||
else if (myLastUsedAlgo == OffsetAlgo_SIMPLE)
|
||||
{
|
||||
TopoDS_Shape aGenShape = mySimpleOffsetShape.Generated(S);
|
||||
if (!aGenShape.IsNull())
|
||||
TopoDS_Shape aGenShape = mySimpleOffsetShape.Modified(S);
|
||||
if (!aGenShape.IsNull() && !aGenShape.IsSame (S))
|
||||
myGenerated.Append(aGenShape);
|
||||
}
|
||||
|
||||
return myGenerated;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDeleted
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean BRepOffsetAPI_MakeOffsetShape::IsDeleted (const TopoDS_Shape& S)
|
||||
{
|
||||
if (myLastUsedAlgo == OffsetAlgo_JOIN)
|
||||
{
|
||||
return myOffsetShape.IsDeleted(S);
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetJoinType
|
||||
//purpose : Query offset join type.
|
||||
|
||||
@@ -133,12 +133,15 @@ public:
|
||||
//! Does nothing.
|
||||
Standard_EXPORT virtual void Build() Standard_OVERRIDE;
|
||||
|
||||
//! Returns the list of shapes generated from the shape <S>.
|
||||
//! Returns the list of shapes generated from the shape <S>.
|
||||
Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
|
||||
|
||||
//! Returns the list of edges generated from the shape <S>.
|
||||
Standard_EXPORT const TopTools_ListOfShape& GeneratedEdge (const TopoDS_Shape& S);
|
||||
|
||||
|
||||
//! Returns the list of shapes Modified from the shape <S>.
|
||||
Standard_EXPORT virtual const TopTools_ListOfShape& Modified (const TopoDS_Shape& S) Standard_OVERRIDE;
|
||||
|
||||
//! Returns true if the shape has been removed from the result.
|
||||
Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& S) Standard_OVERRIDE;
|
||||
|
||||
//! Returns offset join type.
|
||||
Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user