DCQ : Add MakeFaces Method

This commit is contained in:
dcq 2004-04-08 08:14:25 +00:00
parent 9c483772d1
commit bc58667418
11 changed files with 130 additions and 51 deletions

View File

@ -238,7 +238,9 @@ module GEOM
GEOM_Shape MakeWire (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeCompound (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ;
GEOM_Shape MakeFace (in GEOM_Shape shapeWire,
in boolean wantplanarface ) raises (SALOME::SALOME_Exception) ;
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

@ -164,10 +164,11 @@ void BuildGUI::MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
// function : MakeFaceAndDisplay()
// purpose :
//=====================================================================================
void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar)
void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const Standard_Boolean wantPlanar)
{
try {
GEOM::GEOM_Shape_var result = myGeom->MakeFace(aWire, 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

@ -48,7 +48,8 @@ public :
void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
void MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boolean wantPlanar);
void MakeFaceAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const Standard_Boolean wantPlanar);
void MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);

View File

@ -52,7 +52,7 @@ BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, BuildGUI*
GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints");
GroupPoints->GroupBox1->setTitle(tr("GEOM_FACE_FFW"));
GroupPoints->TextLabel1->setText(tr("GEOM_WIRE"));
GroupPoints->TextLabel1->setText(tr("GEOM_WIRES"));
GroupPoints->CheckButton1->setText(tr("GEOM_FACE_OPT"));
GroupPoints->PushButton1->setPixmap(image1);
@ -85,7 +85,7 @@ void BuildGUI_FaceDlg::Init()
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->CheckButton1->setChecked(TRUE);
myOkShape = false;
myOkListShapes = false;
myWireFilter = new GEOM_ShapeTypeFilter(TopAbs_WIRE, myGeom);
mySelection->AddFilter(myWireFilter); /* first filter used */
@ -124,8 +124,8 @@ void BuildGUI_FaceDlg::ClickOnOk()
void BuildGUI_FaceDlg::ClickOnApply()
{
QAD_Application::getDesktop()->putInfo(tr(""));
if(myOkShape)
myBuildGUI->MakeFaceAndDisplay(myGeomShape, GroupPoints->CheckButton1->isChecked());
if(myOkListShapes)
myBuildGUI->MakeFaceAndDisplay(myListShapes, GroupPoints->CheckButton1->isChecked());
return;
}
@ -139,24 +139,17 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
myOkShape = false;
myOkListShapes = false;
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) {
if(nbSel == 0)
return;
}
if(nbSel != 1)
aString = tr("%1_objects").arg(nbSel);
myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
// nbSel == 1!
Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomBase->GetTopoFromSelection(mySelection, myShape))
return;
myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return;
myEditCurrentArgument->setText(aString);
myOkShape = true;
myOkListShapes = true;
/* no simulation */
return;
}
@ -176,23 +169,6 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument()
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void BuildGUI_FaceDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else
return;
GEOMBase_Skeleton::LineEditReturnPressed();
return;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :

View File

@ -57,9 +57,8 @@ private:
/* Filter selection */
Handle(GEOM_ShapeTypeFilter) myWireFilter;
TopoDS_Shape myShape; /* topology used to fuse */
GEOM::GEOM_Shape_var myGeomShape; /* is myShape */
bool myOkShape; /* to check when arguments is defined */
GEOM::GEOM_Gen::ListOfIOR myListShapes;
bool myOkListShapes; /* to check when arguments is defined */
DlgRef_1Sel1Check_QTD* GroupPoints;
@ -67,7 +66,6 @@ private slots:
void ClickOnOk();
void ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();

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>
@ -3684,6 +3685,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

@ -586,6 +586,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

@ -662,6 +662,10 @@ msgstr "Vertex"
msgid "GEOM_WIRE"
msgstr "Wire"
#Wire(s)
msgid "GEOM_WIRES"
msgstr "Wire(s)"
#Parameter
msgid "GEOM_PARAMETER"
msgstr "Parameter :"

View File

@ -635,6 +635,10 @@ msgstr "Vertex"
#Wire
msgid "GEOM_WIRE"
msgstr "Wire"
#Wire(s)
msgid "GEOM_WIRES"
msgstr "Wire(s)"
#Parameter
msgid "GEOM_PARAMETER"

View File

@ -152,6 +152,12 @@ def MakeCircle(p1,d1,radius):
anObj._set_Name(ior)
return anObj
def MakeEllipse(p1,d1,radiusMaj,radiusMin):
anObj = geom.MakeEllipse(p1,d1,radiusMaj, radiusMin)
ior = orb.object_to_string(anObj)
anObj._set_Name(ior)
return anObj
def MakePlane(p1,d1,trimsize):
anObj = geom.MakePlane(p1,d1,trimsize)
ior = orb.object_to_string(anObj)
@ -214,6 +220,12 @@ def MakeFace(aShapeWire,WantPlanarFace):
anObj._set_Name(ior)
return anObj
def MakeFaces(ListShape,WantPlanarFace):
anObj = geom.MakeFaces(ListShape,WantPlanarFace)
ior = orb.object_to_string(anObj)
anObj._set_Name(ior)
return anObj
def MakeCompound(ListShape):
anObj = geom.MakeCompound(ListShape)
ior = orb.object_to_string(anObj)
@ -356,10 +368,11 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
return anObj
def SuppressFaces(aShape,ListOfId):
anObj = geom.SuppressFaces(aShape,ListOfId)
ior = orb.object_to_string(anObj)
anObj._set_Name(ior)
return anObj
ListObj = geom.SuppressFaces(aShape,ListOfId)
for anObj in ListObj :
ior = orb.object_to_string(anObj)
anObj._set_Name(ior)
return ListObj
def SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace):
anObj = geom.SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace)

View File

@ -178,6 +178,12 @@ def MakeCircle(p1,d1,radius):
anObj._set_Name(ior)
return anObj
def MakeEllipse(p1,d1,radiusMaj,radiusMin):
anObj = geom.MakeEllipse(p1,d1,radiusMaj, radiusMin)
ior = orb.object_to_string(anObj)
anObj._set_Name(ior)
return anObj
def MakePlane(p1,d1,trimsize):
anObj = geom.MakePlane(p1,d1,trimsize)
ior = salome.orb.object_to_string(anObj)
@ -240,6 +246,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)
@ -382,10 +394,11 @@ def Partition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
return anObj
def SuppressFaces(aShape,ListOfId):
anObj = geom.SuppressFaces(aShape,ListOfId)
ior = salome.orb.object_to_string(anObj)
anObj._set_Name(ior)
return anObj
ListObj = geom.SuppressFaces(aShape,ListOfId)
for anObj in ListObj :
ior = salome.orb.object_to_string(anObj)
anObj._set_Name(ior)
return ListObj
def SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace):
anObj = geom.SuppressHole(aShape,ListOfFace,ListOfWire,ListOfEndFace)