mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-30 20:20:33 +05:00
0020598: EDF 1191 GEOM : Creation of hexa block from two faces
This commit is contained in:
parent
2b5e9d2459
commit
afe8b139b0
@ -983,6 +983,19 @@ void GEOMImpl_Block6Explorer::InitByTwoFaces (const TopoDS_Shape& theFace1,
|
|||||||
myEdges(edge_id(2, i)) = anEdges2(nb);
|
myEdges(edge_id(2, i)) = anEdges2(nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check the wires closure
|
||||||
|
TopoDS_Wire wire1 = TopoDS::Wire(aWire1);
|
||||||
|
TopoDS_Wire wire2 = TopoDS::Wire(aWire2);
|
||||||
|
TopoDS_Vertex aV1, aV2;
|
||||||
|
|
||||||
|
TopExp::Vertices(wire1, aV1, aV2);
|
||||||
|
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||||
|
aWire1.Closed( true );
|
||||||
|
|
||||||
|
TopExp::Vertices(wire2, aV1, aV2);
|
||||||
|
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||||
|
aWire2.Closed( true );
|
||||||
|
|
||||||
// 4. Generate side surface
|
// 4. Generate side surface
|
||||||
if (!aWire1.Closed() || !aWire2.Closed()) {
|
if (!aWire1.Closed() || !aWire2.Closed()) {
|
||||||
// BRepOffsetAPI_ThruSections is not applicable on not closed wires
|
// BRepOffsetAPI_ThruSections is not applicable on not closed wires
|
||||||
|
@ -235,6 +235,13 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
TopoDS_Wire aWire = *MW;
|
TopoDS_Wire aWire = *MW;
|
||||||
delete MW;
|
delete MW;
|
||||||
|
|
||||||
|
// check the wire closure
|
||||||
|
TopoDS_Vertex aV1, aV2;
|
||||||
|
TopExp::Vertices(aWire, aV1, aV2);
|
||||||
|
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||||
|
aWire.Closed( true );
|
||||||
|
|
||||||
if (!aWire.Closed()) {
|
if (!aWire.Closed()) {
|
||||||
Standard_ConstructionError::Raise
|
Standard_ConstructionError::Raise
|
||||||
("Impossible to build a closed wire from the given edges");
|
("Impossible to build a closed wire from the given edges");
|
||||||
@ -293,13 +300,27 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// build a wire
|
// build a wire
|
||||||
BRepBuilderAPI_MakeWire MW (anEdge1, anEdge3, anEdge2, anEdge4);
|
BRepBuilderAPI_MakeWire* MW;
|
||||||
if (!MW.IsDone()) {
|
MW = new BRepBuilderAPI_MakeWire(anEdge1, anEdge3, anEdge2, anEdge4);
|
||||||
|
if (!MW->IsDone()) {
|
||||||
Standard_ConstructionError::Raise("Wire construction failed");
|
Standard_ConstructionError::Raise("Wire construction failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopoDS_Wire aWire = *MW;
|
||||||
|
delete MW;
|
||||||
|
|
||||||
|
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
|
||||||
|
("Impossible to build a closed wire from the given edges");
|
||||||
|
}
|
||||||
|
|
||||||
// try to build face on the wire
|
// try to build face on the wire
|
||||||
GEOMImpl_Block6Explorer::MakeFace(MW, Standard_False, aShape);
|
GEOMImpl_Block6Explorer::MakeFace(aWire, Standard_False, aShape);
|
||||||
if (aShape.IsNull()) {
|
if (aShape.IsNull()) {
|
||||||
Standard_ConstructionError::Raise("Face construction failed");
|
Standard_ConstructionError::Raise("Face construction failed");
|
||||||
}
|
}
|
||||||
@ -357,6 +378,7 @@ Standard_Integer GEOMImpl_BlockDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// try to build face on the wire
|
// try to build face on the wire
|
||||||
|
aMkPoly.Close();
|
||||||
GEOMImpl_Block6Explorer::MakeFace(aMkPoly, Standard_False, aShape);
|
GEOMImpl_Block6Explorer::MakeFace(aMkPoly, Standard_False, aShape);
|
||||||
if (aShape.IsNull()) {
|
if (aShape.IsNull()) {
|
||||||
Standard_ConstructionError::Raise("Face construction failed");
|
Standard_ConstructionError::Raise("Face construction failed");
|
||||||
|
@ -84,7 +84,20 @@ Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const
|
|||||||
// if (!aMakePoly.Added()) return 0;
|
// if (!aMakePoly.Added()) return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (false) aMakePoly.Close();
|
// Compare first and last point coordinates and close polyline if it's the same.
|
||||||
|
if ( aLen > 2 ) {
|
||||||
|
Handle(GEOM_Function) aFPoint = aCI.GetPoint(1);
|
||||||
|
TopoDS_Shape aFirstPnt = aFPoint->GetValue();
|
||||||
|
TopoDS_Vertex aV1 = TopoDS::Vertex(aFirstPnt);
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen);
|
||||||
|
TopoDS_Shape aLastPnt = aLPoint->GetValue();
|
||||||
|
TopoDS_Vertex aV2 = TopoDS::Vertex(aLastPnt);
|
||||||
|
|
||||||
|
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||||
|
aMakePoly.Close();
|
||||||
|
}
|
||||||
|
|
||||||
if (aMakePoly.IsDone()) {
|
if (aMakePoly.IsDone()) {
|
||||||
aShape = aMakePoly.Wire();
|
aShape = aMakePoly.Wire();
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include <TopoDS_Solid.hxx>
|
#include <TopoDS_Solid.hxx>
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
@ -196,6 +197,14 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
TopoDS_Wire W;
|
TopoDS_Wire W;
|
||||||
if (aShapeBase.ShapeType() == TopAbs_WIRE) {
|
if (aShapeBase.ShapeType() == TopAbs_WIRE) {
|
||||||
W = TopoDS::Wire(aShapeBase);
|
W = TopoDS::Wire(aShapeBase);
|
||||||
|
// check the wire is closed
|
||||||
|
TopoDS_Vertex aV1, aV2;
|
||||||
|
TopExp::Vertices(W, aV1, aV2);
|
||||||
|
if ( !aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2) )
|
||||||
|
aShapeBase.Closed(true);
|
||||||
|
else
|
||||||
|
Standard_NullObject::Raise
|
||||||
|
("Shape for face construction is not closed");
|
||||||
}
|
}
|
||||||
else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) {
|
else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) {
|
||||||
BRepBuilderAPI_MakeWire MW;
|
BRepBuilderAPI_MakeWire MW;
|
||||||
|
Loading…
Reference in New Issue
Block a user