Merge from V6_4_BR 05/12/2011

This commit is contained in:
vsr 2011-12-05 10:29:45 +00:00
parent 4afdc688fc
commit 59c66d2ea4
38 changed files with 2612 additions and 143 deletions

View File

@ -24,7 +24,7 @@
# Modified by : Alexander BORODIN (OCN) - autotools usage # Modified by : Alexander BORODIN (OCN) - autotools usage
# Created from configure.in.base # Created from configure.in.base
# #
AC_INIT([Salome2 Project GEOM module], [6.3.1], [webmaster.salome@opencascade.com], [SalomeGEOM]) AC_INIT([Salome2 Project GEOM module], [6.4.0], [webmaster.salome@opencascade.com], [SalomeGEOM])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files) AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST AC_CANONICAL_HOST
AC_CANONICAL_TARGET AC_CANONICAL_TARGET

View File

@ -184,7 +184,7 @@ latex_documents = [
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
# the title page. # the title page.
latex_logo = '../salome/tui/images/head.png' latex_logo = '@srcdir@/../salome/tui/images/head.png'
# For "manual" documents, if this is true, then toplevel headings are parts, # For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters. # not chapters.

View File

@ -17,6 +17,8 @@ placement of the wires. If some resulting wires remain open, they will
be added in the resulting compound "as is". be added in the resulting compound "as is".
\n Check <b>Try to create a planar face</b> to create a planar \n Check <b>Try to create a planar face</b> to create a planar
face or nothing if it is impossible. face or nothing if it is impossible.
\note Please note, that the resulting face can have a huge tolerance, if the initial wire has a big deviation from the plane. If the final tolerance exceeds 1e-06, a warning will be shown, but the face will be created and published in the study in a normal way. Using such faces can lead to failures or unpredictable results in most operations.
\n The \b Result will be a \b GEOM_Object (FACE). \n The \b Result will be a \b GEOM_Object (FACE).
\n <b>TUI Command:</b> <em>geompy.MakeFaceWires([list of Shapes], isPlanarWanted)</em> \n <b>TUI Command:</b> <em>geompy.MakeFaceWires([list of Shapes], isPlanarWanted)</em>
@ -33,6 +35,6 @@ face or nothing if it is impossible.
\image html facesn3.png "Examples of faces" \image html facesn3.png "Examples of faces"
Our <b>TUI Scripts</b> provide you with useful examples of creation of Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_squareface "Primitives". \ref tui_creation_face "Advanced Geometric Objects".
*/ */

View File

@ -13,21 +13,15 @@
\anchor swig_MakeMarker \anchor swig_MakeMarker
\until cs3 \until cs3
\until MakePlaneThreePnt \until MakePlaneLCS
\anchor swig_MakeArc \anchor swig_MakeArc
\until MakeArcCenter \until MakeArcOfEllipse
\anchor swig_MakeCircle \anchor swig_MakeCircle
\until Circle2 \until Circle2
\until MakeVertexOnCurve \until MakeVertexOnCurveByLength
\until MakeVertexOnCurveByCoord
\until MakeVertexOnSurface
\until MakeVertexOnSurfaceByCoord
\anchor swig_MakeVertexOnLinesIntersection \anchor swig_MakeVertexOnLinesIntersection
\until p_on_l1l2 \until p_on_l1l2

View File

@ -72,7 +72,7 @@ under certain conditions:
\image html ob_popup_menu.png <br> \image html ob_popup_menu.png <br>
<ul> <ul>
<li>\subpage work_with_groups_page "Create Group" - allows creating groups of geometrical objects.</li> <li>\ref work_with_groups_page "Create Group" - allows creating groups of geometrical objects.</li>
<li><b>Hide Children</b> / <b>Show Children</b> - hides / shows child <li><b>Hide Children</b> / <b>Show Children</b> - hides / shows child
sub-objects in the Object Browser, if the selected geometric object has sub-objects in the Object Browser, if the selected geometric object has
child objects. When some child objects are hidden, the name of the child objects. When some child objects are hidden, the name of the

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : BuildGUI_FaceDlg.cxx // File : BuildGUI_FaceDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "BuildGUI_FaceDlg.h" #include "BuildGUI_FaceDlg.h"
#include <GEOMImpl_Types.hxx> #include <GEOMImpl_Types.hxx>
@ -33,11 +32,14 @@
#include <GeometryGUI.h> #include <GeometryGUI.h>
#include <GEOMBase.h> #include <GEOMBase.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
//================================================================================= //=================================================================================
// class : BuildGUI_FaceDlg() // class : BuildGUI_FaceDlg()
// purpose : Constructs a BuildGUI_FaceDlg which is a child of 'parent', with the // purpose : Constructs a BuildGUI_FaceDlg which is a child of 'parent', with the
@ -247,9 +249,17 @@ bool BuildGUI_FaceDlg::execute( ObjectList& objects )
GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() ); GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() );
if ( !anObj->_is_nil() ) if (!anObj->_is_nil()) {
objects.push_back( anObj._retn() ); objects.push_back(anObj._retn());
if (!anOper->IsDone() && QString(anOper->GetErrorCode()) == "MAKE_FACE_TOLERANCE_TOO_BIG") {
SUIT_OverrideCursor wc;
wc.suspend();
QString msgw = QObject::tr(anOper->GetErrorCode());
SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK"));
anOper->SetErrorCode("PAL_NO_ERROR");
}
}
return true; return true;
} }

View File

@ -157,7 +157,7 @@ EntityGUI_SketcherDlg::EntityGUI_SketcherDlg( GeometryGUI* GUI, QWidget* parent,
GroupD2 = new EntityGUI_Dir2( MainWidget->DestCnt ); GroupD2 = new EntityGUI_Dir2( MainWidget->DestCnt );
GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIR" ) ); GroupD2->GroupDir2->setTitle( tr( "GEOM_SKETCHER_DIST" ) );
GroupD2->RB_Dir21->setText( tr( "GEOM_SKETCHER_LENGTH" ) ); GroupD2->RB_Dir21->setText( tr( "GEOM_SKETCHER_LENGTH" ) );
GroupD2->RB_Dir22->setText( tr( "GEOM_SKETCHER_X" ) ); GroupD2->RB_Dir22->setText( tr( "GEOM_SKETCHER_X" ) );
GroupD2->RB_Dir23->setText( tr( "GEOM_SKETCHER_Y" ) ); GroupD2->RB_Dir23->setText( tr( "GEOM_SKETCHER_Y" ) );

View File

@ -544,7 +544,7 @@ int EntityGUI_SubShapeDlg::shapeType() const
// Solving PAL5590 // Solving PAL5590
type += myShape.ShapeType() + 1; type += myShape.ShapeType() + 1;
if (myShape.ShapeType() == TopAbs_COMPOUND && if (myShape.ShapeType() == TopAbs_COMPOUND &&
NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) { NumberOfSubShapes(myShape, TopAbs_COMPOUND) > 0) {
type--; type--;
} }
@ -573,11 +573,25 @@ void EntityGUI_SubShapeDlg::showOnlySelected()
GEOM_Displayer* aDisplayer = getDisplayer(); GEOM_Displayer* aDisplayer = getDisplayer();
if (send == GroupPoints->PushButton3) { if (send == GroupPoints->PushButton3) {
aDisplayer->Erase(aSelList, false, true); aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true);
} }
else { else {
aDisplayer->EraseAll(); // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myObject->GetStudyEntry();
Handle(SALOME_InteractiveObject) io =
new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
if (view->isVisible(io)) myIsHiddenMain = true;
}
aDisplayer->EraseAll(/*forced = false, updateViewer = true*/);
aDisplayer->Display(aSelList, true); aDisplayer->Display(aSelList, true);
// Mantis issue 0021421: do not hide main shape, if explode on VERTEX
if ((TopAbs_ShapeEnum)shapeType() == TopAbs_VERTEX && myIsHiddenMain) {
aDisplayer->Display(myObject);
}
} }
} }
@ -658,13 +672,22 @@ void EntityGUI_SubShapeDlg::activateSelection()
if (!myObject->_is_nil() && !isAllSubShapes()) if (!myObject->_is_nil() && !isAllSubShapes())
{ {
GEOM_Displayer* aDisplayer = getDisplayer(); GEOM_Displayer* aDisplayer = getDisplayer();
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) { // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
CORBA::String_var aMainEntry = myObject->GetStudyEntry(); if ((TopAbs_ShapeEnum)shapeType() == TopAbs_VERTEX) {
Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); if (myIsHiddenMain)
if (view->isVisible(io)) { aDisplayer->Display(myObject);
aDisplayer->Erase(myObject, false, false); }
myIsHiddenMain = true; else {
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myObject->GetStudyEntry();
Handle(SALOME_InteractiveObject) io =
new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
if (view->isVisible(io)) {
aDisplayer->Erase(myObject, false, false);
myIsHiddenMain = true;
}
} }
} }

View File

@ -32,6 +32,7 @@ uses
State from TopAbs, State from TopAbs,
ShapeEnum from TopAbs, ShapeEnum from TopAbs,
Pnt from gp, Pnt from gp,
Pnt2d from gp,
Shape from TopoDS, Shape from TopoDS,
Vertex from TopoDS, Vertex from TopoDS,
Edge from TopoDS, Edge from TopoDS,
@ -235,6 +236,18 @@ is
-- If the method returns True theEdgeOff is the -- If the method returns True theEdgeOff is the
-- edge founded -- edge founded
returns Boolean from Standard; returns Boolean from Standard;
--modified by NIZNHY-PKV Tue Nov 22 12:18:30 2011f
PntInFace(myclass;
theF : Face from TopoDS;
theP :out Pnt from gp;
theP2D:out Pnt2d from gp)
---Purpose: Computes a point <theP> inside the face <theF>.
-- <theP2D> - 2D representation of <theP>
-- on the surface of <theF>
-- Returns 0 in case of success.
returns Integer from Standard;
--modified by NIZNHY-PKV Tue Nov 22 12:18:36 2011t
--fields --fields
end Tools3D; end Tools3D;

View File

@ -33,10 +33,19 @@
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <gp_Pln.hxx> #include <gp_Pln.hxx>
#include <gp_XYZ.hxx> #include <gp_XYZ.hxx>
#include <gp_Dir2d.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dHatch_Intersector.hxx>
#include <Geom2dHatch_Hatcher.hxx>
#include <HatchGen_Domain.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx> #include <GeomAPI_ProjectPointOnSurf.hxx>
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
@ -69,6 +78,7 @@
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
#include <BRepTools.hxx>
#include <IntTools_Context.hxx> #include <IntTools_Context.hxx>
#include <IntTools_Tools.hxx> #include <IntTools_Tools.hxx>
@ -113,11 +123,11 @@ static
//function : IsInternalFace //function : IsInternalFace
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace, Standard_Boolean GEOMAlgo_Tools3D::IsInternalFace(const TopoDS_Face& theFace,
const TopoDS_Solid& theSolid, const TopoDS_Solid& theSolid,
const TopTools_IndexedDataMapOfShapeListOfShape& theMEF, const TopTools_IndexedDataMapOfShapeListOfShape& theMEF,
const Standard_Real theTol, const Standard_Real theTol,
IntTools_Context& theContext) IntTools_Context& theContext)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
Standard_Integer aNbF; Standard_Integer aNbF;
@ -267,9 +277,6 @@ static
// //
GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1, theContext); GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1, theContext);
GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2, theContext); GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2, theContext);
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE1, theFace1, aT, aPF1, aDNF1);
//BOPTools_Tools3D::GetApproxNormalToFaceOnEdge (aE2, theFace2, aT, aPF2, aDNF2);
// //
aTwoPI=2.*PI; aTwoPI=2.*PI;
gp_Vec aVBF (aPx, aPF ); gp_Vec aVBF (aPx, aPF );
@ -635,13 +642,39 @@ Standard_Boolean GEOMAlgo_Tools3D::GetEdgeOff (const TopoDS_Edge& theE1,
} }
} }
} }
//
//modified by NIZNHY-PKV Tue Nov 22 10:50:30 2011f
if (!bFound) {
Standard_Boolean bFlag;
Standard_Integer iErr;
gp_Pnt2d aP2DFSp;
//
iErr=GEOMAlgo_Tools3D::PntInFace(theFSp, aPFSp, aP2DFSp);
if (iErr) {
return bRet;
}
//
aP2DFSp.Coord(aU, aV);
bFlag=BOPTools_Tools3D::GetNormalToSurface(aSp, aU, aV, aDNFSp);
if (!bFlag) {
return bRet;
}
}
else {
BRep_Tool::Range(aESp, aT1, aT2);
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp);
}
//
/*
if (!bFound) { if (!bFound) {
return bRet; return bRet;
} }
//
BRep_Tool::Range(aESp, aT1, aT2); BRep_Tool::Range(aESp, aT1, aT2);
aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2); aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp); BOPTools_Tools3D::GetApproxNormalToFaceOnEdge(aESp, theFSp, aT, aPFSp, aDNFSp);
*/
//modified by NIZNHY-PKV Tue Nov 22 10:50:37 2011t
// //
// Parts of theContext.ComputeVS(..) // Parts of theContext.ComputeVS(..)
GeomAPI_ProjectPointOnSurf& aProjector=theContext.ProjPS(theFSr); GeomAPI_ProjectPointOnSurf& aProjector=theContext.ProjPS(theFSr);
@ -1111,7 +1144,6 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
dT=dR; dT=dR;
} }
} }
//modified by NIZNHY-PKV Thu Dec 02 10:39:09 2010f
else if (GeomAbs_Torus || else if (GeomAbs_Torus ||
aTS==GeomAbs_Cylinder){ aTS==GeomAbs_Cylinder){
Standard_Real aTolEx, aTolFx, aTol; Standard_Real aTolEx, aTolFx, aTol;
@ -1123,7 +1155,6 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
dT=aTol; dT=aTol;
} }
} }
//modified by NIZNHY-PKV Thu Dec 02 10:39:13 2010t
} }
//---------------------------------------------- //----------------------------------------------
// //
@ -1147,3 +1178,124 @@ void GetApproxNormalToFaceOnEdge (const TopoDS_Edge& aEx,
} }
} }
} }
//modified by NIZNHY-PKV Tue Nov 22 10:36:59 2011f
//=======================================================================
//function : PntInFace
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Tools3D::PntInFace(const TopoDS_Face& aF,
gp_Pnt& theP,
gp_Pnt2d& theP2D)
{
Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
Standard_Integer iErr, aIx, aNbDomains, i;
Standard_Real aUMin, aUMax, aVMin, aVMax;
Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
gp_Dir2d aD2D (0., 1.);
gp_Pnt2d aP2D;
gp_Pnt aPx;
Handle(Geom2d_Curve) aC2D;
Handle(Geom2d_TrimmedCurve) aCT2D;
Handle(Geom2d_Line) aL2D;
Handle(Geom_Surface) aS;
TopAbs_Orientation aOrE;
TopoDS_Face aFF;
TopExp_Explorer aExp;
//
aTolHatch2D=1.e-8;
aTolHatch3D=1.e-8;
aTotArcIntr=1.e-10;
aTolTangfIntr=1.e-10;
//
Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
Geom2dHatch_Hatcher aHatcher(aIntr,
aTolHatch2D, aTolHatch3D,
Standard_True, Standard_False);
//
iErr=0;
aEpsT=1.e-12;
//
aFF=aF;
aFF.Orientation (TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFF);
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
//
// 1
aExp.Init (aFF, TopAbs_EDGE);
for (; aExp.More() ; aExp.Next()) {
const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
aOrE=aE.Orientation();
//
aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
if (aC2D.IsNull() ) {
iErr=1;
return iErr;
}
if (fabs(aU1-aU2) < aEpsT) {
iErr=2;
return iErr;
}
//
aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
aHatcher.AddElement(aCT2D, aOrE);
}// for (; aExp.More() ; aExp.Next()) {
//
// 2
aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
aP2D.SetCoord(aUx, 0.);
aL2D=new Geom2d_Line (aP2D, aD2D);
Geom2dAdaptor_Curve aHCur(aL2D);
//
aIx=aHatcher.AddHatching(aHCur) ;
//
// 3.
aHatcher.Trim();
bIsDone=aHatcher.TrimDone(aIx);
if (!bIsDone) {
iErr=3;
return iErr;
}
//
aHatcher.ComputeDomains(aIx);
bIsDone=aHatcher.IsDone(aIx);
if (!bIsDone) {
iErr=4;
return iErr;
}
//
// 4.
aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) {
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
bHasFirstPoint=aDomain.HasFirstPoint();
if (!bHasFirstPoint) {
iErr=5;
return iErr;
}
//
aV1=aDomain.FirstPoint().Parameter();
//
bHasSecondPoint=aDomain.HasSecondPoint();
if (!bHasSecondPoint) {
iErr=6;
return iErr;
}
//
aV2=aDomain.SecondPoint().Parameter();
//
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
//
break;
}
//
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);
theP=aPx;
//
return iErr;
}
//modified by NIZNHY-PKV Tue Nov 22 10:37:01 2011t

View File

@ -46,6 +46,7 @@ class TopTools_ListOfShape;
class TopTools_IndexedMapOfShape; class TopTools_IndexedMapOfShape;
class TopoDS_Solid; class TopoDS_Solid;
class gp_Pnt; class gp_Pnt;
class gp_Pnt2d;
class TopoDS_Vertex; class TopoDS_Vertex;
class TopTools_IndexedDataMapOfShapeListOfShape; class TopTools_IndexedDataMapOfShapeListOfShape;
class NMTTools_ListOfCoupleOfShape; class NMTTools_ListOfCoupleOfShape;
@ -188,6 +189,11 @@ Standard_EXPORT static Standard_Boolean GetEdgeOnFace(const TopoDS_Edge& theEdg
//! edge founded <br> //! edge founded <br>
Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOff) ; Standard_EXPORT static Standard_Boolean GetEdgeOff(const TopoDS_Edge& theEdge,const TopoDS_Face& theFace,TopoDS_Edge& theEdgeOff) ;
//! Computes a point <theP> inside the face <theF>. <br>
//! <theP2D> - 2D representation of <theP> <br>
//! on the surface of <theF> <br>
//! Returns 0 in case of success. <br>
Standard_EXPORT static Standard_Integer PntInFace(const TopoDS_Face& theF,gp_Pnt& theP,gp_Pnt2d& theP2D) ;

View File

@ -53,6 +53,9 @@
#ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile #ifndef _NMTTools_ListOfCoupleOfShape_HeaderFile
#include <NMTTools_ListOfCoupleOfShape.hxx> #include <NMTTools_ListOfCoupleOfShape.hxx>
#endif #endif
#ifndef _gp_Pnt2d_HeaderFile
#include <gp_Pnt2d.hxx>
#endif
#ifndef _GEOMAlgo_Tools3D_HeaderFile #ifndef _GEOMAlgo_Tools3D_HeaderFile
#include <GEOMAlgo_Tools3D.hxx> #include <GEOMAlgo_Tools3D.hxx>
#endif #endif

View File

@ -605,6 +605,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_FACE_OPT</source> <source>GEOM_FACE_OPT</source>
<translation>Try to create a planar face</translation> <translation>Try to create a planar face</translation>
</message> </message>
<message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>Tolerance of resulting face is too big</translation>
</message>
<message> <message>
<source>GEOM_FACE_OR_LCS</source> <source>GEOM_FACE_OR_LCS</source>
<translation>Face or LCS</translation> <translation>Face or LCS</translation>
@ -1589,6 +1593,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SKETCHER_DIR</source> <source>GEOM_SKETCHER_DIR</source>
<translation>Direction</translation> <translation>Direction</translation>
</message> </message>
<message>
<source>GEOM_SKETCHER_DIST</source>
<translation>Distance</translation>
</message>
<message> <message>
<source>GEOM_SKETCHER_DX2</source> <source>GEOM_SKETCHER_DX2</source>
<translation>DX :</translation> <translation>DX :</translation>
@ -1703,7 +1711,7 @@ Please, select face, shell or solid and try again</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_X3</source> <source>GEOM_SKETCHER_X3</source>
<translation>Abs. X :</translation> <translation>DX :</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_Y</source> <source>GEOM_SKETCHER_Y</source>
@ -1715,7 +1723,7 @@ Please, select face, shell or solid and try again</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_Y3</source> <source>GEOM_SKETCHER_Y3</source>
<translation>Abs. Y :</translation> <translation>DY :</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_Z2</source> <source>GEOM_SKETCHER_Z2</source>

View File

@ -489,6 +489,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_DIMENSIONS</source> <source>GEOM_DIMENSIONS</source>
<translation>Dimensions</translation> <translation>Dimensions</translation>
</message> </message>
<message>
<source>GEOM_SKETCHER_DIST</source>
<translation>Distance</translation>
</message>
<message> <message>
<source>GEOM_DISTANCE</source> <source>GEOM_DISTANCE</source>
<translation>Distance</translation> <translation>Distance</translation>
@ -605,6 +609,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_FACE_OPT</source> <source>GEOM_FACE_OPT</source>
<translation>Privilégier la création d&apos;une face plane</translation> <translation>Privilégier la création d&apos;une face plane</translation>
</message> </message>
<message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>La face créée a une tolérance élevée</translation>
</message>
<message> <message>
<source>GEOM_FACE_OR_LCS</source> <source>GEOM_FACE_OR_LCS</source>
<translation>Face ou SCL</translation> <translation>Face ou SCL</translation>
@ -1703,7 +1711,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_X3</source> <source>GEOM_SKETCHER_X3</source>
<translation>Abs. X :</translation> <translation>DX :</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_Y</source> <source>GEOM_SKETCHER_Y</source>
@ -1715,7 +1723,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_Y3</source> <source>GEOM_SKETCHER_Y3</source>
<translation>Abs. Y :</translation> <translation>DY :</translation>
</message> </message>
<message> <message>
<source>GEOM_SKETCHER_Z2</source> <source>GEOM_SKETCHER_Z2</source>

View File

@ -23,6 +23,9 @@
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows #include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
#ifdef HAVE_FINITE
#undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
#endif
#include "Python.h" #include "Python.h"
#include "GeometryGUI.h" #include "GeometryGUI.h"
#include "GeometryGUI_Operations.h" #include "GeometryGUI_Operations.h"

View File

@ -0,0 +1,111 @@
// File: BRepBuilderAPI_GTransform_21423.cxx
// Created: Mon Dec 30 17:12:14 1996
// Author: Stagiaire Mary FABIEN
// <fbi@zozox.paris1.matra-dtv.fr>
#include <BRepBuilderAPI_GTransform_21423.hxx>
#include <Standard_NoSuchObject.hxx>
#include <gp_GTrsf.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepTools_GTrsfModification.hxx>
#include <BRepTools_NurbsConvertModification_21423.hxx>
#include <BRepBuilderAPI_NurbsConvert_21423.hxx>
#include <gp.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
//=======================================================================
//function : BRepBuilderAPI_GTransform_21423
//purpose :
//=======================================================================
BRepBuilderAPI_GTransform_21423::BRepBuilderAPI_GTransform_21423 (const gp_GTrsf& T) :
myGTrsf(T)
{
myModification = new BRepTools_GTrsfModification(T);
}
//=======================================================================
//function : BRepBuilderAPI_GTransform_21423
//purpose :
//=======================================================================
BRepBuilderAPI_GTransform_21423::BRepBuilderAPI_GTransform_21423 (const TopoDS_Shape& S,
const gp_GTrsf& T,
const Standard_Boolean Copy) :
myGTrsf(T)
{
myModification = new BRepTools_GTrsfModification(T);
Perform(S,Copy);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepBuilderAPI_GTransform_21423::Perform(const TopoDS_Shape& S,
const Standard_Boolean Copy)
{
BRepBuilderAPI_NurbsConvert_21423 nc;
nc.Perform(S, Copy);
myHist.Add(S,nc);
TopoDS_Shape Slocal = nc.Shape();
Handle(BRepTools_GTrsfModification) theModif =
Handle(BRepTools_GTrsfModification)::DownCast(myModification);
theModif->GTrsf() = myGTrsf;
DoModif(Slocal,myModification);
// myHist.Filter (Shape());
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepBuilderAPI_GTransform_21423::Modified
(const TopoDS_Shape& F)
{
myGenerated.Clear();
const TopTools_DataMapOfShapeListOfShape& M = myHist.Modification();
if (M.IsBound(F)) {
TopTools_ListOfShape Li;
TopTools_ListIteratorOfListOfShape itL(M(F));
for (;itL.More();itL.Next())
Li.Assign(BRepBuilderAPI_ModifyShape_21423::Modified(itL.Value()));
}
return myGenerated;
}
//=======================================================================
//function : ModifiedShape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepBuilderAPI_GTransform_21423::ModifiedShape
(const TopoDS_Shape& S) const
{
const TopTools_DataMapOfShapeListOfShape &aMapModif = myHist.Modification();
TopoDS_Shape aShape = S;
if (aMapModif.IsBound(S)) {
const TopTools_ListOfShape &aListModShape = aMapModif(S);
Standard_Integer aNbShapes = aListModShape.Extent();
if (aNbShapes > 0)
aShape = aListModShape.First();
}
return BRepBuilderAPI_ModifyShape_21423::ModifiedShape(aShape);
}

View File

@ -0,0 +1,137 @@
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BRepBuilderAPI_GTransform_21423_HeaderFile
#define _BRepBuilderAPI_GTransform_21423_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _gp_GTrsf_HeaderFile
#include <gp_GTrsf.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _BRepBuilderAPI_Collect_HeaderFile
#include <BRepBuilderAPI_Collect.hxx>
#endif
#ifndef _BRepBuilderAPI_ModifyShape_21423_HeaderFile
#include <BRepBuilderAPI_ModifyShape_21423.hxx>
#endif
class Standard_NoSuchObject;
class gp_GTrsf;
class TopoDS_Shape;
class TopTools_ListOfShape;
//! Geometric transformation on a shape. <br>
//! The transformation to be applied is defined as a gp_GTrsf <br>
//! transformation. It may be: <br>
//! - a transformation equivalent to a gp_Trsf transformation, the <br>
//! most common case: you should , however, use a BRepAPI_Transform <br>
//! object to perform this kind of transformation; or <br>
//! - an affinity, or <br>
//! - more generally, any type of point transformation which may <br>
//! be defined by a three row, four column matrix of transformation. <br>
//! In the last two cases, the underlying geometry of the <br>
//! following shapes may change: <br>
//! - a curve which supports an edge of the shape, or <br>
//! - a surface which supports a face of the shape; <br>
//! For example, a circle may be transformed into an ellipse when <br>
//! applying an affinity transformation. <br>
//! The transformation is applied to: <br>
//! - all the curves which support edges of the shape, and <br>
//! - all the surfaces which support faces of the shape. <br>
//! A GTransform object provides a framework for: <br>
//! - defining the geometric transformation to be applied, <br>
//! - implementing the transformation algorithm, and <br>
//! - consulting the result. <br>
class BRepBuilderAPI_GTransform_21423 : public BRepBuilderAPI_ModifyShape_21423 {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Constructs a framework for applying the geometric <br>
//! transformation T to a shape. Use the function <br>
//! Perform to define the shape to transform. <br>
Standard_EXPORT BRepBuilderAPI_GTransform_21423(const gp_GTrsf& T);
//! Constructs a framework for applying the geometric <br>
//! transformation T to a shape, and applies it to the shape S. <br>
//! - If the transformation T is direct and isometric (i.e. if <br>
//! the determinant of the vectorial part of T is equal to <br>
//! 1.), and if Copy equals false (default value), the <br>
//! resulting shape is the same as the original but with <br>
//! a new location assigned to it. <br>
//! - In all other cases, the transformation is applied to <br>
//! a duplicate of S. <br>
//! Use the function Shape to access the result. <br>
//! Note: the constructed framework can be reused to <br>
//! apply the same geometric transformation to other <br>
//! shapes: just specify them with the function Perform. <br>
Standard_EXPORT BRepBuilderAPI_GTransform_21423(const TopoDS_Shape& S,const gp_GTrsf& T,const Standard_Boolean Copy = Standard_False);
//! Applies the geometric transformation defined at the <br>
//! time of construction of this framework to the shape S. <br>
//! - If the transformation T is direct and isometric (i.e. if <br>
//! the determinant of the vectorial part of T is equal to <br>
//! 1.), and if Copy equals false (default value), the <br>
//! resulting shape is the same as the original but with <br>
//! a new location assigned to it. <br>
//! - In all other cases, the transformation is applied to a duplicate of S. <br>
//! Use the function Shape to access the result. <br>
//! Note: this framework can be reused to apply the same <br>
//! geometric transformation to other shapes: just specify <br>
//! them by calling the function Perform again. <br>
Standard_EXPORT void Perform(const TopoDS_Shape& S,const Standard_Boolean Copy = Standard_False) ;
//! Returns the list of shapes modified from the shape <br>
//! <S>. <br>
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;
//! Returns the modified shape corresponding to <S>. <br>
Standard_EXPORT virtual const TopoDS_Shape& ModifiedShape(const TopoDS_Shape& S) const;
protected:
private:
gp_GTrsf myGTrsf;
Standard_Boolean myUseModif;
BRepBuilderAPI_Collect myHist;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif

View File

@ -0,0 +1,144 @@
// File: BRepBuilderAPI_ModifyShape_21423.cxx
// Created: Fri Dec 2 10:37:08 1994
// Author: Jacques GOUSSARD
// <jag@topsn2>
#include <BRepBuilderAPI_ModifyShape_21423.hxx>
#include <BRepTools_Modification.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_NoSuchObject.hxx>
//=======================================================================
//function : BRepBuilderAPI_ModifyShape_21423
//purpose :
//=======================================================================
BRepBuilderAPI_ModifyShape_21423::BRepBuilderAPI_ModifyShape_21423 () {}
//=======================================================================
//function : BRepBuilderAPI_ModifyShape_21423
//purpose :
//=======================================================================
BRepBuilderAPI_ModifyShape_21423::BRepBuilderAPI_ModifyShape_21423 (const TopoDS_Shape& S):
myModifier(S), myInitialShape(S)
{}
//=======================================================================
//function : BRepBuilderAPI_ModifyShape_21423
//purpose :
//=======================================================================
BRepBuilderAPI_ModifyShape_21423::BRepBuilderAPI_ModifyShape_21423
(const Handle(BRepTools_Modification)& M)
{
myModification = M;
}
//=======================================================================
//function : BRepBuilderAPI_ModifyShape_21423
//purpose :
//=======================================================================
BRepBuilderAPI_ModifyShape_21423::BRepBuilderAPI_ModifyShape_21423
(const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M): myModifier(S),myInitialShape(S)
{
myModification = M;
DoModif();
}
//=======================================================================
//function : DoModif
//purpose :
//=======================================================================
void BRepBuilderAPI_ModifyShape_21423::DoModif ()
{
if (myInitialShape.IsNull() || myModification.IsNull()) {
Standard_NullObject::Raise();
}
myModifier.Perform(myModification);
if (myModifier.IsDone()) {
Done();
myShape = myModifier.ModifiedShape(myInitialShape);
}
else {
NotDone();
}
}
//=======================================================================
//function : DoModif
//purpose :
//=======================================================================
void BRepBuilderAPI_ModifyShape_21423::DoModif (const TopoDS_Shape& S)
{
if (!S.IsEqual(myInitialShape) || !IsDone()) {
myInitialShape = S;
myModifier.Init(S);
DoModif();
}
}
//=======================================================================
//function : DoModif
//purpose :
//=======================================================================
void BRepBuilderAPI_ModifyShape_21423::DoModif (const Handle(BRepTools_Modification)& M)
{
myModification = M;
DoModif();
}
//=======================================================================
//function : DoModif
//purpose :
//=======================================================================
void BRepBuilderAPI_ModifyShape_21423::DoModif (const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M)
{
myInitialShape = S;
myModifier.Init(S);
myModification = M;
DoModif();
}
//=======================================================================
//function : ModifiedShape
//purpose :
//=======================================================================
const TopoDS_Shape& BRepBuilderAPI_ModifyShape_21423::ModifiedShape
(const TopoDS_Shape& S) const
{
return myModifier.ModifiedShape(S);
}
//=======================================================================
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& BRepBuilderAPI_ModifyShape_21423::Modified
(const TopoDS_Shape& F)
{
myGenerated.Clear();
myGenerated.Append(myModifier.ModifiedShape(F));
return myGenerated;
}

View File

@ -0,0 +1,129 @@
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BRepBuilderAPI_ModifyShape_21423_HeaderFile
#define _BRepBuilderAPI_ModifyShape_21423_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _BRepTools_Modifier_21423_HeaderFile
#include <BRepTools_Modifier_21423.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _Handle_BRepTools_Modification_HeaderFile
#include <Handle_BRepTools_Modification.hxx>
#endif
#ifndef _BRepBuilderAPI_MakeShape_HeaderFile
#include <BRepBuilderAPI_MakeShape.hxx>
#endif
class BRepTools_Modification;
class Standard_NullObject;
class Standard_NoSuchObject;
class TopoDS_Shape;
class TopTools_ListOfShape;
//! Implements the methods of MakeShape for the <br>
//! constant topology modifications. The methods are <br>
//! implemented when the modification uses a Modifier <br>
//! from BRepTools. Some of them have to be redefined <br>
//! if the modification is implemented with another <br>
//! tool (see Transform from BRepBuilderAPI for example). <br>
//! The BRepBuilderAPI package provides the following <br>
//! frameworks to perform modifications of this sort: <br>
//! - BRepBuilderAPI_Copy to produce the copy of a shape, <br>
//! - BRepBuilderAPI_Transform and <br>
//! BRepBuilderAPI_GTransform to apply a geometric <br>
//! transformation to a shape, <br>
//! - BRepBuilderAPI_NurbsConvert_21423 to convert the <br>
//! whole geometry of a shape into NURBS geometry, <br>
//! - BRepOffsetAPI_DraftAngle to build a tapered shape. <br>
class BRepBuilderAPI_ModifyShape_21423 : public BRepBuilderAPI_MakeShape {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Returns the list of shapes modified from the shape <br>
//! <S>. <br>
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;
//! Returns the modified shape corresponding to <S>. <br>
//! S can correspond to the entire initial shape or to its subshape. <br>
//! Exceptions <br>
//! Standard_NoSuchObject if S is not the initial shape or <br>
//! a subshape of the initial shape to which the <br>
//! transformation has been applied. Raises NoSuchObject from Standard <br>
//! if S is not the initial shape or a sub-shape <br>
//! of the initial shape. <br>
Standard_EXPORT virtual const TopoDS_Shape& ModifiedShape(const TopoDS_Shape& S) const;
protected:
//! Empty constructor. <br>
Standard_EXPORT BRepBuilderAPI_ModifyShape_21423();
//! Initializes the modifier with the Shape <S>, and <br>
//! set the field <myInitialShape> to <S>. <br>
Standard_EXPORT BRepBuilderAPI_ModifyShape_21423(const TopoDS_Shape& S);
//! Set the field <myModification> with <M>. <br>
Standard_EXPORT BRepBuilderAPI_ModifyShape_21423(const Handle(BRepTools_Modification)& M);
//! Initializes the modifier with the Shape <S>, and <br>
//! set the field <myInitialShape> to <S>, and set the <br>
//! field <myModification> with <M>, the performs the <br>
//! modification. <br>
Standard_EXPORT BRepBuilderAPI_ModifyShape_21423(const TopoDS_Shape& S,const Handle(BRepTools_Modification)& M);
//! Performs the previously given modification on the <br>
//! shape <S>. <br>
Standard_EXPORT void DoModif(const TopoDS_Shape& S) ;
//! Performs the modification <M> on a previously <br>
//! given shape. <br>
Standard_EXPORT void DoModif(const Handle(BRepTools_Modification)& M) ;
//! Performs the modification <M> on the shape <S>. <br>
Standard_EXPORT void DoModif(const TopoDS_Shape& S,const Handle(BRepTools_Modification)& M) ;
BRepTools_Modifier_21423 myModifier;
TopoDS_Shape myInitialShape;
Handle_BRepTools_Modification myModification;
private:
Standard_EXPORT void DoModif() ;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif

View File

@ -0,0 +1,58 @@
// File: BRepBuilderAPI_NurbsConvert_21423.cxx
// Created: Fri Dec 9 09:14:55 1994
// Author: Jacques GOUSSARD
// <jag@topsn2>
#include <BRepBuilderAPI_NurbsConvert_21423.hxx>
#include <TopoDS_Shape.hxx>
#include <BRepLib.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools_NurbsConvertModification_21423.hxx>
//=======================================================================
//function : BRepBuilderAPI_NurbsConvert_21423
//purpose :
//=======================================================================
BRepBuilderAPI_NurbsConvert_21423::BRepBuilderAPI_NurbsConvert_21423 ()
{
myModification = new BRepTools_NurbsConvertModification_21423();
}
//=======================================================================
//function : BRepBuilderAPI_NurbsConvert_21423
//purpose :
//=======================================================================
BRepBuilderAPI_NurbsConvert_21423::BRepBuilderAPI_NurbsConvert_21423 (const TopoDS_Shape& S,
const Standard_Boolean Copy)
{
myModification = new BRepTools_NurbsConvertModification_21423();
Perform(S,Copy);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepBuilderAPI_NurbsConvert_21423::Perform(const TopoDS_Shape& S,
const Standard_Boolean Copy)
{
Handle(BRepTools_NurbsConvertModification_21423) theModif =
Handle(BRepTools_NurbsConvertModification_21423)::DownCast(myModification);
DoModif(S,myModification);
}

View File

@ -0,0 +1,95 @@
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BRepBuilderAPI_NurbsConvert_21423_HeaderFile
#define _BRepBuilderAPI_NurbsConvert_21423_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _BRepBuilderAPI_ModifyShape_21423_HeaderFile
#include <BRepBuilderAPI_ModifyShape_21423.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class TopoDS_Shape;
//! Conversion of the complete geometry of a shape into <br>
//! NURBS geometry. For example, all curves supporting <br>
//! edges of the basis shape are converted into BSpline <br>
//! curves, and all surfaces supporting its faces are <br>
//! converted into BSpline surfaces. <br>
class BRepBuilderAPI_NurbsConvert_21423 : public BRepBuilderAPI_ModifyShape_21423 {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Constructs a framework for converting the geometry of a <br>
//! shape into NURBS geometry. Use the function Perform <br>
//! to define the shape to convert. <br>
Standard_EXPORT BRepBuilderAPI_NurbsConvert_21423();
//! Builds a new shape by converting the geometry of the <br>
//! shape S into NURBS geometry. Specifically, all curves <br>
//! supporting edges of S are converted into BSpline <br>
//! curves, and all surfaces supporting its faces are <br>
//! converted into BSpline surfaces. <br>
//! Use the function Shape to access the new shape. <br>
//! Note: the constructed framework can be reused to <br>
//! convert other shapes. You specify these with the <br>
//! function Perform. <br>
Standard_EXPORT BRepBuilderAPI_NurbsConvert_21423(const TopoDS_Shape& S,const Standard_Boolean Copy = Standard_False);
//! Builds a new shape by converting the geometry of the <br>
//! shape S into NURBS geometry. <br>
//! Specifically, all curves supporting edges of S are <br>
//! converted into BSpline curves, and all surfaces <br>
//! supporting its faces are converted into BSpline surfaces. <br>
//! Use the function Shape to access the new shape. <br>
//! Note: this framework can be reused to convert other <br>
//! shapes: you specify them by calling the function Perform again. <br>
Standard_EXPORT void Perform(const TopoDS_Shape& S,const Standard_Boolean Copy = Standard_False) ;
protected:
private:
};
// other Inline functions and methods (like "C++: function call" methods)
#endif

View File

@ -0,0 +1,539 @@
// File: BRepTools_Modifier_21423.cxx
// Created: Thu Aug 25 10:48:00 1994
// Author: Jacques GOUSSARD
// <jag@ecolox>
// IFV 04.06.99 - PRO18974 - processing of INTERNAL shapes.
#include <BRepTools_Modifier_21423.hxx>
//#include <Standard_NoSuchObject.hxx>
#include <BRepTools_Modification.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TColStd_ListOfTransient.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>
#if 0
#include <Poly_Triangulation.hxx>
#include <Poly_Polygon3D.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#endif
#include <Geom2d_Line.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <BRepTools.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <gp_Pnt.hxx>
#include <gp.hxx>
#include <Standard_NullObject.hxx>
#include <gp_Trsf.hxx>
#include <BRepTools_TrsfModification.hxx>
//=======================================================================
//function : BRepTools_Modifier_21423
//purpose :
//=======================================================================
BRepTools_Modifier_21423::BRepTools_Modifier_21423 ():myDone(Standard_False)
{}
//=======================================================================
//function : BRepTools_Modifier_21423
//purpose :
//=======================================================================
BRepTools_Modifier_21423::BRepTools_Modifier_21423 (const TopoDS_Shape& S) :
myShape(S),myDone(Standard_False)
{
myMap.Clear();
Put(S);
}
//=======================================================================
//function : BRepTools_Modifier_21423
//purpose :
//=======================================================================
BRepTools_Modifier_21423::BRepTools_Modifier_21423
(const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M) : myShape(S),myDone(Standard_False)
{
myMap.Clear();
Put(S);
Perform(M);
}
//=======================================================================
//function : Init
//purpose :
//=======================================================================
void BRepTools_Modifier_21423::Init(const TopoDS_Shape& S)
{
myShape = S;
myDone = Standard_False;
myMap.Clear();
Put(S);
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void BRepTools_Modifier_21423::Perform(const Handle(BRepTools_Modification)& M)
{
if (myShape.IsNull()) {
Standard_NullObject::Raise();
}
TopTools_DataMapIteratorOfDataMapOfShapeShape theIter(myMap);
// Set to Null the value of shapes, in case when another modification is applied to the start shape.
if (!theIter.Value().IsNull()) {
while (theIter.More()) {
myMap(theIter.Value()).Nullify();
theIter.Next();
}
theIter.Reset();
}
/*
while (theIter.More()) {
Rebuild(theIter.Key(),M);
theIter.Next();
}
*/
Rebuild(myShape, M, 0.);
if (myShape.ShapeType() == TopAbs_FACE) {
if (myShape.Orientation() == TopAbs_REVERSED) {
myMap(myShape).Reverse();
}
else{
myMap(myShape).Orientation(myShape.Orientation());
}
}
else {
myMap(myShape).Orientation(myShape.Orientation());
}
// Update the continuities
TopTools_IndexedDataMapOfShapeListOfShape theEFMap;
TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,theEFMap);
BRep_Builder B;
/*
Standard_Boolean RecomputeTriangles = Standard_False;
Standard_Real MaxDeflection = RealFirst();
Handle(Poly_Triangulation) Tr;
Handle(Poly_Polygon3D) Po;
TopLoc_Location Loc;
*/
while (theIter.More()) {
const TopoDS_Shape& S = theIter.Key();
/*
if (S.ShapeType() == TopAbs_FACE && !S.IsSame(theIter.Value())) {
Tr = BRep_Tool::Triangulation(TopoDS::Face(S),Loc);
if (!Tr.IsNull()) {
RecomputeTriangles = Standard_True;
MaxDeflection = Max(MaxDeflection,Tr->Deflection());
}
}
else */ if (S.ShapeType() == TopAbs_EDGE && !S.IsSame(theIter.Value())) {
const TopoDS_Edge& edg = TopoDS::Edge(S);
/*
Po = BRep_Tool::Polygon3D(edg,Loc);
if (!Po.IsNull()) {
RecomputeTriangles = Standard_True;
MaxDeflection = Max(MaxDeflection,Po->Deflection());
}
*/
TopTools_ListIteratorOfListOfShape it;
it.Initialize(theEFMap.FindFromKey(edg));
TopoDS_Face F1,F2;
while (it.More() && F2.IsNull()) {
if (F1.IsNull()) {
F1 = TopoDS::Face(it.Value());
}
else {
F2 = TopoDS::Face(it.Value());
}
it.Next();
}
if (!F2.IsNull()) {
const TopoDS_Edge& newedg = TopoDS::Edge(myMap(edg));
const TopoDS_Face& newf1 = TopoDS::Face(myMap(F1));
const TopoDS_Face& newf2 = TopoDS::Face(myMap(F2));
GeomAbs_Shape Newcont = M->Continuity(edg,F1,F2,newedg,newf1,newf2);
if (Newcont > GeomAbs_C0) {
B.Continuity(newedg,newf1,newf2,Newcont);
}
}
}
theIter.Next();
}
/*
if (RecomputeTriangles) {
BRepMesh_IncrementalMesh(myMap(myShape),MaxDeflection);
}
*/
myDone = Standard_True;
}
//=======================================================================
//function : Put
//purpose :
//=======================================================================
void BRepTools_Modifier_21423::Put(const TopoDS_Shape& S)
{
if (!myMap.IsBound(S)) {
myMap.Bind(S,TopoDS_Shape());
for(TopoDS_Iterator theIterator(S,Standard_False);theIterator.More();theIterator.Next()) {
Put(theIterator.Value());
}
}
}
//=======================================================================
//function : Rebuild
//purpose :
//=======================================================================
Standard_Boolean BRepTools_Modifier_21423::Rebuild
(const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M,
const Standard_Real Tol)
{
TopoDS_Shape& result = myMap(S);
// if (!result.IsNull()) return ! S.IsEqual(result);
if (!result.IsNull()) return ! S.IsSame(result);
Standard_Boolean rebuild = Standard_False, RevWires = Standard_False;
TopAbs_Orientation ResOr = TopAbs_FORWARD;
BRep_Builder B;
Standard_Real tol = Tol;
Standard_Boolean No3DCurve = Standard_False; // en fait, si on n`a pas de
//modif geometry 3d , it is necessary to test the existence of a curve 3d.
// new geometry ?
TopAbs_ShapeEnum ts = S.ShapeType();
switch (ts) {
case TopAbs_FACE:
{
Standard_Boolean RevFace;
Handle(Geom_Surface) surface;
TopLoc_Location location;
rebuild = M->NewSurface(TopoDS::Face(S),surface,location,tol,
RevWires,RevFace);
tol = Max(Tol,tol); //OCC217
if (rebuild) {
B.MakeFace(TopoDS::Face(result),surface,
location.Predivided(S.Location()),tol);
result.Location(S.Location());
// result.Orientation(S.Orientation());
if (RevFace) {
ResOr = TopAbs_REVERSED;
}
// set specifics flags of a Face
B.NaturalRestriction(TopoDS::Face(result),
BRep_Tool::NaturalRestriction(TopoDS::Face(S)));
}
}
break;
case TopAbs_EDGE:
{
Handle(Geom_Curve) curve;
TopLoc_Location location;
rebuild = M->NewCurve(TopoDS::Edge(S),curve,location,tol);
tol = Max(Tol,tol); //OCC217
if (rebuild) {
if (curve.IsNull()) {
B.MakeEdge(TopoDS::Edge(result));
B.Degenerated(TopoDS::Edge(result),
BRep_Tool::Degenerated(TopoDS::Edge(S)));
B.UpdateEdge(TopoDS::Edge(result),tol); //OCC217
No3DCurve = Standard_True;
}
else {
B.MakeEdge(TopoDS::Edge(result),curve,
location.Predivided(S.Location()),tol);
No3DCurve = Standard_False;
}
result.Location(S.Location());
// result.Orientation(S.Orientation());
// set specifics flags of an Edge
B.SameParameter(TopoDS::Edge(result),
BRep_Tool::SameParameter(TopoDS::Edge(S)));
B.SameRange(TopoDS::Edge(result),
BRep_Tool::SameRange(TopoDS::Edge(S)));
}
}
break;
case TopAbs_VERTEX:
{
gp_Pnt vtx;
rebuild = M->NewPoint(TopoDS::Vertex(S),vtx,tol);
tol = Max(Tol, tol); //OCC217
if (rebuild) {
B.MakeVertex(TopoDS::Vertex(result),vtx,tol);
}
}
break;
default:
{
}
}
// rebuild sub-shapes and test new sub-shape ?
Standard_Boolean newgeom = rebuild;
TopoDS_Iterator it;
for (it.Initialize(S, Standard_False); it.More(); it.Next()) {
// always call Rebuild
Standard_Boolean subrebuilt = Rebuild(it.Value(), M, tol);
rebuild = subrebuilt || rebuild ;
}
// make an empty copy
if (rebuild && !newgeom) {
result = S.EmptyCopied();
result.Orientation(TopAbs_FORWARD);
}
// copy the sub-elements
if (rebuild) {
TopAbs_Orientation orient;
for (it.Initialize(S,Standard_False); it.More(); it.Next()) {
orient = it.Value().Orientation();
if (RevWires || myMap(it.Value()).Orientation() == TopAbs_REVERSED) {
orient = TopAbs::Reverse(orient);
}
B.Add(result,myMap(it.Value()).Oriented(orient));
}
if (ts == TopAbs_FACE) {
// pcurves
Handle(Geom2d_Curve) curve2d; //,curve2d1;
TopoDS_Face face = TopoDS::Face(S);
TopAbs_Orientation fcor = face.Orientation();
if(fcor != TopAbs_REVERSED) fcor = TopAbs_FORWARD;
TopExp_Explorer ex(face.Oriented(fcor),TopAbs_EDGE);
for (;ex.More(); ex.Next())
{
const TopoDS_Edge& edge = TopoDS::Edge(ex.Current());
if (M->NewCurve2d(edge, face,TopoDS::Edge(myMap(ex.Current())),
TopoDS::Face(result),curve2d, tol))
{
tol = Max(Tol,tol); //OCC217
// rem dub 16/09/97 : Make constant topology or not make at all.
// Do not make if CopySurface = 1
// Atention, TRUE sewing edges (RealyClosed)
// stay even if CopySurface is true.
// check that edge contains two pcurves on this surface:
// either it is true seam on the current face, or belongs to two faces
// built on that same surface (see OCC21772)
// Note: this check could be made separate method in BRepTools
Standard_Boolean isClosed = Standard_False;
if(BRep_Tool::IsClosed(edge,face))
{
isClosed = ( ! newgeom || BRepTools::IsReallyClosed(edge,face) );
if ( ! isClosed )
{
TopLoc_Location aLoc;
TopoDS_Shape resface = (myMap.IsBound(face) ? myMap(face) : face);
if(resface.IsNull())
resface = face;
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(resface), aLoc);
// check other faces sharing the same surface
TopExp_Explorer aExpF(myShape,TopAbs_FACE);
for( ; aExpF.More() && !isClosed; aExpF.Next())
{
TopoDS_Face anOther = TopoDS::Face(aExpF.Current());
if(anOther.IsSame(face))
continue;
TopoDS_Shape resface2 = (myMap.IsBound(anOther) ? myMap(anOther) : anOther);
if(resface2.IsNull())
resface2 = anOther;
TopLoc_Location anOtherLoc;
Handle(Geom_Surface) anOtherSurf =
BRep_Tool::Surface(TopoDS::Face(resface2), anOtherLoc);
if ( aSurf == anOtherSurf && aLoc.IsEqual (anOtherLoc) )
{
TopExp_Explorer aExpE(anOther,TopAbs_EDGE);
for( ; aExpE.More() && !isClosed ; aExpE.Next())
isClosed = edge.IsSame(aExpE.Current());
}
}
}
}
if (isClosed)
{
TopoDS_Edge CurE = TopoDS::Edge(myMap(edge));
TopoDS_Shape aLocalResult = result;
aLocalResult.Orientation(TopAbs_FORWARD);
TopoDS_Face CurF = TopoDS::Face(aLocalResult);
Handle(Geom2d_Curve) curve2d1, currcurv;
Standard_Real f,l;
if ((!RevWires && fcor != edge.Orientation()) ||
( RevWires && fcor == edge.Orientation())) {
CurE.Orientation(TopAbs_FORWARD);
curve2d1 = BRep_Tool::CurveOnSurface(CurE,CurF,f,l);
if (curve2d1.IsNull()) curve2d1 = new Geom2d_Line(gp::OX2d());
B.UpdateEdge (CurE, curve2d1, curve2d, CurF, tol);
}
else {
CurE.Orientation(TopAbs_REVERSED);
curve2d1 = BRep_Tool::CurveOnSurface(CurE,CurF,f,l);
if (curve2d1.IsNull()) curve2d1 = new Geom2d_Line(gp::OX2d());
B.UpdateEdge (CurE, curve2d, curve2d1, CurF, tol);
}
currcurv = BRep_Tool::CurveOnSurface(edge,face,f,l);
B.Range(edge,f,l);
}
else {
B.UpdateEdge(TopoDS::Edge(myMap(ex.Current())),
curve2d,
TopoDS::Face(result), tol);
}
TopLoc_Location theLoc;
Standard_Real theF,theL;
Handle(Geom_Curve) C3D =
BRep_Tool::Curve(TopoDS::Edge(myMap(ex.Current())),
theLoc,theF,theL);
if (C3D.IsNull()) { // Update vertices
Standard_Real param;
TopExp_Explorer ex2(edge,TopAbs_VERTEX);
while (ex2.More()) {
const TopoDS_Vertex& vertex = TopoDS::Vertex(ex2.Current());
if (!M->NewParameter(vertex, edge, param, tol)) {
//tol = BRep_Tool::Tolerance(vertex);
tol = Max(Tol, BRep_Tool::Tolerance(vertex)); //OCC217
param = BRep_Tool::Parameter(vertex,edge);
}
TopAbs_Orientation vtxrelat = vertex.Orientation();
if (edge.Orientation() == TopAbs_REVERSED) {
// Update considere l'edge FORWARD, et le vertex en relatif
vtxrelat= TopAbs::Reverse(vtxrelat);
}
// if (myMap(edge).Orientation() == TopAbs_REVERSED) {
// vtxrelat= TopAbs::Reverse(vtxrelat);
// }
TopoDS_Vertex aLocalVertex = TopoDS::Vertex(myMap(vertex));
aLocalVertex.Orientation(vtxrelat);
// B.UpdateVertex(TopoDS::Vertex
// (myMap(vertex).Oriented(vtxrelat)),
B.UpdateVertex(aLocalVertex,
param,
TopoDS::Edge(myMap(edge)),
tol);
ex2.Next();
}
}
}
}
}
// else if (ts == TopAbs_EDGE) {
else if (ts == TopAbs_EDGE && !No3DCurve) {
// Vertices
Standard_Real param;
const TopoDS_Edge& edge = TopoDS::Edge(S);
TopAbs_Orientation edor = edge.Orientation();
if(edor != TopAbs_REVERSED) edor = TopAbs_FORWARD;
TopExp_Explorer ex(edge.Oriented(edor), TopAbs_VERTEX);
while (ex.More()) {
const TopoDS_Vertex& vertex = TopoDS::Vertex(ex.Current());
if (!M->NewParameter(vertex, edge, param, tol)) {
//tol = BRep_Tool::Tolerance(vertex);
tol = Max(Tol, BRep_Tool::Tolerance(vertex)); //OCC217
param = BRep_Tool::Parameter(vertex,edge);
}
TopAbs_Orientation vtxrelat = vertex.Orientation();
if (edor == TopAbs_REVERSED) {
// Update considere l'edge FORWARD, et le vertex en relatif
vtxrelat= TopAbs::Reverse(vtxrelat);
}
// if (result.Orientation() == TopAbs_REVERSED) {
// vtxrelat= TopAbs::Reverse(vtxrelat);
// }
TopoDS_Vertex aLocalVertex = TopoDS::Vertex(myMap(vertex));
aLocalVertex.Orientation(vtxrelat);
// B.UpdateVertex(TopoDS::Vertex
// (myMap(vertex).Oriented(vtxrelat)),
B.UpdateVertex(aLocalVertex,
param,
TopoDS::Edge(result),
tol);
ex.Next();
}
}
// update flags
result.Orientable(S.Orientable());
result.Closed(S.Closed());
result.Infinite(S.Infinite());
}
else
result = S;
// Set flag of the shape.
result.Orientation(ResOr);
result.Free (S.Free());
result.Modified (S.Modified());
result.Checked (S.Checked());
result.Orientable(S.Orientable());
result.Closed (S.Closed());
result.Infinite (S.Infinite());
result.Convex (S.Convex());
return rebuild;
}

View File

@ -0,0 +1,118 @@
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BRepTools_Modifier_21423_HeaderFile
#define _BRepTools_Modifier_21423_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_BRepTools_Modification_HeaderFile
#include <Handle_BRepTools_Modification.hxx>
#endif
#include <Standard_NoSuchObject.hxx>
class Standard_NullObject;
class TopoDS_Shape;
class BRepTools_Modification;
class BRepTools_Modifier_21423 {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
//! Creates an empty Modifier. <br>
Standard_EXPORT BRepTools_Modifier_21423();
//! Creates a modifier on the shape <S>. <br>
Standard_EXPORT BRepTools_Modifier_21423(const TopoDS_Shape& S);
//! Creates a modifier on the shape <S>, and performs <br>
//! the modifications described by <M>. <br>
Standard_EXPORT BRepTools_Modifier_21423(const TopoDS_Shape& S,const Handle(BRepTools_Modification)& M);
//! Initializes the modifier with the shape <S>. <br>
Standard_EXPORT void Init(const TopoDS_Shape& S) ;
//! Performs the modifications described by <M>. <br>
Standard_EXPORT void Perform(const Handle(BRepTools_Modification)& M) ;
//! Returns Standard_True if the modification has <br>
//! been computed successfully. <br>
//! <br>
Standard_Boolean IsDone() const;
//! Returns the modified shape corresponding to <S>. <br>
const TopoDS_Shape& ModifiedShape(const TopoDS_Shape& S) const;
protected:
private:
Standard_EXPORT void Put(const TopoDS_Shape& S) ;
Standard_EXPORT Standard_Boolean Rebuild (const TopoDS_Shape& S,
const Handle(BRepTools_Modification)& M,
const Standard_Real Tolerance);
TopTools_DataMapOfShapeShape myMap;
TopoDS_Shape myShape;
Standard_Boolean myDone;
};
//=======================================================================
//function : ModifiedShape
//purpose :
//=======================================================================
inline const TopoDS_Shape& BRepTools_Modifier_21423::ModifiedShape
(const TopoDS_Shape& S) const
{
if (!myMap.IsBound(S)) { Standard_NoSuchObject::Raise();}
return myMap(S);
}
//=======================================================================
//function : IsDone
//purpose :
//=======================================================================
inline Standard_Boolean BRepTools_Modifier_21423::IsDone () const
{
return myDone;
}
// other Inline functions and methods (like "C++: function call" methods)
#endif

View File

@ -0,0 +1,662 @@
// File: BRepTools_NurbsConvertModification_21423.cxx
// Created: Fri Jul 12 10:16:32 1996
// Author: Stagiaire Mary FABIEN
// <fbi@animax.paris1.matra-dtv.fr>
#include <BRepTools_NurbsConvertModification_21423.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopLoc_Location.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <Geom2d_Curve.hxx>
#include <gp_Pnt.hxx>
#ifndef _Standard_Type_HeaderFile
#include <Standard_Type.hxx>
#endif
IMPLEMENT_STANDARD_TYPE(BRepTools_NurbsConvertModification_21423)
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY()
STANDARD_TYPE(BRepTools_Modification),
STANDARD_TYPE(MMgt_TShared),
STANDARD_TYPE(Standard_Transient),
IMPLEMENT_STANDARD_SUPERTYPE_ARRAY_END()
IMPLEMENT_STANDARD_TYPE_END(BRepTools_NurbsConvertModification_21423)
IMPLEMENT_DOWNCAST(BRepTools_NurbsConvertModification_21423,Standard_Transient)
IMPLEMENT_STANDARD_RTTI(BRepTools_NurbsConvertModification_21423)
#include <BRepTools.hxx>
#include <Standard_NoSuchObject.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <GeomConvert.hxx>
#include <Geom2dConvert.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <Geom2dAdaptor_HCurve.hxx>
#include <GeomAdaptor_HCurve.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <BSplCLib.hxx>
#include <Approx_SameParameter.hxx>
#include <BRep_Tool.hxx>
#include <Extrema_LocateExtPC.hxx>
#include <OSD_Chronometer.hxx>
#include <gp_GTrsf2d.hxx>
#include <gp_TrsfForm.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TColStd_ListIteratorOfListOfTransient.hxx>
#include <ProjLib_ComputeApprox.hxx>
#include <ProjLib_ComputeApproxOnPolarSurface.hxx>
#include <ElSLib.hxx>
#include <BSplCLib.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_GCurve.hxx>
#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
#include <BRepAdaptor_Surface.hxx>
static void GeomLib_ChangeUBounds(Handle(Geom_BSplineSurface)& aSurface,
const Standard_Real newU1,
const Standard_Real newU2)
{
TColStd_Array1OfReal knots(1,aSurface->NbUKnots()) ;
aSurface->UKnots(knots) ;
BSplCLib::Reparametrize(newU1,
newU2,
knots) ;
aSurface->SetUKnots(knots) ;
}
static void GeomLib_ChangeVBounds(Handle(Geom_BSplineSurface)& aSurface,
const Standard_Real newV1,
const Standard_Real newV2)
{
TColStd_Array1OfReal knots(1,aSurface->NbVKnots()) ;
aSurface->VKnots(knots) ;
BSplCLib::Reparametrize(newV1,
newV2,
knots) ;
aSurface->SetVKnots(knots) ;
}
//=======================================================================
//function : BRepTools_NurbsConvertModification_21423
//purpose :
//=======================================================================
BRepTools_NurbsConvertModification_21423::BRepTools_NurbsConvertModification_21423()
{
}
//=======================================================================
//function : NewSurface
//purpose :
//=======================================================================
Standard_Boolean BRepTools_NurbsConvertModification_21423::NewSurface
(const TopoDS_Face& F,
Handle(Geom_Surface)& S,
TopLoc_Location& L,
Standard_Real& Tol,
Standard_Boolean& RevWires,
Standard_Boolean& RevFace)
{
Standard_Real U1, U2, curvU1, curvU2, surfU1, surfU2, UTol;
Standard_Real V1, V2, curvV1, curvV2, surfV1, surfV2, VTol;
RevWires = Standard_False;
RevFace = Standard_False;
Handle(Geom_Surface) SS = BRep_Tool::Surface(F,L);
Handle(Standard_Type) TheTypeSS = SS->DynamicType();
if ((TheTypeSS == STANDARD_TYPE(Geom_BSplineSurface)) ||
(TheTypeSS == STANDARD_TYPE(Geom_BezierSurface))) {
return Standard_False;
}
S = SS;
BRepTools::UVBounds(F,curvU1,curvU2,curvV1,curvV2);
Tol = BRep_Tool::Tolerance(F);
Standard_Real TolPar = 0.1*Tol;
Standard_Boolean IsUp = S->IsUPeriodic(), IsVp = S->IsVPeriodic();
//OCC466(apo)->
U1 = curvU1; U2 = curvU2;
V1 = curvV1; V2 = curvV2;
SS->Bounds(surfU1,surfU2,surfV1,surfV2);
if(!IsUp){
U1 = Max(surfU1,curvU1);
U2 = Min(surfU2,curvU2);
}
if(!IsVp){
V1 = Max(surfV1,curvV1);
V2 = Min(surfV2,curvV2);
}
//<-OCC466(apo)
if(IsUp && IsVp) {
Standard_Real dU = Abs(U2 - U1), dV = Abs(V2 - V1);
Standard_Real Up = S->UPeriod(), Vp = S->VPeriod();
if(Abs(dU - Up) <= TolPar && U2 <= Up) {
if(Abs(dV - Vp) <= TolPar && V2 <= Vp) { }
else {
SS = new Geom_RectangularTrimmedSurface(S, V1+1e-9, V2-1e-9, Standard_False);
}
}
else {
if(Abs(dV - Vp) <= TolPar && V2 <= Vp)
SS = new Geom_RectangularTrimmedSurface(S, U1+1e-9, U2-1e-9, Standard_True);
else
SS = new Geom_RectangularTrimmedSurface(S, U1+1e-9, U2-1e-9, V1+1e-9, V2-1e-9);
}
}
if(IsUp && !IsVp) {
Standard_Real dU = Abs(U2 - U1);
Standard_Real Up = S->UPeriod();
if(Abs(dU - Up) <= TolPar && U2 <= Up)
SS = new Geom_RectangularTrimmedSurface(S, V1+1e-9, V2-1e-9, Standard_False);
else
SS = new Geom_RectangularTrimmedSurface(S, U1+1e-9, U2-1e-9, V1+1e-9, V2-1e-9);
}
if(!IsUp && IsVp) {
Standard_Real dV = Abs(V2 - V1);
Standard_Real Vp = S->VPeriod();
if(Abs(dV - Vp) <= TolPar && V2 <= Vp)
SS = new Geom_RectangularTrimmedSurface(S, U1+1e-9, U2-1e-9, Standard_True);
else
SS = new Geom_RectangularTrimmedSurface(S, U1+1e-9, U2-1e-9, V1+1e-9, V2-1e-9);
}
if(!IsUp && !IsVp) {
SS = new Geom_RectangularTrimmedSurface(S, U1+1e-9, U2-1e-9, V1+1e-9, V2-1e-9);
}
SS->Bounds(surfU1,surfU2,surfV1,surfV2) ;
S = GeomConvert::SurfaceToBSplineSurface(SS);
Handle(Geom_BSplineSurface) BS = Handle(Geom_BSplineSurface)::DownCast(S) ;
BS->Resolution(Tol, UTol, VTol) ;
//
// on recadre les bornes de S sinon les anciennes PCurves sont aux fraises
//
if (Abs(curvU1-surfU1) > UTol && !BS->IsUPeriodic()) {
GeomLib_ChangeUBounds(BS, U1,U2) ;
}
if (Abs(curvV1-surfV1) > VTol && !BS->IsVPeriodic()) {
GeomLib_ChangeVBounds(BS, V1, V2) ;
}
////modified by jgv, 17.11.11 for SALOME only, bug 21423////
BRepAdaptor_Surface BAsurf(F);
if (BAsurf.GetType() == GeomAbs_Sphere)
{ //from OCC217
Standard_Real dTol = 1e-9/Sqrt(UTol*UTol+VTol*VTol)*2.0;
Tol *= Max(dTol,1.0);
}
////////////////////////////////////////////////////////////
return Standard_True;
}
static Standard_Boolean IsConvert(const TopoDS_Edge& E)
{
Standard_Boolean isConvert = Standard_False;
Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*)&E.TShape());
// iterate on pcurves
BRep_ListIteratorOfListOfCurveRepresentation itcr(TE->Curves());
for ( ; itcr.More() && !isConvert; itcr.Next() ) {
Handle(BRep_GCurve) GC = Handle(BRep_GCurve)::DownCast(itcr.Value());
if ( GC.IsNull() || ! GC->IsCurveOnSurface() ) continue;
Handle(Geom_Surface) aSurface = GC->Surface();
Handle(Geom2d_Curve) aCurve2d = GC->PCurve();
isConvert =((!aSurface->IsKind(STANDARD_TYPE(Geom_BSplineSurface)) &&
!aSurface->IsKind(STANDARD_TYPE(Geom_BezierSurface))) ||
(!aCurve2d->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve)) &&
!aCurve2d->IsKind(STANDARD_TYPE(Geom2d_BezierCurve))));
}
return isConvert;
}
//=======================================================================
//function : NewCurve
//purpose :
//=======================================================================
Standard_Boolean BRepTools_NurbsConvertModification_21423::NewCurve
(const TopoDS_Edge& E,
Handle(Geom_Curve)& C,
TopLoc_Location& L,
Standard_Real& Tol)
{
Tol = BRep_Tool::Tolerance(E);
if(BRep_Tool::Degenerated(E)) {
C.Nullify();
L.Identity();
return Standard_True;
}
Standard_Real f, l;
Handle(Geom_Curve) Caux = BRep_Tool::Curve(E, L, f, l);
if ( Caux.IsNull()) {
L.Identity();
return Standard_False;
}
Handle(Standard_Type) TheType = Caux->DynamicType();
if ((TheType == STANDARD_TYPE(Geom_BSplineCurve)) ||
(TheType == STANDARD_TYPE(Geom_BezierCurve))) {
if(IsConvert(E)) {
C = Handle(Geom_Curve)::DownCast(Caux->Copy());
return Standard_True;
}
return Standard_False;
}
C = Caux;
Standard_Real TolPar = Tol *.1;
if(C->IsPeriodic()) {
Standard_Real p = C->Period();
Standard_Real d = Abs(l - f);
if(Abs(d - p) <= TolPar && l <= p) {}
else
C = new Geom_TrimmedCurve(C, f, l);
}
else
C = new Geom_TrimmedCurve(C, f, l);
//modif WOK++ portage hp (fbi du 14/03/97)
// gp_Trsf trsf(L);
// gp_Trsf trsf = L.Transformation();
// C = GeomConvert::CurveToBSplineCurve(C,Convert_QuasiAngular);
C = GeomConvert::CurveToBSplineCurve(C);
Standard_Real fnew = C->FirstParameter(), lnew = C->LastParameter(), UTol;
Handle(Geom_BSplineCurve) BC = Handle(Geom_BSplineCurve)::DownCast(C) ;
if(!BC->IsPeriodic()) {
BC->Resolution(Tol, UTol) ;
if(Abs(f - fnew) > UTol || Abs(l - lnew) > UTol) {
TColStd_Array1OfReal knots(1,BC->NbKnots()) ;
BC->Knots(knots) ;
BSplCLib::Reparametrize(f, l, knots) ;
BC->SetKnots(knots) ;
}
}
if(!myMap.Contains(Caux)) {
myMap.Add(Caux,C);
}
return Standard_True ;
}
//=======================================================================
//function : NewPoint
//purpose :
//=======================================================================
Standard_Boolean BRepTools_NurbsConvertModification_21423::NewPoint
//(const TopoDS_Vertex& V,
(const TopoDS_Vertex& ,
// gp_Pnt& P,
gp_Pnt& ,
// Standard_Real& Tol)
Standard_Real& )
{
return Standard_False;
}
//=======================================================================
//function : NewCurve2d
//purpose :
//=======================================================================
Standard_Boolean BRepTools_NurbsConvertModification_21423::NewCurve2d
(const TopoDS_Edge& E,
const TopoDS_Face& F,
const TopoDS_Edge& newE,
const TopoDS_Face& newF,
Handle(Geom2d_Curve)& Curve2d,
Standard_Real& Tol)
{
////modified by jgv, 17.11.11 for SALOME only, bug 21423////
Tol = BRep_Tool::Tolerance(E);
BRepAdaptor_Surface BAsurf(F);
if (BAsurf.GetType() == GeomAbs_Sphere)
Tol = Max(Max(BRep_Tool::Tolerance(E),BRep_Tool::Tolerance(F)),
Max(BRep_Tool::Tolerance(newE),BRep_Tool::Tolerance(newF))
); //from OCC217
////////////////////////////////////////////////////////////
Standard_Real f2d,l2d;
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f2d,l2d);
Standard_Real f3d,l3d;
TopLoc_Location Loc;
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, Loc, f3d,l3d);
Standard_Boolean isConvert2d = ((!C3d.IsNull() && !C3d->IsKind(STANDARD_TYPE(Geom_BSplineCurve)) &&
!C3d->IsKind(STANDARD_TYPE(Geom_BezierCurve))) ||
IsConvert(E));
if(BRep_Tool::Degenerated(E)) {
//Curve2d = C2d;
if(!C2d->IsKind(STANDARD_TYPE(Geom2d_TrimmedCurve)))
{
Handle(Geom2d_TrimmedCurve) aTrimC = new Geom2d_TrimmedCurve(C2d,f2d,l2d);
C2d = aTrimC;
}
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
return Standard_True;
}
if(!BRepTools::IsReallyClosed(E,F)) {
Handle(Standard_Type) TheTypeC2d = C2d->DynamicType();
if(TheTypeC2d == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
Handle(Geom2d_TrimmedCurve) TC = Handle(Geom2d_TrimmedCurve)::DownCast(C2d);
C2d = TC->BasisCurve();
}
Standard_Real fc = C2d->FirstParameter(), lc = C2d->LastParameter();
if(!C2d->IsPeriodic()) {
if(fc - f2d > Precision::PConfusion()) f2d = fc;
if(l2d - lc > Precision::PConfusion()) l2d = lc;
}
C2d = new Geom2d_TrimmedCurve(C2d, f2d, l2d);
Geom2dAdaptor_Curve G2dAC(C2d, f2d, l2d);
Handle(Geom2dAdaptor_HCurve) G2dAHC = new Geom2dAdaptor_HCurve(G2dAC);
TopLoc_Location Loc;
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, Loc, f3d,l3d);
if(!newE.IsNull()) {
C3d = BRep_Tool::Curve(newE, f3d, l3d);
}
else {
C3d = BRep_Tool::Curve(E,f3d,l3d);
}
GeomAdaptor_Curve G3dAC(C3d, f3d, l3d);
Handle(GeomAdaptor_HCurve) G3dAHC = new GeomAdaptor_HCurve(G3dAC);
Standard_Real Uinf, Usup, Vinf, Vsup, u = 0, v = 0;
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
Handle(Standard_Type) myT = S->DynamicType();
if(myT != STANDARD_TYPE(Geom_Plane)) {
if(newF.IsNull()) {
Handle(Standard_Type) st = C2d->DynamicType();
if ((st == STANDARD_TYPE(Geom2d_BSplineCurve)) ||
(st == STANDARD_TYPE(Geom2d_BezierCurve))) {
if(isConvert2d) {
Curve2d = Handle(Geom2d_Curve)::DownCast(C2d->Copy());
return Standard_True;
}
return Standard_False;
}
}
else {
S = BRep_Tool::Surface(newF);
}
S->Bounds(Uinf, Usup, Vinf, Vsup);
Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9;
u = (Usup - Uinf)*0.1;
v = (Vsup - Vinf)*0.1;
if(S->IsUPeriodic()) {
Standard_Real uperiod = S->UPeriod();
if(uperiod < (Usup+2*u-Uinf)) {
if(uperiod <= (Usup-Uinf)) {
u = 0;
}
else {
u = (uperiod-(Usup-Uinf))*0.5;
}
}
}
if(S->IsVPeriodic()) {
Standard_Real vperiod = S->VPeriod();
if(vperiod < (Vsup+2*v-Vinf)) {
if(vperiod <= (Vsup-Vinf)) {
v = 0;
}
else {
v = (vperiod-(Vsup-Vinf))*0.5;
}
}
}
}
else {
S = BRep_Tool::Surface(F);// Si S est un plan, pas de changement de parametrisation
GeomAdaptor_Surface GAS(S);
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(GAS);
ProjLib_ComputeApprox ProjOnCurve(G3dAHC,GAHS,Tol);
if(ProjOnCurve.BSpline().IsNull()) {
Curve2d = Geom2dConvert::CurveToBSplineCurve(ProjOnCurve.Bezier());
return Standard_True;
}
Curve2d = ProjOnCurve.BSpline();
return Standard_True;
}
GeomAdaptor_Surface GAS(S,Uinf-u,Usup+u,Vinf-v,Vsup+v);
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(GAS);
ProjLib_ComputeApproxOnPolarSurface ProjOnCurve(G2dAHC,G3dAHC,GAHS,Tol);
if(ProjOnCurve.IsDone()) {
Curve2d = ProjOnCurve.BSpline();
return Standard_True;
}
else {
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
return Standard_True;
}
}
else {
TopTools_ListIteratorOfListOfShape itled;
TColStd_ListIteratorOfListOfTransient itlcu;
for (itled.Initialize(myled), itlcu.Initialize(mylcu);
itled.More(); // itlcu.More()
itled.Next(),itlcu.Next()) {
if (itled.Value().IsSame(E)) {
// deja traitee
break;
}
}
if (!itled.More()) { // on stocke l`edge et la curve2d
Handle(Geom2d_Curve) C2dBis;
Standard_Real f3d,l3d,f2dBis,l2dBis;
C2d = new Geom2d_TrimmedCurve(C2d, f2d, l2d);
Geom2dAdaptor_Curve G2dAC(C2d, f2d, l2d);
Handle(Geom2dAdaptor_HCurve) G2dAHC = new Geom2dAdaptor_HCurve(G2dAC);
TopoDS_Edge ERevers = E;
ERevers.Reverse();
// TopoDS_Edge ERevers = TopoDS::Edge(E.Reversed());
C2dBis = BRep_Tool::CurveOnSurface(ERevers,F,f2dBis,l2dBis);
Handle(Standard_Type) TheTypeC2dBis = C2dBis->DynamicType();
C2dBis = new Geom2d_TrimmedCurve(C2dBis,f2dBis, l2dBis);
Geom2dAdaptor_Curve G2dACBis(C2dBis, f2dBis, l2dBis);
Handle(Geom2dAdaptor_HCurve) G2dAHCBis = new Geom2dAdaptor_HCurve(G2dACBis);
TopLoc_Location Loc;
Handle(Geom_Curve) C3d = BRep_Tool::Curve(E, f3d,l3d);
if(C3d.IsNull()) {
if(isConvert2d) {
Curve2d = Handle(Geom2d_Curve)::DownCast(C2d->Copy());
return Standard_True;
}
return Standard_False;
}
if(!newE.IsNull()) {
C3d = BRep_Tool::Curve(newE, f3d,l3d);
}
GeomAdaptor_Curve G3dAC(C3d, f3d, l3d);
Handle(GeomAdaptor_HCurve) G3dAHC = new GeomAdaptor_HCurve(G3dAC);
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
Handle(Standard_Type) myT = S->DynamicType();
if(newF.IsNull()) {
mylcu.Append(C2dBis);
Handle(Standard_Type) st = C2d->DynamicType();
if ((st == STANDARD_TYPE(Geom2d_BSplineCurve)) ||
(st == STANDARD_TYPE(Geom2d_BezierCurve))) {
if(isConvert2d) {
Curve2d = Handle(Geom2d_Curve)::DownCast(C2d->Copy());
return Standard_True;
}
return Standard_False;
}
}
else {
S = BRep_Tool::Surface(newF);// S est une BSplineSurface : pas besoin de la trimmed
}
Standard_Real Uinf, Usup, Vinf, Vsup, u = 0, v = 0;
S->Bounds(Uinf, Usup, Vinf, Vsup);
Uinf -= 1e-9; Usup += 1e-9; Vinf -= 1e-9; Vsup += 1e-9;
u = (Usup - Uinf)*0.1;
v = (Vsup - Vinf)*0.1;
if(S->IsUPeriodic()) {
Standard_Real uperiod = S->UPeriod();
if(uperiod < (Usup+2*u-Uinf))
if(uperiod <= (Usup-Uinf))
u = 0;
else
u = (uperiod-(Usup-Uinf))*0.5;
}
if(S->IsVPeriodic()) {
Standard_Real vperiod = S->VPeriod();
if(vperiod < (Vsup+2*v-Vinf))
if(vperiod <= (Vsup-Vinf))
v = 0;
else
v = (vperiod-(Vsup-Vinf))*0.5;
}
GeomAdaptor_Surface GAS(S, Uinf-u,Usup+u,Vinf-v,Vsup+v);
Handle(GeomAdaptor_HSurface) GAHS = new GeomAdaptor_HSurface(GAS);
myled.Append(E);
ProjLib_ComputeApproxOnPolarSurface
ProjOnCurve(G2dAHC,G2dAHCBis,G3dAHC,GAHS,Tol);
if(ProjOnCurve.IsDone()) {
Curve2d = ProjOnCurve.BSpline();
mylcu.Append(ProjOnCurve.Curve2d());
return Standard_True;
}
else {
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
mylcu.Append(C2dBis);
return Standard_True;
}
}
else { // on est au 2ieme tour
C2d = Handle(Geom2d_Curve)::DownCast(itlcu.Value());
Handle(Standard_Type) st = C2d->DynamicType();
if (!(st == STANDARD_TYPE(Geom2d_BSplineCurve)) &&
!(st == STANDARD_TYPE(Geom2d_BezierCurve))) {
return Standard_False;
}
Curve2d = Geom2dConvert::CurveToBSplineCurve(C2d);
return Standard_True;
}
}
Curve2d = C2d;
return Standard_True;
}
//=======================================================================
//function : NewParameter
//purpose :
//=======================================================================
Standard_Boolean BRepTools_NurbsConvertModification_21423::NewParameter
(const TopoDS_Vertex& V,
const TopoDS_Edge& E,
Standard_Real& P,
Standard_Real& Tol)
{
if(BRep_Tool::Degenerated(E))
return Standard_False;
Standard_Real f, l, param = BRep_Tool::Parameter(V,E);
TopLoc_Location L;
Handle(Geom_Curve) gc = BRep_Tool::Curve(E, L, f, l);
if(!myMap.Contains(gc))
return Standard_False;
Handle(Geom_BSplineCurve) gcc =
Handle(Geom_BSplineCurve)::DownCast(myMap.FindFromKey(gc));
gcc = Handle(Geom_BSplineCurve)::DownCast(gcc->Transformed(L.Transformation()));
GeomAdaptor_Curve ac(gcc);
gp_Pnt pnt = BRep_Tool::Pnt(V);
Extrema_LocateExtPC proj(pnt, ac, param, f, l, Tol);
if(proj.IsDone()) {
Standard_Real Dist2Min = proj.SquareDistance();
if (Dist2Min < Tol*Tol) {
// Standard_Real U_final_point,V_final_point;
P = proj.Point().Parameter();
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : Continuity
//purpose :
//=======================================================================
GeomAbs_Shape BRepTools_NurbsConvertModification_21423::Continuity
(const TopoDS_Edge& E,
const TopoDS_Face& F1,
const TopoDS_Face& F2,
const TopoDS_Edge&,
const TopoDS_Face&,
const TopoDS_Face&)
{
return BRep_Tool::Continuity(E,F1,F2);
}

View File

@ -0,0 +1,141 @@
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _BRepTools_NurbsConvertModification_21423_HeaderFile
#define _BRepTools_NurbsConvertModification_21423_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_BRepTools_NurbsConvertModification_21423_HeaderFile
#include <Handle_BRepTools_NurbsConvertModification_21423.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TColStd_ListOfTransient_HeaderFile
#include <TColStd_ListOfTransient.hxx>
#endif
#ifndef _TColStd_IndexedDataMapOfTransientTransient_HeaderFile
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#endif
#ifndef _BRepTools_Modification_HeaderFile
#include <BRepTools_Modification.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _Handle_Geom_Curve_HeaderFile
#include <Handle_Geom_Curve.hxx>
#endif
#ifndef _Handle_Geom2d_Curve_HeaderFile
#include <Handle_Geom2d_Curve.hxx>
#endif
#ifndef _GeomAbs_Shape_HeaderFile
#include <GeomAbs_Shape.hxx>
#endif
class TopoDS_Face;
class Geom_Surface;
class TopLoc_Location;
class TopoDS_Edge;
class Geom_Curve;
class TopoDS_Vertex;
class gp_Pnt;
class Geom2d_Curve;
//! Defines a modification of the geometry by a Trsf <br>
//! from gp. All methods return True and transform the <br>
//! geometry. <br>
class BRepTools_NurbsConvertModification_21423 : public BRepTools_Modification {
public:
Standard_EXPORT BRepTools_NurbsConvertModification_21423();
//! Returns Standard_True if the face <F> has been <br>
//! modified. In this case, <S> is the new geometric <br>
//! support of the face, <L> the new location,<Tol> <br>
//! the new tolerance.<RevWires> has to be set to <br>
//! Standard_True when the modification reverses the <br>
//! normal of the surface.(the wires have to be <br>
//! reversed). <RevFace> has to be set to <br>
//! Standard_True if the orientation of the modified <br>
//! face changes in the shells which contain it. -- <br>
//! Here, <RevFace> will return Standard_True if the <br>
//! -- gp_Trsf is negative. <br>
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
//! Returns Standard_True if the edge <E> has been <br>
//! modified. In this case, <C> is the new geometric <br>
//! support of the edge, <L> the new location, <Tol> <br>
//! the new tolerance. Otherwise, returns <br>
//! Standard_False, and <C>, <L>, <Tol> are not <br>
//! significant. <br>
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
//! Returns Standard_True if the vertex <V> has been <br>
//! modified. In this case, <P> is the new geometric <br>
//! support of the vertex, <Tol> the new tolerance. <br>
//! Otherwise, returns Standard_False, and <P>, <Tol> <br>
//! are not significant. <br>
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
//! Returns Standard_True if the edge <E> has a new <br>
//! curve on surface on the face <F>.In this case, <C> <br>
//! is the new geometric support of the edge, <L> the <br>
//! new location, <Tol> the new tolerance. <br>
//! Otherwise, returns Standard_False, and <C>, <L>, <br>
//! <Tol> are not significant. <br>
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
//! Returns Standard_True if the Vertex <V> has a new <br>
//! parameter on the edge <E>. In this case, <P> is <br>
//! the parameter, <Tol> the new tolerance. <br>
//! Otherwise, returns Standard_False, and <P>, <Tol> <br>
//! are not significant. <br>
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
//! Returns the continuity of <NewE> between <NewF1> <br>
//! and <NewF2>. <br>
//! <br>
//! <NewE> is the new edge created from <E>. <NewF1> <br>
//! (resp. <NewF2>) is the new face created from <F1> <br>
//! (resp. <F2>). <br>
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
DEFINE_STANDARD_RTTI(BRepTools_NurbsConvertModification_21423)
protected:
private:
TopTools_ListOfShape myled;
TColStd_ListOfTransient mylcu;
TColStd_IndexedDataMapOfTransientTransient myMap;
};
// other Inline functions and methods (like "C++: function call" methods)
#endif

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
@ -79,6 +78,8 @@
#define NBEDGES 12 #define NBEDGES 12
#define NBVERTS 8 #define NBVERTS 8
#define PLANAR_FACE_MAX_TOLERANCE 1e-06
static Standard_Integer mod4 (Standard_Integer nb) static Standard_Integer mod4 (Standard_Integer nb)
{ {
if (nb <= 0) return nb + 4; if (nb <= 0) return nb + 4;
@ -1197,10 +1198,12 @@ Standard_Integer GEOMImpl_Block6Explorer::FindFace
//function : MakeFace //function : MakeFace
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire, TCollection_AsciiString GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
const Standard_Boolean isPlanarWanted, const Standard_Boolean isPlanarWanted,
TopoDS_Shape& theResult) TopoDS_Shape& theResult)
{ {
TCollection_AsciiString aWarning;
// Workaround for Mantis issue 0020956 // Workaround for Mantis issue 0020956
if (isPlanarWanted) { if (isPlanarWanted) {
// Count the number of points in the wire. // Count the number of points in the wire.
@ -1247,14 +1250,14 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
BRepBuilderAPI_MakeFace MK (plane, theWire, isPlanarWanted); BRepBuilderAPI_MakeFace MK (plane, theWire, isPlanarWanted);
if (MK.IsDone()) { if (MK.IsDone()) {
theResult = MK.Shape(); theResult = MK.Shape();
return; return aWarning;
} }
} }
else { else {
BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted); BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted);
if (MK.IsDone()) { if (MK.IsDone()) {
theResult = MK.Shape(); theResult = MK.Shape();
return; return aWarning;
} }
} }
} }
@ -1263,7 +1266,7 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted); BRepBuilderAPI_MakeFace MK (theWire, isPlanarWanted);
if (MK.IsDone()) { if (MK.IsDone()) {
theResult = MK.Shape(); theResult = MK.Shape();
return; return aWarning;
} }
} }
@ -1346,7 +1349,7 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
if (!aFS.Found()) { if (!aFS.Found()) {
aFS.Init(theWire, aToleranceReached, isPlanarWanted); aFS.Init(theWire, aToleranceReached, isPlanarWanted);
if (!aFS.Found()) return; if (!aFS.Found()) return aWarning;
aToleranceReached = aFS.ToleranceReached(); aToleranceReached = aFS.ToleranceReached();
aTol = aFS.Tolerance(); aTol = aFS.Tolerance();
} }
@ -1354,7 +1357,7 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
// Copy the wire, bacause it can be updated with very-very big tolerance here // Copy the wire, bacause it can be updated with very-very big tolerance here
BRepBuilderAPI_Copy aMC (theWire); BRepBuilderAPI_Copy aMC (theWire);
if (!aMC.IsDone()) return; if (!aMC.IsDone()) return aWarning;
TopoDS_Wire aWire = TopoDS::Wire(aMC.Shape()); TopoDS_Wire aWire = TopoDS::Wire(aMC.Shape());
// Update tolerances to <aTol> // Update tolerances to <aTol>
BRep_Builder B; BRep_Builder B;
@ -1371,7 +1374,9 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
BRepBuilderAPI_MakeFace MK1 (aWire, isPlanarWanted); BRepBuilderAPI_MakeFace MK1 (aWire, isPlanarWanted);
if (MK1.IsDone()) { if (MK1.IsDone()) {
theResult = MK1.Shape(); theResult = MK1.Shape();
return; if (aTol > PLANAR_FACE_MAX_TOLERANCE)
aWarning = "MAKE_FACE_TOLERANCE_TOO_BIG";
return aWarning;
} }
#else // After migration on OCCT version, containing PKV's fix. See bug 8293 #else // After migration on OCCT version, containing PKV's fix. See bug 8293
@ -1379,8 +1384,10 @@ void GEOMImpl_Block6Explorer::MakeFace (const TopoDS_Wire& theWire,
aBMF.Init(theWire, isPlanarWanted, Standard_True); aBMF.Init(theWire, isPlanarWanted, Standard_True);
if (aBMF.Error() == BRepLib_FaceDone) { if (aBMF.Error() == BRepLib_FaceDone) {
theResult = aBMF.Shape(); theResult = aBMF.Shape();
return; return aWarning;
} }
#endif #endif
} }
return aWarning;
} }

View File

@ -18,11 +18,10 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMImpl_Block6Explorer.hxx // File : GEOMImpl_Block6Explorer.hxx
// Module : GEOMImpl // Module : GEOMImpl
//
#ifndef GEOMImpl_Block6Explorer_HeaderFile #ifndef GEOMImpl_Block6Explorer_HeaderFile
#define GEOMImpl_Block6Explorer_HeaderFile #define GEOMImpl_Block6Explorer_HeaderFile
@ -30,6 +29,7 @@
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <TopTools_Array1OfShape.hxx> #include <TopTools_Array1OfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TCollection_AsciiString.hxx>
#include <gp_Trsf.hxx> #include <gp_Trsf.hxx>
// Class GEOMImpl_Block6Explorer gives easy and fast access to a certain sub-elements of hexahedral solid // Class GEOMImpl_Block6Explorer gives easy and fast access to a certain sub-elements of hexahedral solid
@ -214,9 +214,9 @@ class GEOMImpl_Block6Explorer
const Standard_Boolean findAll = Standard_False); const Standard_Boolean findAll = Standard_False);
// returns number of found faces // returns number of found faces
static void MakeFace (const TopoDS_Wire& theWire, static TCollection_AsciiString MakeFace (const TopoDS_Wire& theWire,
const Standard_Boolean isPlanarWanted, const Standard_Boolean isPlanarWanted,
TopoDS_Shape& theResult); TopoDS_Shape& theResult);
private: private:
// ---------- PRIVATE FIELDS ---------- // ---------- PRIVATE FIELDS ----------

View File

@ -83,7 +83,6 @@
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepMesh_IncrementalMesh.hxx> #include <BRepMesh_IncrementalMesh.hxx>
#include <TopAbs.hxx> #include <TopAbs.hxx>
@ -458,6 +457,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) th
aCI.SetIsPlanar(isPlanarWanted); aCI.SetIsPlanar(isPlanarWanted);
//Compute the Face value //Compute the Face value
Standard_Boolean isWarning = Standard_False;
try { try {
#if OCC_VERSION_LARGE > 0x06010000 #if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
@ -470,14 +470,20 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFace (Handle(GEOM_Object) th
catch (Standard_Failure) { catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught(); Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString()); SetErrorCode(aFail->GetMessageString());
return NULL; // to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
} else {
return NULL;
}
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFace(" GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeFace("
<< theWire << ", " << (int)isPlanarWanted << ")"; << theWire << ", " << (int)isPlanarWanted << ")";
SetErrorCode(OK); // to provide warning
if (!isWarning) SetErrorCode(OK);
return aFace; return aFace;
} }
@ -522,6 +528,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires
aCI.SetIsPlanar(isPlanarWanted); aCI.SetIsPlanar(isPlanarWanted);
//Compute the shape //Compute the shape
Standard_Boolean isWarning = Standard_False;
try { try {
#if OCC_VERSION_LARGE > 0x06010000 #if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS; OCC_CATCH_SIGNALS;
@ -534,7 +541,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires
catch (Standard_Failure) { catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught(); Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString()); SetErrorCode(aFail->GetMessageString());
return NULL; // to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
} else {
return NULL;
}
} }
//Make a Python command //Make a Python command
@ -551,7 +563,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWires
} }
pd << "], " << (int)isPlanarWanted << ")"; pd << "], " << (int)isPlanarWanted << ")";
SetErrorCode(OK); // to provide warning
if (!isWarning) SetErrorCode(OK);
return aShape; return aShape;
} }

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
@ -31,7 +30,7 @@
#include <ShapeFix_ShapeTolerance.hxx> #include <ShapeFix_ShapeTolerance.hxx>
#include <BRepBuilderAPI_Transform.hxx> #include <BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_GTransform.hxx> #include <BRepBuilderAPI_GTransform_21423.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepAlgo.hxx> #include <BRepAlgo.hxx>
#include <BRepCheck_Analyzer.hxx> #include <BRepCheck_Analyzer.hxx>
@ -165,7 +164,7 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const
} }
} }
BRepBuilderAPI_GTransform aBRepGTrsf (aShapeBase, aGTrsf, Standard_False); BRepBuilderAPI_GTransform_21423 aBRepGTrsf (aShapeBase, aGTrsf, Standard_False);
if (!aBRepGTrsf.IsDone()) if (!aBRepGTrsf.IsDone())
Standard_ConstructionError::Raise("Scaling not done"); Standard_ConstructionError::Raise("Scaling not done");
aShape = aBRepGTrsf.Shape(); aShape = aBRepGTrsf.Shape();
@ -236,5 +235,5 @@ const Handle(GEOMImpl_ScaleDriver) Handle(GEOMImpl_ScaleDriver)::DownCast(const
} }
} }
return _anOtherObject ; return _anOtherObject;
} }

View File

@ -121,6 +121,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
Standard_Integer aType = aFunction->GetType(); Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape; TopoDS_Shape aShape;
TCollection_AsciiString aWarning;
BRep_Builder B; BRep_Builder B;
if (aType == WIRE_EDGES) { if (aType == WIRE_EDGES) {
@ -214,7 +216,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
Standard_NullObject::Raise Standard_NullObject::Raise
("Shape for face construction is neither a wire nor a closed edge"); ("Shape for face construction is neither a wire nor a closed edge");
} }
GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape); aWarning = GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
if (aShape.IsNull()) { if (aShape.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed"); Standard_ConstructionError::Raise("Face construction failed");
} }
@ -270,7 +272,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
// 4.a. Basic face // 4.a. Basic face
TopoDS_Shape aFFace; TopoDS_Shape aFFace;
TopoDS_Wire aW1 = TopoDS::Wire(aSeqClosedWires->Value(1)); TopoDS_Wire aW1 = TopoDS::Wire(aSeqClosedWires->Value(1));
GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace); aWarning = GEOMImpl_Block6Explorer::MakeFace(aW1, aCI.GetIsPlanar(), aFFace);
if (aFFace.IsNull()) { if (aFFace.IsNull()) {
Standard_ConstructionError::Raise("Face construction failed"); Standard_ConstructionError::Raise("Face construction failed");
} }
@ -495,6 +497,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
TColStd_SequenceOfReal TolSeq; TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType; GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex; TopoDS_Vertex FirstVertex, LastVertex;
Standard_Boolean FinalReverse = Standard_False;
BRepTools_WireExplorer wexp(theWire) ; BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next()) for (; wexp.More(); wexp.Next())
@ -526,6 +529,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
LparSeq.Append(lpar); LparSeq.Append(lpar);
CurType = aType; CurType = aType;
FirstVertex = wexp.CurrentVertex(); FirstVertex = wexp.CurrentVertex();
if (anEdge.Orientation() == TopAbs_REVERSED)
FinalReverse = Standard_True;
} }
else else
{ {
@ -728,6 +733,11 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
LastVertex = wexp.CurrentVertex(); LastVertex = wexp.CurrentVertex();
TolSeq.Append(BRep_Tool::Tolerance(LastVertex)); TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex;
FirstVtx_final.Orientation(TopAbs_FORWARD);
TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex;
LastVtx_final.Orientation(TopAbs_REVERSED);
if (!CurveSeq.IsEmpty()) if (!CurveSeq.IsEmpty())
{ {
Standard_Integer nb_curve = CurveSeq.Length(); //number of curves Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
@ -795,20 +805,25 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built"); Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built");
} }
ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()), ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
FirstVertex, LastVertex); FirstVtx_final, LastVtx_final,
concatcurve->Value(concatcurve->Lower())->FirstParameter(),
concatcurve->Value(concatcurve->Lower())->LastParameter());
} }
else else
{ {
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve))) if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve(); CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
CurveSeq(1)->Transform(LocSeq(1).Location().Transformation()); CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
ResEdge = BRepLib_MakeEdge(CurveSeq(1), ResEdge = BRepLib_MakeEdge(CurveSeq(1),
FirstVertex, LastVertex, FirstVtx_final, LastVtx_final,
FparSeq(1), LparSeq(1)); FparSeq(1), LparSeq(1));
} }
} }
if (FinalReverse)
ResEdge.Reverse();
aShape = ResEdge; aShape = ResEdge;
} }
else if (aType == EDGE_CURVE_LENGTH) { else if (aType == EDGE_CURVE_LENGTH) {
@ -873,7 +888,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
// Get the point by length // Get the point by length
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve); GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst); GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
Standard_Real aParam = anAbsPnt.Parameter(); Standard_Real aParam = anAbsPnt.Parameter();
if (AdapCurve.IsClosed() && aLength < 0.0) { if (AdapCurve.IsClosed() && aLength < 0.0) {
@ -901,6 +916,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
log.SetTouched(Label()); log.SetTouched(Label());
if (!aWarning.IsEmpty())
Standard_Failure::Raise(aWarning.ToCString());
return 1; return 1;
} }

View File

@ -0,0 +1,27 @@
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _Handle_BRepTools_NurbsConvertModification_21423_HeaderFile
#define _Handle_BRepTools_NurbsConvertModification_21423_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_BRepTools_Modification_HeaderFile
#include <Handle_BRepTools_Modification.hxx>
#endif
class Standard_Transient;
class Handle(Standard_Type);
class Handle(BRepTools_Modification);
class BRepTools_NurbsConvertModification_21423;
DEFINE_STANDARD_HANDLE(BRepTools_NurbsConvertModification_21423,BRepTools_Modification)
#endif

View File

@ -104,6 +104,12 @@ salomeinclude_HEADERS = \
GEOMImpl_MirrorDriver.hxx \ GEOMImpl_MirrorDriver.hxx \
GEOMImpl_ProjectionDriver.hxx \ GEOMImpl_ProjectionDriver.hxx \
GEOMImpl_OffsetDriver.hxx \ GEOMImpl_OffsetDriver.hxx \
BRepBuilderAPI_GTransform_21423.hxx \
BRepBuilderAPI_ModifyShape_21423.hxx \
BRepBuilderAPI_NurbsConvert_21423.hxx \
BRepTools_Modifier_21423.hxx \
BRepTools_NurbsConvertModification_21423.hxx \
Handle_BRepTools_NurbsConvertModification_21423.hxx \
GEOMImpl_ScaleDriver.hxx \ GEOMImpl_ScaleDriver.hxx \
GEOMImpl_PositionDriver.hxx \ GEOMImpl_PositionDriver.hxx \
GEOMImpl_BoxDriver.hxx \ GEOMImpl_BoxDriver.hxx \
@ -174,6 +180,11 @@ dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_MirrorDriver.cxx \ GEOMImpl_MirrorDriver.cxx \
GEOMImpl_ProjectionDriver.cxx \ GEOMImpl_ProjectionDriver.cxx \
GEOMImpl_OffsetDriver.cxx \ GEOMImpl_OffsetDriver.cxx \
BRepBuilderAPI_GTransform_21423.cxx \
BRepBuilderAPI_ModifyShape_21423.cxx \
BRepBuilderAPI_NurbsConvert_21423.cxx \
BRepTools_Modifier_21423.cxx \
BRepTools_NurbsConvertModification_21423.cxx \
GEOMImpl_ScaleDriver.cxx \ GEOMImpl_ScaleDriver.cxx \
GEOMImpl_PositionDriver.cxx \ GEOMImpl_PositionDriver.cxx \
GEOMImpl_BoxDriver.cxx \ GEOMImpl_BoxDriver.cxx \

View File

@ -202,7 +202,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFace
//Create the Face //Create the Face
Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted); Handle(GEOM_Object) anObject = GetOperations()->MakeFace(aWire, isPlanarWanted);
if (!GetOperations()->IsDone() || anObject.IsNull()) //if (!GetOperations()->IsDone() || anObject.IsNull())
// enable warning status
if (anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
return GetObject(anObject); return GetObject(anObject);
@ -236,7 +238,9 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeFaceWires
// Make Face // Make Face
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakeFaceWires(aShapes, isPlanarWanted); GetOperations()->MakeFaceWires(aShapes, isPlanarWanted);
if (!GetOperations()->IsDone() || anObject.IsNull()) //if (!GetOperations()->IsDone() || anObject.IsNull())
// enable warning status
if (anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
return GetObject(anObject); return GetObject(anObject);

View File

@ -254,10 +254,11 @@ class Beam(StructuralElementPart):
orientation is different than the orientation of the underlying OCC orientation is different than the orientation of the underlying OCC
object. object.
""" """
length = self.geom.BasicProperties(path)[0]
p1 = self.geom.MakeVertexOnCurve(path, 0.0) p1 = self.geom.MakeVertexOnCurve(path, 0.0)
p2 = self.geom.GetFirstVertex(path) p2 = self.geom.GetFirstVertex(path)
dist = self.geom.MinDistance(p1, p2) dist = self.geom.MinDistance(p1, p2)
return dist != 0.0 return dist > length / 2
def _getVertexAndTangentOnOrientedWire(self, path, param): def _getVertexAndTangentOnOrientedWire(self, path, param):
""" """

View File

@ -1731,7 +1731,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
def MakeFace(self,theWire, isPlanarWanted): def MakeFace(self,theWire, isPlanarWanted):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted) anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted)
RaiseIfFailed("MakeFace", self.ShapesOp) if anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
print "WARNING: Tolerance of resulting face is too big."
else:
RaiseIfFailed("MakeFace", self.ShapesOp)
return anObj return anObj
## Create a face on the given wires set. ## Create a face on the given wires set.
@ -1744,7 +1747,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
def MakeFaceWires(self,theWires, isPlanarWanted): def MakeFaceWires(self,theWires, isPlanarWanted):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted) anObj = self.ShapesOp.MakeFaceWires(theWires, isPlanarWanted)
RaiseIfFailed("MakeFaceWires", self.ShapesOp) if anObj is not None and self.ShapesOp.GetErrorCode() == "MAKE_FACE_TOLERANCE_TOO_BIG":
print "WARNING: Tolerance of resulting face is too big."
else:
RaiseIfFailed("MakeFaceWires", self.ShapesOp)
return anObj return anObj
## Shortcut to MakeFaceWires() ## Shortcut to MakeFaceWires()

View File

@ -620,9 +620,23 @@ void GroupGUI_GroupDlg::showOnlySelected()
aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true); aDisplayer->Erase(aSelList, /*forced=*/false, /*updateViewer=*/true);
} }
else { else {
// Mantis issue 0021421: do not hide main shape, if explode on VERTEX
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
Handle(SALOME_InteractiveObject) io =
new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
if (view->isVisible(io)) myIsHiddenMain = true;
}
aDisplayer->EraseAll(/*forced = false, updateViewer = true*/); aDisplayer->EraseAll(/*forced = false, updateViewer = true*/);
aDisplayer->Display(aSelList, true); aDisplayer->Display(aSelList, true);
// Mantis issue 0021421: do not hide main shape, if explode on VERTEX
if (getShapeType() == TopAbs_VERTEX && myIsHiddenMain) {
aDisplayer->Display(myMainObj);
}
// for the case when selected ids were not displayed in the viewer: Mantis issue 0021367 // for the case when selected ids were not displayed in the viewer: Mantis issue 0021367
highlightSubShapes(); highlightSubShapes();
} }
@ -807,13 +821,22 @@ void GroupGUI_GroupDlg::activateSelection()
myIsShapeType) // check if shape type is already choosen by user myIsShapeType) // check if shape type is already choosen by user
{ {
GEOM_Displayer* aDisplayer = getDisplayer(); GEOM_Displayer* aDisplayer = getDisplayer();
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) { // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry(); if (getShapeType() == TopAbs_VERTEX) {
Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO"); if (myIsHiddenMain)
if (view->isVisible(io)) { aDisplayer->Display(myMainObj);
aDisplayer->Erase(myMainObj, false, false); }
myIsHiddenMain = true; else {
SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
Handle(SALOME_InteractiveObject) io =
new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
if (view->isVisible(io)) {
aDisplayer->Erase(myMainObj, false, false);
myIsHiddenMain = true;
}
} }
} }

View File

@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// GEOM GEOMGUI : GUI for Geometry component // GEOM GEOMGUI : GUI for Geometry component
// File : OperationGUI_PartitionDlg.cxx // File : OperationGUI_PartitionDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
//
#include "OperationGUI_PartitionDlg.h" #include "OperationGUI_PartitionDlg.h"
#include <DlgRef.h> #include <DlgRef.h>
@ -44,7 +43,7 @@
//================================================================================= //=================================================================================
// class : OperationGUI_PartitionDlg() // class : OperationGUI_PartitionDlg()
// purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the // purpose : Constructs a OperationGUI_PartitionDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'. // name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
@ -88,7 +87,7 @@ OperationGUI_PartitionDlg::OperationGUI_PartitionDlg( GeometryGUI* theGeometryGU
/***************************************************************/ /***************************************************************/
setHelpFileName( "partition_page.html" ); setHelpFileName( "partition_page.html" );
Init(); Init();
} }
@ -104,12 +103,12 @@ OperationGUI_PartitionDlg::~OperationGUI_PartitionDlg()
void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials ) void OperationGUI_PartitionDlg::SetListMaterials( GEOM::ListOfLong ListMaterials )
{ {
myListMaterials = ListMaterials; myListMaterials = ListMaterials;
} }
GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials() GEOM::ListOfLong OperationGUI_PartitionDlg::GetListMaterials()
{ {
return myListMaterials; return myListMaterials;
} }
//================================================================================= //=================================================================================
@ -132,7 +131,7 @@ void OperationGUI_PartitionDlg::Init()
GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) ); GroupPoints->ComboBox1->addItem( tr( "GEOM_RECONSTRUCTION_LIMIT_VERTEX" ) );
GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX); GroupPoints->ComboBox1->setItemData(GroupPoints->ComboBox1->count()-1, GEOM::VERTEX);
GroupPoints->CheckButton1->setChecked( false ); GroupPoints->CheckButton1->setChecked( false );
mainFrame()->GroupBoxPublish->show(); mainFrame()->GroupBoxPublish->show();
/* signals and slots connections */ /* signals and slots connections */
@ -140,13 +139,13 @@ void OperationGUI_PartitionDlg::Init()
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) ); connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ); connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) ); connect( GroupPoints->ComboBox1, SIGNAL( activated( int ) ), this, SLOT( ComboTextChanged() ) );
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
@ -154,7 +153,7 @@ void OperationGUI_PartitionDlg::Init()
connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); connect( GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) ); connect( GroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(processPreview()) );
initName( tr( "GEOM_PARTITION" ) ); initName( tr( "GEOM_PARTITION" ) );
ConstructorsClicked( 0 ); ConstructorsClicked( 0 );
@ -170,13 +169,13 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
{ {
disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
globalSelection(); globalSelection();
//myListShapes.length( 0 ); //myListShapes.length( 0 );
//myListTools.length( 0 ); //myListTools.length( 0 );
//myListKeepInside.length( 0 ); // obsolete //myListKeepInside.length( 0 ); // obsolete
//myListRemoveInside.length( 0 ); // obsolete //myListRemoveInside.length( 0 ); // obsolete
//myListMaterials.length( 0 ); // obsolete //myListMaterials.length( 0 ); // obsolete
switch ( constructorId ) { switch ( constructorId ) {
case 0: /*Full partition */ case 0: /*Full partition */
GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) ); GroupPoints->GroupBox1->setTitle( tr( "GEOM_PARTITION" ) );
@ -203,7 +202,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
GroupPoints->PushButton1->setDown( true ); GroupPoints->PushButton1->setDown( true );
GroupPoints->LineEdit1->setEnabled(true); GroupPoints->LineEdit1->setEnabled(true);
break; break;
} }
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->clear(); GroupPoints->LineEdit1->clear();
@ -214,7 +213,7 @@ void OperationGUI_PartitionDlg::ConstructorsClicked( int constructorId )
resize( minimumSizeHint() ); resize( minimumSizeHint() );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
SelectionIntoArgument(); SelectionIntoArgument();
} }
@ -240,10 +239,9 @@ bool OperationGUI_PartitionDlg::ClickOnApply()
{ {
if ( !onAccept() ) if ( !onAccept() )
return false; return false;
initName(); initName();
// 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window // 0020854: EDF 1398 GEOM: Ergonomy of Partition GUI window
// ConstructorsClicked( getConstructorId() ); // ConstructorsClicked( getConstructorId() );
return true; return true;
} }
@ -257,13 +255,13 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QString aString = ""; QString aString = "";
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true); int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
if ( getConstructorId() == 1 ) { if ( getConstructorId() == 1 ) {
// for half-selection, only one shape can be selected as an object // for half-selection, only one shape can be selected as an object
// and only one plane as a tool // and only one plane as a tool
@ -292,11 +290,11 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
} }
} }
} }
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) { if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true); GEOMBase::ConvertListOfIOInListOfGO(aSelList, myListShapes, true);
//myListMaterials.length( 0 ); // obsolete //myListMaterials.length( 0 ); // obsolete
GEOM::shape_type type = GEOM::SHAPE; GEOM::shape_type type = GEOM::SHAPE;
for (int i = 0; i < myListShapes.length(); i++) for (int i = 0; i < myListShapes.length(); i++)
type = qMin( type, myListShapes[i]->GetMaxShapeType() ); type = qMin( type, myListShapes[i]->GetMaxShapeType() );
@ -322,7 +320,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
} }
} }
} }
myEditCurrentArgument->setText( aString ); myEditCurrentArgument->setText( aString );
processPreview(); processPreview();
} }
@ -335,7 +333,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
void OperationGUI_PartitionDlg::SetEditCurrentArgument() void OperationGUI_PartitionDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if ( send == GroupPoints->PushButton1 ) { if ( send == GroupPoints->PushButton1 ) {
myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->PushButton2->setDown(false); GroupPoints->PushButton2->setDown(false);
@ -351,9 +349,9 @@ void OperationGUI_PartitionDlg::SetEditCurrentArgument()
if ( getConstructorId() == 1 ) if ( getConstructorId() == 1 )
globalSelection( GEOM_PLANE ); globalSelection( GEOM_PLANE );
} }
globalSelection( GEOM_ALLSHAPES ); globalSelection( GEOM_ALLSHAPES );
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
send->setDown(true); send->setDown(true);
@ -369,7 +367,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
{ {
QLineEdit* send = (QLineEdit*)sender(); QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 || if ( send == GroupPoints->LineEdit1 ||
send == GroupPoints->LineEdit2 ) { send == GroupPoints->LineEdit2 ) {
myEditCurrentArgument = send; myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed(); GEOMBase_Skeleton::LineEditReturnPressed();
@ -384,10 +382,10 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
void OperationGUI_PartitionDlg::ActivateThisDialog() void OperationGUI_PartitionDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect( myGeomGUI->getApp()->selectionMgr(), connect( myGeomGUI->getApp()->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
processPreview(); processPreview();
} }
@ -417,9 +415,11 @@ GEOM::GEOM_IOperations_ptr OperationGUI_PartitionDlg::createOperation()
// function : isValid // function : isValid
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::isValid( QString& ) bool OperationGUI_PartitionDlg::isValid (QString& )
{ {
return ( myListShapes.length() || myListTools.length() ); // || myListKeepInside.length() || myListRemoveInside.length() // obsolete return (getConstructorId() == 0 ?
myListShapes.length() :
myListShapes.length() && myListTools.length());
} }
@ -427,31 +427,35 @@ bool OperationGUI_PartitionDlg::isValid( QString& )
// function : execute // function : execute
// purpose : // purpose :
//================================================================================= //=================================================================================
bool OperationGUI_PartitionDlg::execute( ObjectList& objects ) bool OperationGUI_PartitionDlg::execute (ObjectList& objects)
{ {
bool res = false; bool res = false;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
int aLimit = GetLimit(); GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked();
bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow( getOperation() );
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0: case 0:
anObj = aNoSelfIntersection ? {
anOper->MakePartitionNonSelfIntersectedShape( myListShapes, myListTools, int aLimit = GetLimit();
myListKeepInside, myListRemoveInside, int aKeepNonlimitShapes = GroupPoints->CheckButton1->isChecked();
aLimit, false, myListMaterials, aKeepNonlimitShapes ) : bool aNoSelfIntersection = GroupPoints->CheckButton2->isChecked();
anOper->MakePartition( myListShapes, myListTools,
myListKeepInside, myListRemoveInside, anObj = aNoSelfIntersection ?
aLimit, false, myListMaterials, aKeepNonlimitShapes ); anOper->MakePartitionNonSelfIntersectedShape(myListShapes, myListTools,
res = true; myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes) :
anOper->MakePartition(myListShapes, myListTools,
myListKeepInside, myListRemoveInside,
aLimit, false, myListMaterials, aKeepNonlimitShapes);
res = true;
}
break; break;
case 1: case 1:
anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() ); {
res = true; anObj = anOper->MakeHalfPartition( myListShapes[0].in(), myListTools[0].in() );
res = true;
}
break; break;
} }
@ -460,7 +464,7 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ); GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE );
TopoDS_Iterator It( aShape, Standard_True, Standard_True ); TopoDS_Iterator It( aShape, Standard_True, Standard_True );
int nbSubshapes = 0; int nbSubshapes = 0;
for ( ; It.More(); It.Next() ) for (; It.More(); It.Next())
nbSubshapes++; nbSubshapes++;
if ( nbSubshapes ) if ( nbSubshapes )
@ -470,7 +474,7 @@ bool OperationGUI_PartitionDlg::execute( ObjectList& objects )
QObject::tr( "GEOM_ERROR" ), QObject::tr( "GEOM_ERROR" ),
QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) ); QObject::tr( "GEOM_WRN_PARTITION_RESULT_EMPTY" ) );
} }
return res; return res;
} }
@ -492,7 +496,7 @@ void OperationGUI_PartitionDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy
//======================================================================= //=======================================================================
//function : ComboTextChanged //function : ComboTextChanged
//purpose : //purpose :
//======================================================================= //=======================================================================
void OperationGUI_PartitionDlg::ComboTextChanged() void OperationGUI_PartitionDlg::ComboTextChanged()
{ {
@ -508,7 +512,7 @@ void OperationGUI_PartitionDlg::ComboTextChanged()
//================================================================================= //=================================================================================
// function : GetLimit() // function : GetLimit()
// purpose : // purpose :
//================================================================================= //=================================================================================
int OperationGUI_PartitionDlg::GetLimit() const int OperationGUI_PartitionDlg::GetLimit() const
{ {

View File

@ -68,4 +68,4 @@ libShHealOper_la_LDFLAGS = \
$(CAS_KERNEL) \ $(CAS_KERNEL) \
$(CAS_MATH) \ $(CAS_MATH) \
$(CAS_TKTopAlgo) \ $(CAS_TKTopAlgo) \
$(CAS_LDPATH) -lTKBool -lTKShHealing -lTKLCAF $(CAS_LDPATH) -lTKBool -lTKShHealing -lTKCAF -lTKLCAF