connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+
connect( myGroupWire->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
connect( myGroupWire->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( myGroupWire->CheckButton1, SIGNAL( toggled(bool) ), this, SLOT( OnPlanarCheck() ) );
+
connect( myGroupSurf->LineEdit1, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
connect( myGroupSurf->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( myGroupSurf->LineEdit2, SIGNAL( returnPressed()), this, SLOT( LineEditReturnPressed() ) );
connect( myGroupSurf->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+
connect( myGroupWireConstraints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( myGroupWireConstraints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SelectionIntoArgument();
}
+//=================================================================================
+// function : OnPlanarCheck()
+// purpose :
+//=================================================================================
+void BuildGUI_FaceDlg::OnPlanarCheck()
+{
+ erasePreview();
+ displayPreview( true, false, true, true, -1, -1, -1, true );
+}
//=================================================================================
// function : ActivateThisDialog()
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void OnPlanarCheck();
void onItemClicked( QTreeWidgetItem*, int );
};
const TopoDS_Edge& aEnew,
const TopoDS_Face& aF,
const Handle(IntTools_Context)& aCtx) ;
-
//
Standard_EXPORT
static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
#include <gp_Ax1.hxx>
#include <gp_Vec.hxx>
+#include <BRep_Tool.hxx>
+#include <TopLoc_Location.hxx>
+
#include <GeomAbs_SurfaceType.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <IntSurf_Quadric.hxx>
+#include <TopoDS.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Edge.hxx>
+#include <Geom2d_Curve.hxx>
+
//=======================================================================
//function : GetState
}
return bRet;
}
+//=======================================================================
+//function : IsBelongsToSameSurface
+//purpose : Returns true if all edges of theShape have a reference to
+// the same surface
+//=======================================================================
+Standard_Boolean GEOMAlgo_SurfaceTools::IsBelongsToSameSurface
+ (const TopoDS_Shape& theShape)
+{
+ Standard_Boolean aResult = false;
+
+ TopExp_Explorer ex;
+ ex.Init(theShape,TopAbs_EDGE);
+ if (!ex.More()) return aResult; // no edges ....
+
+ TopoDS_Edge anEdge = TopoDS::Edge(ex.Current());
+ Standard_Real f,l,ff,ll;
+ Handle(Geom2d_Curve) PC,aPPC;
+ Handle(Geom_Surface) aSurface, aCurSurface;
+ TopLoc_Location aLoc, aCurLoc;
+ Standard_Integer i = 0,j;
+
+ // iterate on the surfaces of the first edge
+ for(;;)
+ {
+ i++;
+ BRep_Tool::CurveOnSurface(anEdge,PC,aSurface,aLoc,f,l,i);
+ if (aSurface.IsNull())
+ {
+ break;
+ }
+ // check the other edges
+ for (ex.Init(theShape,TopAbs_EDGE); ex.More(); ex.Next())
+ {
+ if (!anEdge.IsSame(ex.Current()))
+ {
+ j = 0;
+ for(;;)
+ {
+ j++;
+ BRep_Tool::CurveOnSurface(TopoDS::Edge(ex.Current()),aPPC,aCurSurface,aCurLoc,ff,ll,j);
+ if (aCurSurface.IsNull()) {
+ break;
+ }
+ if ((aCurSurface == aSurface) && (aCurLoc.IsEqual(aLoc)))
+ {
+ break;
+ }
+ aCurSurface.Nullify();
+ }
+
+ if (aCurSurface.IsNull())
+ {
+ aSurface.Nullify();
+ break;
+ }
+ }
+ }
+
+ if (!aSurface.IsNull())
+ {
+ break;
+ }
+ }
+
+ if (!aSurface.IsNull())
+ {
+ aResult = Standard_True;
+ }
+
+ return aResult;
+
+}
\ No newline at end of file
#include <gp_Pln.hxx>
#include <gp_Sphere.hxx>
+#include <TopoDS_Shape.hxx>
//=======================================================================
//function : GEOMAlgo_SurfaceTools
Standard_EXPORT
static TopAbs_State ReverseState(const TopAbs_State aSt) ;
+ //! Returns true if all edges of theShape have a reference to the same surface
+ Standard_EXPORT
+ static Standard_Boolean IsBelongsToSameSurface(const TopoDS_Shape& theShape) ;
+
};
#endif
#include <Standard_Stream.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
+#include <GEOMAlgo_SurfaceTools.hxx>
#include <ShHealOper_ShapeProcess.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepBuilderAPI_FindPlane.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
const Standard_Boolean isPlanarWanted,
TopoDS_Shape& theResult)
{
+ TCollection_AsciiString aWarning;
+ BRepBuilderAPI_FindPlane aFindPlane(theWire);
+ if (aFindPlane.Found())
+ {
+ BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted);
+ if (MK.IsDone()) {
+ theResult = MK.Shape();
+ return aWarning;
+ }
+ }
+
if (!isPlanarWanted)
return MakeAnyFace(theWire, theResult);
// If required tolerance increase will be
// higher than PLANAR_FACE_MAX_TOLERANCE,
// we will try to build a non-planar face.
-
- TCollection_AsciiString aWarning;
- BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted);
- if (MK.IsDone()) {
- theResult = MK.Shape();
- return aWarning;
- }
-
// try to update wire tolerances to build a planar face
// Find a deviation
TopoDS_Shape& theResult)
{
TCollection_AsciiString aWarning;
-
- // try to build a face on any surface under the edges of the wire
- BRepBuilderAPI_MakeFace MK (theWire, Standard_False);
- if (MK.IsDone()) {
- theResult = MK.Shape();
- return aWarning;
+
+ //check if all edges already belong to the some surface
+ if(GEOMAlgo_SurfaceTools::IsBelongsToSameSurface(theWire))
+ {
+ BRepBuilderAPI_MakeFace MK (theWire, false);
+ if (MK.IsDone()) {
+ theResult = MK.Shape();
+ return aWarning;
+ }
}
// try to construct filling surface