DCQ : Add Multi-Wire for MakeFace

This commit is contained in:
dcq 2004-03-22 17:02:07 +00:00
parent 7e4743151d
commit 4c60078497
5 changed files with 81 additions and 4 deletions

View File

@ -101,6 +101,9 @@ module GEOM
GEOM_Shape MakePlacedBox(in double x1, in double y1, in double z1,
in double delta1, in double delta2, in double delta3) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakePanel(in GEOM_Shape shape,
in short directiontype,
in double delta) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeGlueFaces(in GEOM_Shape shape,
in double tol3d) raises (SALOME::SALOME_Exception) ;
@ -234,8 +237,10 @@ module GEOM
in PointStruct pstruct2) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeWire (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeCompound (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeFace (in ListOfIOR ListShape,
in boolean wantplanarface ) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeFace (in GEOM_Shape shapeWire,
in boolean wantplanarface) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeFaces (in ListOfIOR ListShape,
in boolean wantplanarface) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeShell (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeSolid (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;

View File

@ -168,7 +168,7 @@ void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const Standard_Boolean wantPlanar)
{
try {
GEOM::GEOM_Shape_var result = myGeom->MakeFace(listShapesIOR, wantPlanar);
GEOM::GEOM_Shape_var result = myGeom->MakeFaces(listShapesIOR, wantPlanar);
if(result->_is_nil()) {
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
return;

View File

@ -63,6 +63,7 @@ using namespace std;
#else
#include <BRepAlgoAPI.hxx>
#endif
#include <BRepAlgo_FaceRestrictor.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepAlgoAPI_Common.hxx>
@ -3638,6 +3639,69 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFace( GEOM::GEOM_Shape_ptr wire,
}
//=================================================================================
// function : MakeFaces()
// purpose :
//=================================================================================
GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFaces(const GEOM::GEOM_Gen::ListOfIOR& ListShapes,
CORBA::Boolean wantplanarface)
throw (SALOME::SALOME_Exception)
{
GEOM::GEOM_Shape_var result;
try {
GEOM::GEOM_Shape_var aShape = GetIORFromString(ListShapes[0]);
TopoDS_Shape Shape = GetTopoShape(aShape);
if(Shape.IsNull() || Shape.ShapeType() != TopAbs_WIRE) {
THROW_SALOME_CORBA_EXCEPTION("Shell aborted : null shape during operation", SALOME::BAD_PARAM);
}
TopoDS_Wire W = TopoDS::Wire(Shape);
TopoDS_Shape FFace = BRepBuilderAPI_MakeFace(W, wantplanarface).Shape();
if(!FFace.IsNull()) {
if(ListShapes.length() == 1) {
result = CreateObject(FFace);
InsertInLabelMoreArguments(FFace, result, ListShapes, myCurrentOCAFDoc);
}
else if(ListShapes.length() >= 2) {
TopoDS_Compound C;
BRep_Builder aBuilder;
aBuilder.MakeCompound(C);
BRepAlgo_FaceRestrictor FR;
TopAbs_Orientation OriF = FFace.Orientation();
TopoDS_Shape aLocalS = FFace.Oriented(TopAbs_FORWARD);
FR.Init(TopoDS::Face(aLocalS), Standard_False, Standard_True);
for(unsigned int i = 0; i < ListShapes.length(); i++) {
GEOM::GEOM_Shape_var aShape = GetIORFromString(ListShapes[i]);
TopoDS_Shape Shape = GetTopoShape(aShape);
if(Shape.IsNull()) {
THROW_SALOME_CORBA_EXCEPTION("Shell aborted : null shape during operation", SALOME::BAD_PARAM);
}
FR.Add(TopoDS::Wire(Shape));
}
FR.Perform();
if(FR.IsDone()) {
for(; FR.More(); FR.Next())
aBuilder.Add(C, FR.Current().Oriented(OriF));
result = CreateObject(C);
InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc);
}
}
}
else {
THROW_SALOME_CORBA_EXCEPTION("Null result in GEOM_Gen_i::MakeFace", SALOME::BAD_PARAM);
}
}
catch (Standard_Failure) {
THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeFace", SALOME::BAD_PARAM);
}
return result;
}
//=================================================================================
// function : MakeShell()
// purpose : Make a compound from a list containing one or more shapes

View File

@ -388,7 +388,6 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen,
GEOM::GEOM_Shape_ptr MakePlacedBox(CORBA::Double x1, CORBA::Double y1, CORBA::Double z1,
CORBA::Double delta1, CORBA::Double delta2, CORBA::Double delta3)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakePanel(GEOM::GEOM_Shape_ptr shape,
CORBA::Short directiontype,
CORBA::Double delta)
@ -586,6 +585,9 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen,
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeFace (GEOM::GEOM_Shape_ptr wire, CORBA::Boolean wantplanarface)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeFaces (const GEOM::GEOM_Gen::ListOfIOR& ListShapes,
CORBA::Boolean wantplanarface)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeShell (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)
throw (SALOME::SALOME_Exception) ;
GEOM::GEOM_Shape_ptr MakeSolid (const GEOM::GEOM_Gen::ListOfIOR& ListShapes)

View File

@ -240,6 +240,12 @@ def MakeFace(aShapeWire,WantPlanarFace):
anObj._set_Name(ior)
return anObj
def MakeFaces(ListShape,WantPlanarFace):
anObj = geom.MakeFaces(ListShape,WantPlanarFace)
ior = salome.orb.object_to_string(anObj)
anObj._set_Name(ior)
return anObj
def MakeCompound(ListShape):
anObj = geom.MakeCompound(ListShape)
ior = salome.orb.object_to_string(anObj)