#include "BuildGUI_FaceDlg.h"
#include "GEOMImpl_Types.hxx"
+#include "TColStd_MapOfInteger.hxx"
#include "SUIT_Session.h"
#include "SalomeApp_Application.h"
GroupWire = new DlgRef_1Sel1Check_QTD(this, "GroupWire");
GroupWire->GroupBox1->setTitle(tr("GEOM_FACE_FFW"));
- GroupWire->TextLabel1->setText(tr("GEOM_WIRES"));
+ GroupWire->TextLabel1->setText(tr("GEOM_OBJECTS"));
GroupWire->CheckButton1->setText(tr("GEOM_FACE_OPT"));
GroupWire->PushButton1->setPixmap(image1);
GroupWire->CheckButton1->setChecked(TRUE);
- globalSelection( GEOM_WIRE );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_EDGE );
+ aMap.Add( GEOM_WIRE );
+ globalSelection( aMap );
/* signals and slots connections */
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
if (!myWires.length())
return;
if(aNbSel != 1)
- aName = tr("%1_wires").arg(aNbSel);
+ aName = tr("%1_objects").arg(aNbSel);
myEditCurrentArgument->setText( aName );
if (send != GroupWire->PushButton1)
return;
- globalSelection( GEOM_WIRE );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_EDGE );
+ aMap.Add( GEOM_WIRE );
+ globalSelection( aMap );
+
myEditCurrentArgument = GroupWire->LineEdit1;
myEditCurrentArgument->setFocus();
GEOMBase_Skeleton::ActivateThisDialog();
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
- globalSelection( GEOM_WIRE );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_EDGE );
+ aMap.Add( GEOM_WIRE );
+ globalSelection( aMap );
}
if (!MW.IsDone()) {
Standard_ConstructionError::Raise("Wire construction failed");
}
- //W = TopoDS::Wire(aShapeBase);
- W = MW;
+ W = MW;
}
else {
Standard_NullObject::Raise
Standard_ConstructionError::Raise("No wires given");
}
- // first wire
+ // first wire or edge
Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1));
TopoDS_Shape aWire = aRefWire->GetValue();
- if (aWire.IsNull() || aWire.ShapeType() != TopAbs_WIRE) {
- Standard_NullObject::Raise("Shape for face construction is null or not a wire");
+ if (aWire.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
+ TopoDS_Wire W1;
+ if(aWire.ShapeType() == TopAbs_WIRE) {
+ W1 = TopoDS::Wire(aWire);
+ }
+ else if(aWire.ShapeType() == TopAbs_EDGE && aWire.Closed()) {
+ BRepBuilderAPI_MakeWire MW;
+ MW.Add(TopoDS::Edge(aWire));
+ if (!MW.IsDone()) {
+ Standard_ConstructionError::Raise("Wire construction failed");
+ }
+ W1 = MW;
+ }
+ else {
+ Standard_NullObject::Raise
+ ("Shape for face construction is neither a wire nor closed edge");
}
- TopoDS_Wire W = TopoDS::Wire(aWire);
// basic face
TopoDS_Shape FFace;
- GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), FFace);
+ GEOMImpl_Block6Explorer::MakeFace(W1, aCI.GetIsPlanar(), FFace);
if (FFace.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed");
}
Handle(GEOM_Function) aRefWire_i =
Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
TopoDS_Shape aWire_i = aRefWire_i->GetValue();
- if (aWire_i.IsNull() || aWire_i.ShapeType() != TopAbs_WIRE) {
- Standard_NullObject::Raise("Shape for face construction is null or not a wire");
- }
-
- FR.Add(TopoDS::Wire(aWire_i));
+ if (aWire_i.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
+ TopoDS_Wire W_i;
+ if(aWire_i.ShapeType() == TopAbs_WIRE) {
+ W_i = TopoDS::Wire(aWire_i);
+ }
+ else if(aWire_i.ShapeType() == TopAbs_EDGE && aWire_i.Closed()) {
+ BRepBuilderAPI_MakeWire MW1;
+ MW1.Add(TopoDS::Edge(aWire_i));
+ if (!MW1.IsDone()) {
+ Standard_ConstructionError::Raise("Wire construction failed");
+ }
+ W_i = MW1;
+ }
+ else {
+ Standard_NullObject::Raise
+ ("Shape for face construction is neither a wire nor closed edges");
+ }
+ FR.Add(W_i);
}
FR.Perform();