mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-24 01:32:05 +05:00
Implement improvement PAL13394: disk building from circle
This commit is contained in:
parent
03ec0eb4cf
commit
70cba03a1c
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "BuildGUI_FaceDlg.h"
|
#include "BuildGUI_FaceDlg.h"
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOMImpl_Types.hxx"
|
||||||
|
#include "TColStd_MapOfInteger.hxx"
|
||||||
|
|
||||||
#include "SUIT_Session.h"
|
#include "SUIT_Session.h"
|
||||||
#include "SalomeApp_Application.h"
|
#include "SalomeApp_Application.h"
|
||||||
@ -64,7 +65,7 @@ BuildGUI_FaceDlg::BuildGUI_FaceDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
|
|||||||
|
|
||||||
GroupWire = new DlgRef_1Sel1Check_QTD(this, "GroupWire");
|
GroupWire = new DlgRef_1Sel1Check_QTD(this, "GroupWire");
|
||||||
GroupWire->GroupBox1->setTitle(tr("GEOM_FACE_FFW"));
|
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->CheckButton1->setText(tr("GEOM_FACE_OPT"));
|
||||||
GroupWire->PushButton1->setPixmap(image1);
|
GroupWire->PushButton1->setPixmap(image1);
|
||||||
|
|
||||||
@ -100,7 +101,10 @@ void BuildGUI_FaceDlg::Init()
|
|||||||
|
|
||||||
GroupWire->CheckButton1->setChecked(TRUE);
|
GroupWire->CheckButton1->setChecked(TRUE);
|
||||||
|
|
||||||
globalSelection( GEOM_WIRE );
|
TColStd_MapOfInteger aMap;
|
||||||
|
aMap.Add( GEOM_EDGE );
|
||||||
|
aMap.Add( GEOM_WIRE );
|
||||||
|
globalSelection( aMap );
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
@ -160,7 +164,7 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
|
|||||||
if (!myWires.length())
|
if (!myWires.length())
|
||||||
return;
|
return;
|
||||||
if(aNbSel != 1)
|
if(aNbSel != 1)
|
||||||
aName = tr("%1_wires").arg(aNbSel);
|
aName = tr("%1_objects").arg(aNbSel);
|
||||||
|
|
||||||
myEditCurrentArgument->setText( aName );
|
myEditCurrentArgument->setText( aName );
|
||||||
|
|
||||||
@ -178,7 +182,11 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument()
|
|||||||
if (send != GroupWire->PushButton1)
|
if (send != GroupWire->PushButton1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
globalSelection( GEOM_WIRE );
|
TColStd_MapOfInteger aMap;
|
||||||
|
aMap.Add( GEOM_EDGE );
|
||||||
|
aMap.Add( GEOM_WIRE );
|
||||||
|
globalSelection( aMap );
|
||||||
|
|
||||||
myEditCurrentArgument = GroupWire->LineEdit1;
|
myEditCurrentArgument = GroupWire->LineEdit1;
|
||||||
|
|
||||||
myEditCurrentArgument->setFocus();
|
myEditCurrentArgument->setFocus();
|
||||||
@ -195,7 +203,10 @@ void BuildGUI_FaceDlg::ActivateThisDialog()
|
|||||||
GEOMBase_Skeleton::ActivateThisDialog();
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
|
||||||
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
globalSelection( GEOM_WIRE );
|
TColStd_MapOfInteger aMap;
|
||||||
|
aMap.Add( GEOM_EDGE );
|
||||||
|
aMap.Add( GEOM_WIRE );
|
||||||
|
globalSelection( aMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ msgstr "Create A Face"
|
|||||||
|
|
||||||
#: GeometryGUI_FaceDlg.cxx:78
|
#: GeometryGUI_FaceDlg.cxx:78
|
||||||
msgid "GEOM_FACE_FFW"
|
msgid "GEOM_FACE_FFW"
|
||||||
msgstr "Face from a wire"
|
msgstr "Face from a closed wire and edge"
|
||||||
|
|
||||||
#: GeometryGUI_FaceDlg.cxx:103
|
#: GeometryGUI_FaceDlg.cxx:103
|
||||||
msgid "GEOM_FACE_OPT"
|
msgid "GEOM_FACE_OPT"
|
||||||
|
@ -170,8 +170,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
if (!MW.IsDone()) {
|
if (!MW.IsDone()) {
|
||||||
Standard_ConstructionError::Raise("Wire construction failed");
|
Standard_ConstructionError::Raise("Wire construction failed");
|
||||||
}
|
}
|
||||||
//W = TopoDS::Wire(aShapeBase);
|
W = MW;
|
||||||
W = MW;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Standard_NullObject::Raise
|
Standard_NullObject::Raise
|
||||||
@ -189,17 +188,30 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_ConstructionError::Raise("No wires given");
|
Standard_ConstructionError::Raise("No wires given");
|
||||||
}
|
}
|
||||||
|
|
||||||
// first wire
|
// first wire or edge
|
||||||
Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1));
|
Handle(GEOM_Function) aRefWire = Handle(GEOM_Function)::DownCast(aShapes->Value(1));
|
||||||
TopoDS_Shape aWire = aRefWire->GetValue();
|
TopoDS_Shape aWire = aRefWire->GetValue();
|
||||||
if (aWire.IsNull() || aWire.ShapeType() != TopAbs_WIRE) {
|
if (aWire.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
|
||||||
Standard_NullObject::Raise("Shape for face construction is null or not a wire");
|
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
|
// basic face
|
||||||
TopoDS_Shape FFace;
|
TopoDS_Shape FFace;
|
||||||
GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), FFace);
|
GEOMImpl_Block6Explorer::MakeFace(W1, aCI.GetIsPlanar(), FFace);
|
||||||
if (FFace.IsNull()) {
|
if (FFace.IsNull()) {
|
||||||
Standard_ConstructionError::Raise("Face construction failed");
|
Standard_ConstructionError::Raise("Face construction failed");
|
||||||
}
|
}
|
||||||
@ -221,11 +233,24 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Handle(GEOM_Function) aRefWire_i =
|
Handle(GEOM_Function) aRefWire_i =
|
||||||
Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
|
Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
|
||||||
TopoDS_Shape aWire_i = aRefWire_i->GetValue();
|
TopoDS_Shape aWire_i = aRefWire_i->GetValue();
|
||||||
if (aWire_i.IsNull() || aWire_i.ShapeType() != TopAbs_WIRE) {
|
if (aWire_i.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
|
||||||
Standard_NullObject::Raise("Shape for face construction is null or not a wire");
|
TopoDS_Wire W_i;
|
||||||
}
|
if(aWire_i.ShapeType() == TopAbs_WIRE) {
|
||||||
|
W_i = TopoDS::Wire(aWire_i);
|
||||||
FR.Add(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();
|
FR.Perform();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user