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) ;
// 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;
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);
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);
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->CheckButton1->setChecked(TRUE);
- myOkShape = false;
+ myOkListShapes = false;
myWireFilter = new GEOM_ShapeTypeFilter(TopAbs_WIRE, myGeom);
mySelection->AddFilter(myWireFilter); /* first filter used */
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;
}
myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */
- myOkShape = false;
+ myOkListShapes = false;
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
- if(nbSel != 1) {
- return;
- }
-
- // nbSel == 1!
- Standard_Boolean testResult;
- Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
- if(!myGeomBase->GetTopoFromSelection(mySelection, myShape))
- return;
-
- myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
- if(!testResult)
+ if(nbSel == 0)
return;
+ if(nbSel != 1)
+ aString = tr("%1_objects").arg(nbSel);
+ myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
+
myEditCurrentArgument->setText(aString);
- myOkShape = true;
+ myOkListShapes = true;
/* no simulation */
return;
}
}
-//=================================================================================
-// 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 :
/* 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;
void ClickOnOk();
void ClickOnApply();
void ActivateThisDialog();
- void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
#else
#include <BRepAlgoAPI.hxx>
#endif
+#include <BRepAlgo_FaceRestrictor.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepAlgoAPI_Common.hxx>
}
+//=================================================================================
+// 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
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)
msgid "GEOM_WIRE"
msgstr "Wire"
+#Wire(s)
+msgid "GEOM_WIRES"
+msgstr "Wire(s)"
+
#Parameter
msgid "GEOM_PARAMETER"
msgstr "Parameter :"
#Wire
msgid "GEOM_WIRE"
msgstr "Wire"
+
+#Wire(s)
+msgid "GEOM_WIRES"
+msgstr "Wire(s)"
#Parameter
msgid "GEOM_PARAMETER"
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)
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)
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)
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)
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)
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)