mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-22 09:30:32 +05:00
small modifications
This commit is contained in:
parent
ee148cc6a5
commit
87ceb14207
@ -203,83 +203,77 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const
|
||||
for(;anExp.More();anExp.Next())
|
||||
{
|
||||
solidCount++;
|
||||
if (solidCount > 1)
|
||||
Standard_ConstructionError::Raise("The input shape is a compound with more than one solid");
|
||||
}
|
||||
if (solidCount == 0)
|
||||
{
|
||||
Standard_ConstructionError::Raise("The input shape is a compound without any solid");
|
||||
}
|
||||
else if (solidCount > 1)
|
||||
{
|
||||
Standard_ConstructionError::Raise("The input shape is a compound with more than one solid");
|
||||
}
|
||||
}
|
||||
|
||||
TopoDS_Face aFaceBase;
|
||||
|
||||
if (aSketch.ShapeType() == TopAbs_FACE)
|
||||
// if (aSketch.ShapeType() == TopAbs_FACE)
|
||||
// {
|
||||
// aFaceBase = TopoDS::Face(aSketch);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
TopoDS_Wire aWire = TopoDS_Wire();
|
||||
|
||||
if (aSketch.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
aFaceBase = TopoDS::Face(aSketch);
|
||||
aWire = BRepBuilderAPI_MakeWire(TopoDS::Edge(aSketch));
|
||||
}
|
||||
else if (aSketch.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
aWire = TopoDS::Wire(aSketch);
|
||||
}
|
||||
else
|
||||
{
|
||||
TopoDS_Wire aWire = TopoDS_Wire();
|
||||
|
||||
if (aSketch.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
aWire = BRepBuilderAPI_MakeWire(TopoDS::Edge(aSketch));
|
||||
}
|
||||
else if (aSketch.ShapeType() == TopAbs_WIRE)
|
||||
{
|
||||
aWire = TopoDS::Wire(aSketch);
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_ConstructionError::Raise("The input sketch is not a wire, an edge or a face");
|
||||
}
|
||||
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices(aWire, aV1, aV2);
|
||||
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||
aWire.Closed( true );
|
||||
|
||||
if (!aWire.Closed())
|
||||
Standard_ConstructionError::Raise("The edge or wire is not closed");
|
||||
|
||||
// history of the Base wire (RefBase)
|
||||
Handle(GEOM_Object) aSuppObj;
|
||||
TDF_LabelSequence aLabelSeq;
|
||||
aRefBase->GetDependency(aLabelSeq);
|
||||
|
||||
// If the base wire has only one dependency we use it
|
||||
// to determine the right normal of the face which
|
||||
// must be oriented towards outside of the solid (like the support face)
|
||||
if (aLabelSeq.Length()==1)
|
||||
{
|
||||
TDF_Label anArgumentRefLabel = aLabelSeq.Value(1);
|
||||
aSuppObj = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
|
||||
}
|
||||
|
||||
// Construction of the face if the wire hasn't any support face
|
||||
aFaceBase = BRepBuilderAPI_MakeFace(aWire);
|
||||
|
||||
if(!aSuppObj.IsNull()) // If the wire has a support
|
||||
{
|
||||
TopoDS_Shape aSupport = aSuppObj->GetValue();
|
||||
if (aSupport.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aSupport));
|
||||
TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire);
|
||||
|
||||
if(aTempFace.Orientation() != TopoDS::Face(aSupport).Orientation())
|
||||
{
|
||||
aFaceBase=TopoDS::Face(aTempFace.Reversed());
|
||||
}
|
||||
else
|
||||
aFaceBase=aTempFace;
|
||||
}
|
||||
}
|
||||
Standard_ConstructionError::Raise("The input profile is neither a wire, nor edge");
|
||||
}
|
||||
|
||||
TopoDS_Vertex aV1, aV2;
|
||||
TopExp::Vertices(aWire, aV1, aV2);
|
||||
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||
aWire.Closed( true );
|
||||
|
||||
if (!aWire.Closed())
|
||||
Standard_ConstructionError::Raise("The input profile is not closed");
|
||||
|
||||
// history of the Base wire (RefBase)
|
||||
Handle(GEOM_Object) aSuppObj;
|
||||
TDF_LabelSequence aLabelSeq;
|
||||
aRefBase->GetDependency(aLabelSeq);
|
||||
|
||||
// If the base wire has only one dependency we use it
|
||||
// to determine the right normal of the face which
|
||||
// must be oriented towards outside of the solid (like the support face)
|
||||
if (aLabelSeq.Length()==1)
|
||||
{
|
||||
TDF_Label anArgumentRefLabel = aLabelSeq.Value(1);
|
||||
aSuppObj = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
|
||||
}
|
||||
|
||||
// Construction of the face if the wire hasn't any support face
|
||||
TopoDS_Face aFaceBase = BRepBuilderAPI_MakeFace(aWire);
|
||||
|
||||
if(!aSuppObj.IsNull()) // If the wire has a support
|
||||
{
|
||||
TopoDS_Shape aSupport = aSuppObj->GetValue();
|
||||
if (aSupport.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aSupport));
|
||||
TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire);
|
||||
|
||||
if(aTempFace.Orientation() != TopoDS::Face(aSupport).Orientation())
|
||||
{
|
||||
aFaceBase=TopoDS::Face(aTempFace.Reversed());
|
||||
}
|
||||
else
|
||||
aFaceBase=aTempFace;
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
// Invert height and angle if the operation is an extruded cut
|
||||
bool invert = !isProtrusion;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user