small modifications

This commit is contained in:
rnc 2012-03-05 15:33:17 +00:00
parent ee148cc6a5
commit 87ceb14207

View File

@ -203,82 +203,76 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const
for(;anExp.More();anExp.Next()) for(;anExp.More();anExp.Next())
{ {
solidCount++; solidCount++;
if (solidCount > 1)
Standard_ConstructionError::Raise("The input shape is a compound with more than one solid");
} }
if (solidCount == 0) if (solidCount == 0)
{
Standard_ConstructionError::Raise("The input shape is a compound without any solid"); 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)
// {
// aFaceBase = TopoDS::Face(aSketch);
// }
// else
// {
TopoDS_Wire aWire = TopoDS_Wire();
if (aSketch.ShapeType() == TopAbs_FACE) 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 else
{ {
TopoDS_Wire aWire = TopoDS_Wire(); Standard_ConstructionError::Raise("The input profile is neither a wire, nor edge");
}
if (aSketch.ShapeType() == TopAbs_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)
{ {
aWire = BRepBuilderAPI_MakeWire(TopoDS::Edge(aSketch)); Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aSupport));
} TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire);
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; if(aTempFace.Orientation() != TopoDS::Face(aSupport).Orientation())
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)); aFaceBase=TopoDS::Face(aTempFace.Reversed());
TopoDS_Face aTempFace = BRepBuilderAPI_MakeFace(aSurf, aWire);
if(aTempFace.Orientation() != TopoDS::Face(aSupport).Orientation())
{
aFaceBase=TopoDS::Face(aTempFace.Reversed());
}
else
aFaceBase=aTempFace;
} }
else
aFaceBase=aTempFace;
} }
} }
// }
// Invert height and angle if the operation is an extruded cut // Invert height and angle if the operation is an extruded cut
bool invert = !isProtrusion; bool invert = !isProtrusion;