mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 16:30:35 +05:00
PAL7508: Development of GetInPlace() functionality
This commit is contained in:
parent
1dfcc16fdf
commit
b7cff0a4ec
@ -7,6 +7,7 @@ using namespace std;
|
|||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <TDF.hxx>
|
#include <TDF.hxx>
|
||||||
|
#include <TDF_Tool.hxx>
|
||||||
#include <TDF_Data.hxx>
|
#include <TDF_Data.hxx>
|
||||||
#include <TDF_ChildIterator.hxx>
|
#include <TDF_ChildIterator.hxx>
|
||||||
#include <TDF_Reference.hxx>
|
#include <TDF_Reference.hxx>
|
||||||
@ -25,6 +26,8 @@ using namespace std;
|
|||||||
#include <TNaming_NamedShape.hxx>
|
#include <TNaming_NamedShape.hxx>
|
||||||
#include <TNaming_Builder.hxx>
|
#include <TNaming_Builder.hxx>
|
||||||
|
|
||||||
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
#include <TColStd_HArray1OfReal.hxx>
|
#include <TColStd_HArray1OfReal.hxx>
|
||||||
#include <TColStd_HArray1OfInteger.hxx>
|
#include <TColStd_HArray1OfInteger.hxx>
|
||||||
#include <TColStd_HSequenceOfTransient.hxx>
|
#include <TColStd_HSequenceOfTransient.hxx>
|
||||||
@ -36,6 +39,8 @@ using namespace std;
|
|||||||
#define ARGUMENT_LABEL 1
|
#define ARGUMENT_LABEL 1
|
||||||
#define RESULT_LABEL 2
|
#define RESULT_LABEL 2
|
||||||
#define DESCRIPTION_LABEL 3
|
#define DESCRIPTION_LABEL 3
|
||||||
|
#define HISTORY_LABEL 4
|
||||||
|
|
||||||
#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
|
#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
|
||||||
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
|
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
|
||||||
#define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2))
|
#define SUB_ARGUMENT(thePos1, thePos2) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePos1)).FindChild((thePos2))
|
||||||
@ -542,38 +547,38 @@ Handle(TColStd_HSequenceOfTransient) GEOM_Function::GetReferenceList(int thePosi
|
|||||||
* SetShape
|
* SetShape
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
|
//void GEOM_Function::SetShape(int thePosition, const TopoDS_Shape& theShape)
|
||||||
{
|
//{
|
||||||
_isDone = false;
|
// _isDone = false;
|
||||||
if(thePosition <= 0 || theShape.IsNull()) return;
|
// if(thePosition <= 0 || theShape.IsNull()) return;
|
||||||
|
//
|
||||||
TDF_Label anArgLabel = ARGUMENT(thePosition);
|
// TDF_Label anArgLabel = ARGUMENT(thePosition);
|
||||||
TNaming_Builder aBuilder(anArgLabel);
|
// TNaming_Builder aBuilder(anArgLabel);
|
||||||
aBuilder.Generated(theShape);
|
// aBuilder.Generated(theShape);
|
||||||
|
//
|
||||||
_isDone = true;
|
// _isDone = true;
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetShape
|
* GetShape
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
TopoDS_Shape GEOM_Function::GetShape(int thePosition)
|
//TopoDS_Shape GEOM_Function::GetShape(int thePosition)
|
||||||
{
|
//{
|
||||||
_isDone = false;
|
// _isDone = false;
|
||||||
TopoDS_Shape aShape;
|
// TopoDS_Shape aShape;
|
||||||
if(thePosition <= 0) return aShape;
|
// if(thePosition <= 0) return aShape;
|
||||||
|
//
|
||||||
TDF_Label anArgLabel = ARGUMENT(thePosition);
|
// TDF_Label anArgLabel = ARGUMENT(thePosition);
|
||||||
Handle(TNaming_NamedShape) aNS;
|
// Handle(TNaming_NamedShape) aNS;
|
||||||
if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
|
// if(!anArgLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) return aShape;
|
||||||
|
//
|
||||||
aShape = aNS->Get();
|
// aShape = aNS->Get();
|
||||||
_isDone = true;
|
// _isDone = true;
|
||||||
return aShape;
|
// return aShape;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -589,6 +594,49 @@ void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetHistoryEntry
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
TDF_Label GEOM_Function::GetHistoryEntry (const Standard_Boolean create)
|
||||||
|
{
|
||||||
|
return _label.FindChild(HISTORY_LABEL, create);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetArgumentHistoryEntry
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
|
||||||
|
const Standard_Boolean create)
|
||||||
|
{
|
||||||
|
TColStd_ListOfInteger anArgumentRefTags;
|
||||||
|
TDF_Tool::TagList(theArgumentRefEntry, anArgumentRefTags);
|
||||||
|
Standard_Integer anArgumentRefLabelPos = anArgumentRefTags.Extent();
|
||||||
|
|
||||||
|
TDF_Label aHistoryLabel = GetHistoryEntry(create);
|
||||||
|
if (aHistoryLabel.IsNull())
|
||||||
|
return aHistoryLabel;
|
||||||
|
Standard_Integer aHistoryLabelPos = aHistoryLabel.Depth() + 1;
|
||||||
|
|
||||||
|
Standard_Integer itag;
|
||||||
|
TDF_Label aHistoryCurLabel = aHistoryLabel;
|
||||||
|
TColStd_ListIteratorOfListOfInteger aListIter (anArgumentRefTags);
|
||||||
|
for (itag = 1; itag <= aHistoryLabelPos; itag++) {
|
||||||
|
aListIter.Next();
|
||||||
|
}
|
||||||
|
for (; itag <= anArgumentRefLabelPos; itag++) {
|
||||||
|
aHistoryCurLabel = aHistoryCurLabel.FindChild(aListIter.Value(), create);
|
||||||
|
if (aHistoryCurLabel.IsNull())
|
||||||
|
return aHistoryCurLabel;
|
||||||
|
aListIter.Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return aHistoryCurLabel;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GEOM_Function_Type_
|
//function : GEOM_Function_Type_
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -222,16 +222,24 @@ public:
|
|||||||
Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
|
Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
|
||||||
|
|
||||||
//Sets a TopoDS_Shape argument at position thePosition
|
//Sets a TopoDS_Shape argument at position thePosition
|
||||||
void SetShape(int thePosition, const TopoDS_Shape& theShape);
|
//void SetShape(int thePosition, const TopoDS_Shape& theShape);
|
||||||
|
|
||||||
//Returns a TopoDS_Shape argument at position thePosition
|
//Returns a TopoDS_Shape argument at position thePosition
|
||||||
TopoDS_Shape GetShape(int thePosition);
|
//TopoDS_Shape GetShape(int thePosition);
|
||||||
|
|
||||||
//Returns true if the last method succided
|
//Returns true if the last method succided
|
||||||
bool IsDone() { return _isDone; }
|
bool IsDone() { return _isDone; }
|
||||||
|
|
||||||
//Returns a sequence of the external dependencies of this function
|
//Returns a sequence of the external dependencies of this function
|
||||||
void GetDependency(TDF_LabelSequence& theSeq);
|
void GetDependency(TDF_LabelSequence& theSeq);
|
||||||
|
|
||||||
|
//Returns top label of this function's history tree
|
||||||
|
TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
|
||||||
|
|
||||||
|
//Returns history label, corresponding to the label,
|
||||||
|
//on which a reference on argument is stored
|
||||||
|
TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
|
||||||
|
const Standard_Boolean create = Standard_True);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -41,6 +41,22 @@ is
|
|||||||
AloneShapes(me)
|
AloneShapes(me)
|
||||||
returns Integer from Standard;
|
returns Integer from Standard;
|
||||||
|
|
||||||
|
--modified by NIZNHY-PKV Fri Jan 21 14:16:58 2005f-
|
||||||
|
Modified(me:out;
|
||||||
|
S : Shape from TopoDS)
|
||||||
|
returns ListOfShape from TopTools;
|
||||||
|
---C++: return const &
|
||||||
|
|
||||||
|
Generated(me:out;
|
||||||
|
S : Shape from TopoDS)
|
||||||
|
returns ListOfShape from TopTools;
|
||||||
|
---C++: return const &
|
||||||
|
|
||||||
|
IsDeleted (me:out;
|
||||||
|
S : Shape from TopoDS)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
--modified by NIZNHY-PKV Fri Jan 21 14:17:04 2005t
|
||||||
|
|
||||||
CheckData(me:out)
|
CheckData(me:out)
|
||||||
is redefined protected;
|
is redefined protected;
|
||||||
|
|
||||||
@ -97,6 +113,11 @@ is
|
|||||||
aFR : Face from TopoDS;
|
aFR : Face from TopoDS;
|
||||||
aF : Face from TopoDS)
|
aF : Face from TopoDS)
|
||||||
returns Boolean from Standard
|
returns Boolean from Standard
|
||||||
|
is protected;
|
||||||
|
|
||||||
|
HasNewSubShape(me;
|
||||||
|
aS : Shape from TopoDS)
|
||||||
|
returns Boolean from Standard
|
||||||
is protected;
|
is protected;
|
||||||
--
|
--
|
||||||
Images(me)
|
Images(me)
|
||||||
@ -113,5 +134,8 @@ fields
|
|||||||
myImages : DataMapOfShapeListOfShape from TopTools is protected;
|
myImages : DataMapOfShapeListOfShape from TopTools is protected;
|
||||||
myOrigins : DataMapOfShapeShape from TopTools is protected;
|
myOrigins : DataMapOfShapeShape from TopTools is protected;
|
||||||
myNbAlone : Integer from Standard is protected;
|
myNbAlone : Integer from Standard is protected;
|
||||||
|
----
|
||||||
|
myGenerated : ListOfShape from TopTools is protected;
|
||||||
|
----
|
||||||
|
|
||||||
end Gluer;
|
end Gluer;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <TopoDS_Wire.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
#include <TopoDS_Shell.hxx>
|
#include <TopoDS_Shell.hxx>
|
||||||
#include <TopoDS_Solid.hxx>
|
#include <TopoDS_Solid.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
@ -60,6 +61,11 @@
|
|||||||
#include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
|
#include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
|
||||||
#include <GEOMAlgo_PassKey.hxx>
|
#include <GEOMAlgo_PassKey.hxx>
|
||||||
#include <GEOMAlgo_Tools.hxx>
|
#include <GEOMAlgo_Tools.hxx>
|
||||||
|
//
|
||||||
|
|
||||||
|
static
|
||||||
|
void GetSubShapes(const TopoDS_Shape& aS,
|
||||||
|
TopTools_IndexedMapOfShape& aMSS);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GEOMAlgo_Gluer
|
//function : GEOMAlgo_Gluer
|
||||||
@ -318,7 +324,7 @@ void GEOMAlgo_Gluer::MakeSolids()
|
|||||||
//
|
//
|
||||||
aNbS=aMS.Extent();
|
aNbS=aMS.Extent();
|
||||||
if (aNbS) {
|
if (aNbS) {
|
||||||
Standard_Real aTol=1.e-7;
|
//Standard_Real aTol=1.e-7;
|
||||||
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
|
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,6 +400,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
|
|||||||
{
|
{
|
||||||
myErrorStatus=0;
|
myErrorStatus=0;
|
||||||
//
|
//
|
||||||
|
Standard_Boolean bHasNewSubShape;
|
||||||
Standard_Integer i, aNbF, aNbSDF, iErr;
|
Standard_Integer i, aNbF, aNbSDF, iErr;
|
||||||
TopoDS_Shape aNewShape;
|
TopoDS_Shape aNewShape;
|
||||||
TopTools_IndexedMapOfShape aMF;
|
TopTools_IndexedMapOfShape aMF;
|
||||||
@ -442,6 +449,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Images/Origins
|
// Images/Origins
|
||||||
|
//
|
||||||
aNbF=aMPKLF.Extent();
|
aNbF=aMPKLF.Extent();
|
||||||
for (i=1; i<=aNbF; ++i) {
|
for (i=1; i<=aNbF; ++i) {
|
||||||
const TopTools_ListOfShape& aLSDF=aMPKLF(i);
|
const TopTools_ListOfShape& aLSDF=aMPKLF(i);
|
||||||
@ -451,19 +459,36 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
const TopoDS_Shape& aS1=aLSDF.First();
|
const TopoDS_Shape& aS1=aLSDF.First();
|
||||||
if (aType==TopAbs_FACE) {
|
//
|
||||||
TopoDS_Face aNewFace;
|
//modified by NIZNHY-PKV Fri Jan 21 15:34:00 2005 f
|
||||||
//
|
//
|
||||||
const TopoDS_Face& aF1=TopoDS::Face(aS1);
|
bHasNewSubShape=Standard_True;
|
||||||
MakeFace(aF1, aNewFace);
|
// prevent creation of a new shape if there are not
|
||||||
aNewShape=aNewFace;
|
// new subshapes of aSS among the originals
|
||||||
|
if (aNbSDF==1) {
|
||||||
|
bHasNewSubShape=HasNewSubShape(aS1);
|
||||||
|
if (!bHasNewSubShape) {
|
||||||
|
aNewShape=aS1;
|
||||||
|
aNewShape.Orientation(TopAbs_FORWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (aType==TopAbs_EDGE) {
|
//modified by NIZNHY-PKV Fri Jan 21 15:34:05 2005 t
|
||||||
TopoDS_Edge aNewEdge;
|
//
|
||||||
//
|
if (bHasNewSubShape) {//modified by NIZNHY-PKV Fri Jan 21 15:34:10 2005ft
|
||||||
const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
|
if (aType==TopAbs_FACE) {
|
||||||
MakeEdge(aE1, aNewEdge);
|
TopoDS_Face aNewFace;
|
||||||
aNewShape=aNewEdge;
|
//
|
||||||
|
const TopoDS_Face& aF1=TopoDS::Face(aS1);
|
||||||
|
MakeFace(aF1, aNewFace);
|
||||||
|
aNewShape=aNewFace;
|
||||||
|
}
|
||||||
|
else if (aType==TopAbs_EDGE) {
|
||||||
|
TopoDS_Edge aNewEdge;
|
||||||
|
//
|
||||||
|
const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
|
||||||
|
MakeEdge(aE1, aNewEdge);
|
||||||
|
aNewShape=aNewEdge;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
myImages.Bind(aNewShape, aLSDF);
|
myImages.Bind(aNewShape, aLSDF);
|
||||||
@ -676,7 +701,6 @@ void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
|
|||||||
void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
|
void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
|
||||||
TopoDS_Edge& aNewEdge)
|
TopoDS_Edge& aNewEdge)
|
||||||
{
|
{
|
||||||
//modified by NIZNHY-PKV Thu Dec 30 11:15:23 2004 f
|
|
||||||
myErrorStatus=0;
|
myErrorStatus=0;
|
||||||
//
|
//
|
||||||
Standard_Boolean bIsDE;
|
Standard_Boolean bIsDE;
|
||||||
@ -723,7 +747,6 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
|
|||||||
else {
|
else {
|
||||||
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||||
}
|
}
|
||||||
//modified by NIZNHY-PKV Thu Dec 30 11:15:28 2004 t
|
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -766,7 +789,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
|
|||||||
aER=TopoDS::Edge(myOrigins.Find(aE));
|
aER=TopoDS::Edge(myOrigins.Find(aE));
|
||||||
//
|
//
|
||||||
aER.Orientation(TopAbs_FORWARD);
|
aER.Orientation(TopAbs_FORWARD);
|
||||||
if (!BRep_Tool::Degenerated(aER)) {//modified by NIZNHY-PKV Thu Dec 30 11:31:37 2004 ft
|
if (!BRep_Tool::Degenerated(aER)) {
|
||||||
// build p-curve
|
// build p-curve
|
||||||
if (bIsUPeriodic) {
|
if (bIsUPeriodic) {
|
||||||
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
|
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
|
||||||
@ -808,11 +831,11 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
|
|||||||
aExp.Init(aF, TopAbs_EDGE);
|
aExp.Init(aF, TopAbs_EDGE);
|
||||||
for (; aExp.More(); aExp.Next()) {
|
for (; aExp.More(); aExp.Next()) {
|
||||||
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
|
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
|
||||||
//modified by NIZNHY-PKV Thu Dec 30 11:38:05 2004 f
|
//
|
||||||
if (BRep_Tool::Degenerated(aE)) {
|
if (BRep_Tool::Degenerated(aE)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//modified by NIZNHY-PKV Thu Dec 30 11:38:08 2004 t
|
//
|
||||||
const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
|
const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
|
||||||
//
|
//
|
||||||
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
||||||
@ -836,7 +859,111 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
|
|||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//modified by NIZNHY-PKV Fri Jan 21 10:55:42 2005 f
|
||||||
|
//=======================================================================
|
||||||
|
//function : HasNewSubShape
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const
|
||||||
|
{
|
||||||
|
Standard_Boolean bRet;
|
||||||
|
Standard_Integer i, aNbSS;
|
||||||
|
TopTools_IndexedMapOfShape aMSS;
|
||||||
|
//
|
||||||
|
GetSubShapes(aS, aMSS);
|
||||||
|
//
|
||||||
|
bRet=Standard_False;
|
||||||
|
aNbSS=aMSS.Extent();
|
||||||
|
for (i=1; i<=aNbSS; ++i) {
|
||||||
|
const TopoDS_Shape& aSS=aMSS(i);
|
||||||
|
if (aSS.ShapeType()==TopAbs_WIRE) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bRet=!myOrigins.IsBound(aSS);
|
||||||
|
if (bRet) {
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopoDS_Shape& aSSIm=myOrigins.Find(aSS);
|
||||||
|
bRet=!aSSIm.IsSame(aSS);
|
||||||
|
if (bRet) {
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetSubShapes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GetSubShapes(const TopoDS_Shape& aS,
|
||||||
|
TopTools_IndexedMapOfShape& aMSS)
|
||||||
|
{
|
||||||
|
Standard_Integer aR;
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Iterator aIt;
|
||||||
|
//
|
||||||
|
aType=aS.ShapeType();
|
||||||
|
aR=(Standard_Integer)aType+1;
|
||||||
|
if (aR>TopAbs_VERTEX) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aIt.Initialize(aS);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aSS=aIt.Value();
|
||||||
|
aMSS.Add(aSS);
|
||||||
|
GetSubShapes(aSS, aMSS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Modified
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
//
|
||||||
|
myGenerated.Clear();
|
||||||
|
//
|
||||||
|
aType=aS.ShapeType();
|
||||||
|
if (aType==TopAbs_FACE ||
|
||||||
|
aType==TopAbs_EDGE ||
|
||||||
|
aType==TopAbs_VERTEX) {
|
||||||
|
if(myOrigins.IsBound(aS)) {
|
||||||
|
const TopoDS_Shape& aSnew=myOrigins.Find(aS);
|
||||||
|
if (!aSnew.IsSame(aS)) {
|
||||||
|
myGenerated.Append(aSnew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return myGenerated;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Generated
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& )
|
||||||
|
{
|
||||||
|
myGenerated.Clear();
|
||||||
|
return myGenerated;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsDeleted
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS)
|
||||||
|
{
|
||||||
|
Standard_Boolean bRet=Standard_False;
|
||||||
|
//
|
||||||
|
const TopTools_ListOfShape& aL=Modified(aS);
|
||||||
|
bRet=!aL.IsEmpty();
|
||||||
|
//
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Fri Jan 21 10:59:21 2005 t
|
||||||
//
|
//
|
||||||
// ErrorStatus
|
// ErrorStatus
|
||||||
//
|
//
|
||||||
@ -854,37 +981,3 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
|
|||||||
//
|
//
|
||||||
// 1 - some shapes can not be glued by faces
|
// 1 - some shapes can not be glued by faces
|
||||||
//
|
//
|
||||||
/*
|
|
||||||
//=======================================================================
|
|
||||||
//function : BuildResult
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
void GEOMAlgo_Gluer::BuildResult()
|
|
||||||
{
|
|
||||||
Standard_Boolean bAdded;
|
|
||||||
TopoDS_Compound aCmp;
|
|
||||||
BRep_Builder aBB;
|
|
||||||
TopAbs_ShapeEnum aType;
|
|
||||||
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
|
|
||||||
//
|
|
||||||
aBB.MakeCompound(aCmp);
|
|
||||||
//
|
|
||||||
bAdded=Standard_False;
|
|
||||||
aItIm.Initialize(myImages);
|
|
||||||
for (; aItIm.More(); aItIm.Next()) {
|
|
||||||
const TopoDS_Shape& aIm=aItIm.Key();
|
|
||||||
aType=aIm.ShapeType();
|
|
||||||
if(aType==TopAbs_SOLID) {
|
|
||||||
bAdded=Standard_True;
|
|
||||||
aBB.Add(aCmp, aIm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myResult=aCmp;
|
|
||||||
//
|
|
||||||
if (bAdded) {
|
|
||||||
Standard_Real aTol=1.e-7;
|
|
||||||
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
|
|
||||||
//BRepLib::SameParameter(myResult, aTol, bAdded);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@ -37,16 +37,20 @@
|
|||||||
#ifndef _Standard_Integer_HeaderFile
|
#ifndef _Standard_Integer_HeaderFile
|
||||||
#include <Standard_Integer.hxx>
|
#include <Standard_Integer.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _TopTools_ListOfShape_HeaderFile
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#endif
|
||||||
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
|
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
|
||||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _TopAbs_ShapeEnum_HeaderFile
|
#ifndef _TopAbs_ShapeEnum_HeaderFile
|
||||||
#include <TopAbs_ShapeEnum.hxx>
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
class TopTools_ListOfShape;
|
||||||
|
class TopoDS_Shape;
|
||||||
class TopoDS_Edge;
|
class TopoDS_Edge;
|
||||||
class GEOMAlgo_PassKey;
|
class GEOMAlgo_PassKey;
|
||||||
class TopoDS_Face;
|
class TopoDS_Face;
|
||||||
class TopTools_ListOfShape;
|
|
||||||
class TopoDS_Vertex;
|
class TopoDS_Vertex;
|
||||||
class TopTools_DataMapOfShapeListOfShape;
|
class TopTools_DataMapOfShapeListOfShape;
|
||||||
class TopTools_DataMapOfShapeShape;
|
class TopTools_DataMapOfShapeShape;
|
||||||
@ -83,6 +87,9 @@ Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
|
|||||||
Standard_EXPORT Standard_Boolean CheckGeometry() const;
|
Standard_EXPORT Standard_Boolean CheckGeometry() const;
|
||||||
Standard_EXPORT virtual void Perform() ;
|
Standard_EXPORT virtual void Perform() ;
|
||||||
Standard_EXPORT Standard_Integer AloneShapes() const;
|
Standard_EXPORT Standard_Integer AloneShapes() const;
|
||||||
|
Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;
|
||||||
|
Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ;
|
||||||
|
Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ;
|
||||||
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
|
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
|
||||||
Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
|
Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
|
||||||
|
|
||||||
@ -109,6 +116,7 @@ Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex&
|
|||||||
Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;
|
Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;
|
||||||
Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ;
|
Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ;
|
||||||
Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;
|
Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;
|
||||||
|
Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;
|
||||||
|
|
||||||
|
|
||||||
// Fields PROTECTED
|
// Fields PROTECTED
|
||||||
@ -118,6 +126,7 @@ Standard_Real myTol;
|
|||||||
TopTools_DataMapOfShapeListOfShape myImages;
|
TopTools_DataMapOfShapeListOfShape myImages;
|
||||||
TopTools_DataMapOfShapeShape myOrigins;
|
TopTools_DataMapOfShapeShape myOrigins;
|
||||||
Standard_Integer myNbAlone;
|
Standard_Integer myNbAlone;
|
||||||
|
TopTools_ListOfShape myGenerated;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
#ifndef _TopTools_ListOfShape_HeaderFile
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
#ifndef _TopoDS_Edge_HeaderFile
|
#ifndef _TopoDS_Edge_HeaderFile
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#endif
|
#endif
|
||||||
@ -7,9 +13,6 @@
|
|||||||
#ifndef _TopoDS_Face_HeaderFile
|
#ifndef _TopoDS_Face_HeaderFile
|
||||||
#include <TopoDS_Face.hxx>
|
#include <TopoDS_Face.hxx>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _TopTools_ListOfShape_HeaderFile
|
|
||||||
#include <TopTools_ListOfShape.hxx>
|
|
||||||
#endif
|
|
||||||
#ifndef _TopoDS_Vertex_HeaderFile
|
#ifndef _TopoDS_Vertex_HeaderFile
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,13 +4,21 @@ using namespace std;
|
|||||||
#include "GEOMImpl_IGlue.hxx"
|
#include "GEOMImpl_IGlue.hxx"
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOMImpl_Types.hxx"
|
||||||
|
|
||||||
|
#include "GEOM_Object.hxx"
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
|
|
||||||
#include "GEOMAlgo_Gluer.hxx"
|
#include "GEOMAlgo_Gluer.hxx"
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
|
#include <TDataStd_IntegerArray.hxx>
|
||||||
|
|
||||||
|
#include <TopExp.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
|
||||||
#include <Standard_NullObject.hxx>
|
#include <Standard_NullObject.hxx>
|
||||||
#include <Standard_Failure.hxx>
|
#include <Standard_Failure.hxx>
|
||||||
|
|
||||||
@ -97,6 +105,51 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
|
|||||||
|
|
||||||
aRes = aGluer.Result();
|
aRes = aGluer.Result();
|
||||||
|
|
||||||
|
// Fill history to be used by GetInPlace functionality
|
||||||
|
TopTools_IndexedMapOfShape aResIndices;
|
||||||
|
TopExp::MapShapes(aRes, aResIndices);
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||||
|
|
||||||
|
// history for all argument shapes
|
||||||
|
TDF_LabelSequence aLabelSeq;
|
||||||
|
aFunction->GetDependency(aLabelSeq);
|
||||||
|
Standard_Integer nbArg = aLabelSeq.Length();
|
||||||
|
|
||||||
|
for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
|
||||||
|
|
||||||
|
TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
|
||||||
|
|
||||||
|
Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
|
||||||
|
TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape anArgumentIndices;
|
||||||
|
TopExp::MapShapes(anArgumentShape, anArgumentIndices);
|
||||||
|
Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
|
||||||
|
|
||||||
|
// Find corresponding label in history
|
||||||
|
TDF_Label anArgumentHistoryLabel =
|
||||||
|
aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
|
||||||
|
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
||||||
|
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
|
||||||
|
const TopTools_ListOfShape& aModified = aGluer.Modified(anEntity);
|
||||||
|
Standard_Integer nbModified = aModified.Extent();
|
||||||
|
|
||||||
|
if (nbModified > 0) {
|
||||||
|
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
|
||||||
|
Handle(TDataStd_IntegerArray) anAttr =
|
||||||
|
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
|
||||||
|
|
||||||
|
TopTools_ListIteratorOfListOfShape itM (aModified);
|
||||||
|
for (int im = 1; itM.More(); itM.Next(), ++im) {
|
||||||
|
int id = aResIndices.FindIndex(itM.Value());
|
||||||
|
anAttr->SetValue(im, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +197,8 @@ bool GEOMImpl_IHealingOperations::GetOperatorParameters( const string theOperati
|
|||||||
aMsg += TCollection_AsciiString( nbParamValueErrors );
|
aMsg += TCollection_AsciiString( nbParamValueErrors );
|
||||||
MESSAGE(aMsg.ToCString());
|
MESSAGE(aMsg.ToCString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -27,6 +27,7 @@ using namespace std;
|
|||||||
#include <TFunction_Driver.hxx>
|
#include <TFunction_Driver.hxx>
|
||||||
#include <TFunction_Logbook.hxx>
|
#include <TFunction_Logbook.hxx>
|
||||||
#include <TDataStd_Integer.hxx>
|
#include <TDataStd_Integer.hxx>
|
||||||
|
#include <TDataStd_IntegerArray.hxx>
|
||||||
#include <TDF_Tool.hxx>
|
#include <TDF_Tool.hxx>
|
||||||
|
|
||||||
#include <BRepExtrema_ExtCF.hxx>
|
#include <BRepExtrema_ExtCF.hxx>
|
||||||
@ -64,6 +65,8 @@ using namespace std;
|
|||||||
#include <gp_Lin.hxx>
|
#include <gp_Lin.hxx>
|
||||||
#include <TColStd_Array1OfReal.hxx>
|
#include <TColStd_Array1OfReal.hxx>
|
||||||
#include <TColStd_HArray1OfInteger.hxx>
|
#include <TColStd_HArray1OfInteger.hxx>
|
||||||
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
|
|
||||||
//#include <OSD_Timer.hxx>
|
//#include <OSD_Timer.hxx>
|
||||||
|
|
||||||
@ -1383,47 +1386,113 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace
|
|||||||
if (aWhere.IsNull() || aWhat.IsNull()) return NULL;
|
if (aWhere.IsNull() || aWhat.IsNull()) return NULL;
|
||||||
|
|
||||||
//Fill array of indices
|
//Fill array of indices
|
||||||
TopTools_IndexedMapOfShape anIndices;
|
Handle(TColStd_HArray1OfInteger) aModifiedArray;
|
||||||
TopExp::MapShapes(aWhere, anIndices);
|
|
||||||
|
|
||||||
// Handle(TColStd_HArray1OfInteger) anArray =
|
Handle(GEOM_Function) aWhereFunction = theShapeWhere->GetLastFunction();
|
||||||
// new TColStd_HArray1OfInteger (1, listSS.Extent());
|
|
||||||
// TopTools_ListIteratorOfListOfShape itSub (listSS);
|
|
||||||
// for (int index = 1; itSub.More(); itSub.Next(), ++index) {
|
|
||||||
// int id = anIndices.FindIndex(itSub.Value());
|
|
||||||
// anArray->SetValue(index, id);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //Add a new group object
|
|
||||||
// Handle(GEOM_Object) aGroup = GetEngine()->AddSubShape(theShape, anArray);
|
|
||||||
//
|
|
||||||
// //Set a GROUP type
|
|
||||||
// aGroup->SetType(GEOM_GROUP);
|
|
||||||
//
|
|
||||||
// //Set a sub shape type
|
|
||||||
// TDF_Label aFreeLabel = aGroup->GetFreeLabel();
|
|
||||||
// TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)theShapeType);
|
|
||||||
//
|
|
||||||
// //Make a Python command
|
|
||||||
// TCollection_AsciiString anEntry, aDescr;
|
|
||||||
// TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
|
|
||||||
// aDescr += anEntry;
|
|
||||||
// aDescr += " = IShapesOperations.GetInPlace(";
|
|
||||||
// TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry);
|
|
||||||
// aDescr += anEntry + ",";
|
|
||||||
// TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry);
|
|
||||||
// aDescr += anEntry + ")";
|
|
||||||
//
|
|
||||||
// Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
|
|
||||||
// aFunction->SetDescription(aDescr);
|
|
||||||
|
|
||||||
// SetErrorCode(OK);
|
TopTools_IndexedMapOfShape aWhereIndices;
|
||||||
// return aGroup;
|
TopExp::MapShapes(aWhere, aWhereIndices);
|
||||||
SetErrorCode("Not yet implemented");
|
|
||||||
return NULL;
|
if (aWhereIndices.Contains(aWhat)) {
|
||||||
|
|
||||||
|
// entity was not changed by the operation
|
||||||
|
Standard_Integer aWhatIndex = aWhereIndices.FindIndex(aWhat);
|
||||||
|
aModifiedArray = new TColStd_HArray1OfInteger(1,1);
|
||||||
|
aModifiedArray->SetValue(1, aWhatIndex);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
TDF_Label aHistoryLabel = aWhereFunction->GetHistoryEntry(Standard_False);
|
||||||
|
if (aHistoryLabel.IsNull()) {
|
||||||
|
SetErrorCode("History for an operation, produced the shape, does not exist.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// search in history for all argument shapes
|
||||||
|
Standard_Boolean isFound = Standard_False;
|
||||||
|
|
||||||
|
TDF_LabelSequence aLabelSeq;
|
||||||
|
aWhereFunction->GetDependency(aLabelSeq);
|
||||||
|
Standard_Integer nbArg = aLabelSeq.Length();
|
||||||
|
|
||||||
|
for (Standard_Integer iarg = 1; iarg <= nbArg && !isFound; iarg++) {
|
||||||
|
|
||||||
|
TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
|
||||||
|
|
||||||
|
Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
|
||||||
|
TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape anArgumentIndices;
|
||||||
|
TopExp::MapShapes(anArgumentShape, anArgumentIndices);
|
||||||
|
|
||||||
|
if (anArgumentIndices.Contains(aWhat)) {
|
||||||
|
isFound = Standard_True;
|
||||||
|
Standard_Integer aWhatIndex = anArgumentIndices.FindIndex(aWhat);
|
||||||
|
|
||||||
|
// Find corresponding label in history
|
||||||
|
TDF_Label anArgumentHistoryLabel =
|
||||||
|
aWhereFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_False);
|
||||||
|
if (anArgumentHistoryLabel.IsNull()) {
|
||||||
|
SetErrorCode("History for this entity does not exist.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(aWhatIndex, Standard_False);
|
||||||
|
if (aWhatHistoryLabel.IsNull()) {
|
||||||
|
SetErrorCode("History for this entity does not exist.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(TDataStd_IntegerArray) anIntegerArray;
|
||||||
|
if (!aWhatHistoryLabel.FindAttribute(TDataStd_IntegerArray::GetID(), anIntegerArray)) {
|
||||||
|
SetErrorCode("Empty history. Possibly, this entity is absent in result.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
aModifiedArray = anIntegerArray->Array();
|
||||||
|
if (aModifiedArray->Length() == 0) {
|
||||||
|
SetErrorCode("This entity is absent in result.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isFound) {
|
||||||
|
SetErrorCode("Not found in arguments.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add a new object
|
||||||
|
Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray);
|
||||||
|
|
||||||
|
if (aModifiedArray->Length() > 1) {
|
||||||
|
//Set a GROUP type
|
||||||
|
aResult->SetType(GEOM_GROUP);
|
||||||
|
|
||||||
|
//Set a sub shape type
|
||||||
|
TDF_Label aFreeLabel = aResult->GetFreeLabel();
|
||||||
|
TopAbs_ShapeEnum aShapeType = aWhat.ShapeType();
|
||||||
|
TDataStd_Integer::Set(aFreeLabel, (Standard_Integer)aShapeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
TCollection_AsciiString anEntry, aDescr;
|
||||||
|
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
|
||||||
|
aDescr += anEntry;
|
||||||
|
aDescr += " = IShapesOperations.GetInPlace(";
|
||||||
|
TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry);
|
||||||
|
aDescr += anEntry + ",";
|
||||||
|
TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry);
|
||||||
|
aDescr += anEntry + ")";
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aFunction = aResult->GetFunction(1);
|
||||||
|
aFunction->SetDescription(aDescr);
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return aResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SortShapes
|
//function : SortShapes
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -6,14 +6,12 @@
|
|||||||
#define TRANSLATE_ARG_POINT1 1
|
#define TRANSLATE_ARG_POINT1 1
|
||||||
#define TRANSLATE_ARG_POINT2 2
|
#define TRANSLATE_ARG_POINT2 2
|
||||||
#define TRANSLATE_ARG_VECTOR 3
|
#define TRANSLATE_ARG_VECTOR 3
|
||||||
#define TRANSLATE_ARG_REF 4
|
|
||||||
#define TRANSLATE_ARG_SHAPE 5
|
|
||||||
#define TRANSLATE_ARG_ORIGINAL 6
|
#define TRANSLATE_ARG_ORIGINAL 6
|
||||||
#define TRANSLATE_ARG_STEP1 7
|
#define TRANSLATE_ARG_STEP1 7
|
||||||
#define TRANSLATE_ARG_NBITER1 8
|
#define TRANSLATE_ARG_NBITER1 8
|
||||||
#define TRANSLATE_ARG_STEP2 9
|
#define TRANSLATE_ARG_STEP2 9
|
||||||
#define TRANSLATE_ARG_NBITER2 10
|
#define TRANSLATE_ARG_NBITER2 10
|
||||||
#define TRANSLATE_ARG_VECTOR2 11
|
#define TRANSLATE_ARG_VECTOR2 11
|
||||||
#define TRANSLATE_ARG_DX 12
|
#define TRANSLATE_ARG_DX 12
|
||||||
#define TRANSLATE_ARG_DY 13
|
#define TRANSLATE_ARG_DY 13
|
||||||
#define TRANSLATE_ARG_DZ 14
|
#define TRANSLATE_ARG_DZ 14
|
||||||
@ -36,10 +34,6 @@ class GEOMImpl_ITranslate
|
|||||||
|
|
||||||
Handle(GEOM_Function) GetVector() { return _func->GetReference(TRANSLATE_ARG_VECTOR); }
|
Handle(GEOM_Function) GetVector() { return _func->GetReference(TRANSLATE_ARG_VECTOR); }
|
||||||
|
|
||||||
void SetShape(const TopoDS_Shape& theShape) { _func->SetShape(TRANSLATE_ARG_SHAPE, theShape); }
|
|
||||||
|
|
||||||
TopoDS_Shape GetShape() { return _func->GetShape(TRANSLATE_ARG_SHAPE); }
|
|
||||||
|
|
||||||
void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(TRANSLATE_ARG_ORIGINAL, theOriginal); }
|
void SetOriginal(Handle(GEOM_Function) theOriginal) { _func->SetReference(TRANSLATE_ARG_ORIGINAL, theOriginal); }
|
||||||
|
|
||||||
Handle(GEOM_Function) GetOriginal() { return _func->GetReference(TRANSLATE_ARG_ORIGINAL); }
|
Handle(GEOM_Function) GetOriginal() { return _func->GetReference(TRANSLATE_ARG_ORIGINAL); }
|
||||||
|
@ -3,11 +3,17 @@ using namespace std;
|
|||||||
#include "GEOMImpl_PartitionDriver.hxx"
|
#include "GEOMImpl_PartitionDriver.hxx"
|
||||||
#include "GEOMImpl_IPartition.hxx"
|
#include "GEOMImpl_IPartition.hxx"
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOMImpl_Types.hxx"
|
||||||
|
|
||||||
|
#include "GEOM_Object.hxx"
|
||||||
#include "GEOM_Function.hxx"
|
#include "GEOM_Function.hxx"
|
||||||
|
|
||||||
#include <NMTAlgo_Splitter1.hxx>
|
#include <NMTAlgo_Splitter1.hxx>
|
||||||
|
|
||||||
|
#include <TDataStd_IntegerArray.hxx>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAlgo.hxx>
|
#include <BRepAlgo.hxx>
|
||||||
|
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
@ -15,7 +21,10 @@ using namespace std;
|
|||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
|
||||||
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
#include <Standard_NullObject.hxx>
|
#include <Standard_NullObject.hxx>
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
@ -52,6 +61,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_Integer aType = aFunction->GetType();
|
Standard_Integer aType = aFunction->GetType();
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
NMTAlgo_Splitter1 PS;
|
||||||
|
|
||||||
if (aType == PARTITION_PARTITION) {
|
if (aType == PARTITION_PARTITION) {
|
||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
@ -65,7 +75,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
nbshapes += aShapes->Length() + aTools->Length();
|
nbshapes += aShapes->Length() + aTools->Length();
|
||||||
nbshapes += aKeepIns->Length() + aRemIns->Length();
|
nbshapes += aKeepIns->Length() + aRemIns->Length();
|
||||||
|
|
||||||
NMTAlgo_Splitter1 PS;
|
|
||||||
TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes);
|
TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes);
|
||||||
|
|
||||||
// add object shapes that are in ListShapes;
|
// add object shapes that are in ListShapes;
|
||||||
@ -135,11 +144,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
PS.RemoveShapesInside(aShape_i);
|
PS.RemoveShapesInside(aShape_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
aShape = PS.Shape();
|
|
||||||
|
|
||||||
if (!BRepAlgo::IsValid(aShape)) {
|
|
||||||
Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
|
|
||||||
}
|
|
||||||
} else if (aType == PARTITION_HALF) {
|
} else if (aType == PARTITION_HALF) {
|
||||||
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
Handle(GEOM_Function) aRefShape = aCI.GetShape();
|
||||||
Handle(GEOM_Function) aRefPlane = aCI.GetPlane();
|
Handle(GEOM_Function) aRefPlane = aCI.GetPlane();
|
||||||
@ -150,8 +154,6 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
|
Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
NMTAlgo_Splitter1 PS;
|
|
||||||
|
|
||||||
// add object shapes that are in ListShapes;
|
// add object shapes that are in ListShapes;
|
||||||
PS.AddShape(aShapeArg);
|
PS.AddShape(aShapeArg);
|
||||||
|
|
||||||
@ -162,19 +164,61 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
PS.SetRemoveWebs(Standard_False);
|
PS.SetRemoveWebs(Standard_False);
|
||||||
PS.Build(aShapeArg.ShapeType());
|
PS.Build(aShapeArg.ShapeType());
|
||||||
|
|
||||||
aShape = PS.Shape();
|
} else {
|
||||||
|
|
||||||
if (!BRepAlgo::IsValid(aShape)) {
|
|
||||||
Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aShape = PS.Shape();
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
|
||||||
|
if (!BRepAlgo::IsValid(aShape)) {
|
||||||
|
Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
|
||||||
|
}
|
||||||
|
|
||||||
aFunction->SetValue(aShape);
|
aFunction->SetValue(aShape);
|
||||||
|
|
||||||
|
// Fill history to be used by GetInPlace functionality
|
||||||
|
TopTools_IndexedMapOfShape aResIndices;
|
||||||
|
TopExp::MapShapes(aShape, aResIndices);
|
||||||
|
|
||||||
|
// history for all argument shapes
|
||||||
|
TDF_LabelSequence aLabelSeq;
|
||||||
|
aFunction->GetDependency(aLabelSeq);
|
||||||
|
Standard_Integer nbArg = aLabelSeq.Length();
|
||||||
|
|
||||||
|
for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
|
||||||
|
|
||||||
|
TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
|
||||||
|
|
||||||
|
Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
|
||||||
|
TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape anArgumentIndices;
|
||||||
|
TopExp::MapShapes(anArgumentShape, anArgumentIndices);
|
||||||
|
Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
|
||||||
|
|
||||||
|
// Find corresponding label in history
|
||||||
|
TDF_Label anArgumentHistoryLabel =
|
||||||
|
aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
|
||||||
|
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
||||||
|
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
|
||||||
|
const TopTools_ListOfShape& aModified = PS.Modified(anEntity);
|
||||||
|
Standard_Integer nbModified = aModified.Extent();
|
||||||
|
|
||||||
|
if (nbModified > 0) {
|
||||||
|
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
|
||||||
|
Handle(TDataStd_IntegerArray) anAttr =
|
||||||
|
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
|
||||||
|
|
||||||
|
TopTools_ListIteratorOfListOfShape itM (aModified);
|
||||||
|
for (int im = 1; itM.More(); itM.Next(), ++im) {
|
||||||
|
int id = aResIndices.FindIndex(itM.Value());
|
||||||
|
anAttr->SetValue(im, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.SetTouched(Label());
|
log.SetTouched(Label());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -353,3 +353,23 @@ def TestOtherOperations (geompy, math):
|
|||||||
geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
|
geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
|
||||||
|
|
||||||
# GetInPlace(theShapeWhere, theShapeWhat)
|
# GetInPlace(theShapeWhere, theShapeWhat)
|
||||||
|
box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
|
||||||
|
box6 = geompy.MakeTranslation(box5, 50, 50, 0)
|
||||||
|
|
||||||
|
part = geompy.MakePartition([box5], [box6])
|
||||||
|
geompy.addToStudy(part, "Partitioned")
|
||||||
|
|
||||||
|
ibb = 5
|
||||||
|
box_list = [box5, box6]
|
||||||
|
for abox in box_list:
|
||||||
|
geompy.addToStudy(abox, "Box " + `ibb`)
|
||||||
|
box_faces = geompy.SubShapeAll(abox, geompy.ShapeType["FACE"])
|
||||||
|
ifa = 1
|
||||||
|
for aface in box_faces:
|
||||||
|
geompy.addToStudyInFather(abox, aface, "Face" + `ifa`)
|
||||||
|
refl_box_face = geompy.GetInPlace(part, aface)
|
||||||
|
if refl_box_face is not None:
|
||||||
|
geompy.addToStudyInFather(part, refl_box_face,
|
||||||
|
"Reflection of Face " + `ifa` + " of box " + `ibb`)
|
||||||
|
ifa = ifa + 1
|
||||||
|
ibb = ibb + 1
|
||||||
|
@ -2009,7 +2009,7 @@ def MakeHexa2Faces(F1, F2):
|
|||||||
print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
|
print "MakeHexa2Faces : ", BlocksOp.GetErrorCode()
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
def MakeHexa2Faces(F1, F2):
|
def GetPoint(theShape, theX, theY, theZ, theEpsilon):
|
||||||
"""
|
"""
|
||||||
* Get a vertex, found in the given shape by its coordinates.
|
* Get a vertex, found in the given shape by its coordinates.
|
||||||
* \param theShape Block or a compound of blocks.
|
* \param theShape Block or a compound of blocks.
|
||||||
|
@ -511,6 +511,18 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//modified by NIZNHY-PKV Fri Jan 21 17:01:10 2005 f
|
||||||
|
if (aNbSp==1) {
|
||||||
|
const BOPTools_PaveBlock& aPB1=aLPB.First();
|
||||||
|
const BOPTools_PaveBlock& aPBR1=pPF->RealPaveBlock(aPB1);
|
||||||
|
nSp=aPBR1.Edge();
|
||||||
|
const TopoDS_Shape& aSp1=aDS.Shape(nSp);
|
||||||
|
if (aSp1.IsSame(aE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Fri Jan 21 17:01:14 2005 t
|
||||||
|
//
|
||||||
aLSp.Clear();
|
aLSp.Clear();
|
||||||
aIt.Initialize(aLPB);
|
aIt.Initialize(aLPB);
|
||||||
for (; aIt.More(); aIt.Next()) {
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
@ -19,7 +19,8 @@ uses
|
|||||||
Shape from TopoDS,
|
Shape from TopoDS,
|
||||||
MapOfOrientedShape from TopTools,
|
MapOfOrientedShape from TopTools,
|
||||||
IndexedMapOfShape from TopTools,
|
IndexedMapOfShape from TopTools,
|
||||||
DataMapOfShapeShape from TopTools,
|
DataMapOfShapeShape from TopTools,
|
||||||
|
DataMapOfShapeListOfShape from TopTools,
|
||||||
ListOfShape from TopTools,
|
ListOfShape from TopTools,
|
||||||
MapOfShape from TopTools,
|
MapOfShape from TopTools,
|
||||||
AsDes from BRepAlgo,
|
AsDes from BRepAlgo,
|
||||||
@ -166,5 +167,8 @@ fields
|
|||||||
myMapSIFC : DataMapOfShapeShape from TopTools is protected;
|
myMapSIFC : DataMapOfShapeShape from TopTools is protected;
|
||||||
----vv
|
----vv
|
||||||
myGenerated : ListOfShape from TopTools is protected;
|
myGenerated : ListOfShape from TopTools is protected;
|
||||||
|
--modified by NIZNHY-PKV Mon Jan 24 09:45:10 2005f
|
||||||
|
myModifiedFaces: DataMapOfShapeListOfShape from TopTools is protected;
|
||||||
|
--modified by NIZNHY-PKV Mon Jan 24 09:45:14 2005t
|
||||||
----^^
|
----^^
|
||||||
end Splitter;
|
end Splitter;
|
||||||
|
@ -114,6 +114,9 @@ static
|
|||||||
myObjShapes.Clear();
|
myObjShapes.Clear();
|
||||||
myToolShapes.Clear();
|
myToolShapes.Clear();
|
||||||
myMapSIFC.Clear();
|
myMapSIFC.Clear();
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:47:37 2005f
|
||||||
|
myModifiedFaces.Clear();
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:47:41 2005t
|
||||||
myErrorStatus=0;
|
myErrorStatus=0;
|
||||||
}
|
}
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -472,10 +475,13 @@ static
|
|||||||
TopTools_ListIteratorOfListOfShape aItS, aItFI;
|
TopTools_ListIteratorOfListOfShape aItS, aItFI;
|
||||||
TopExp_Explorer aExp;
|
TopExp_Explorer aExp;
|
||||||
TopAbs_Orientation aOriFS;
|
TopAbs_Orientation aOriFS;
|
||||||
TopoDS_Face aFIx;
|
TopoDS_Face aFIx, aFIy;
|
||||||
BRep_Builder aBB;
|
BRep_Builder aBB;
|
||||||
//
|
//
|
||||||
myImageShape.Clear();
|
myImageShape.Clear();
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:48:15 2005f
|
||||||
|
myModifiedFaces.Clear();
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:48:18 2005t
|
||||||
//
|
//
|
||||||
aItS.Initialize(myListShapes);
|
aItS.Initialize(myListShapes);
|
||||||
for ( ;aItS.More(); aItS.Next()) {
|
for ( ;aItS.More(); aItS.Next()) {
|
||||||
@ -490,6 +496,14 @@ static
|
|||||||
//
|
//
|
||||||
if (!myImagesFaces.HasImage(aFS)) {
|
if (!myImagesFaces.HasImage(aFS)) {
|
||||||
myQueryShapes.Add(aFS);
|
myQueryShapes.Add(aFS);
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:50:42 2005 f
|
||||||
|
if (!myModifiedFaces.IsBound(aFS)) {
|
||||||
|
TopTools_ListOfShape aLS;
|
||||||
|
//
|
||||||
|
aLS.Append(aFS);
|
||||||
|
myModifiedFaces.Bind(aFS, aLS);
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:50:44 2005 t
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -510,10 +524,28 @@ static
|
|||||||
aFSDIx.Reverse();
|
aFSDIx.Reverse();
|
||||||
}
|
}
|
||||||
myQueryShapes.Add(aFSDIx);
|
myQueryShapes.Add(aFSDIx);
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f
|
||||||
|
aFIy=aFSDIx;
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myQueryShapes.Add(aFIx);
|
myQueryShapes.Add(aFIx);
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:56:06 2005f
|
||||||
|
aFIy=aFIx;
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:56:09 2005t
|
||||||
}
|
}
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:53:38 2005f
|
||||||
|
if (!myModifiedFaces.IsBound(aFS)) {
|
||||||
|
TopTools_ListOfShape aLS;
|
||||||
|
//
|
||||||
|
aLS.Append(aFIy);
|
||||||
|
myModifiedFaces.Bind(aFS, aLS);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_ListOfShape& aLS=myModifiedFaces.ChangeFind(aFS);
|
||||||
|
aLS.Append(aFIy);
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 09:53:43 2005t
|
||||||
}
|
}
|
||||||
}//for (; aExp.More(); aExp.Next()) {
|
}//for (; aExp.More(); aExp.Next()) {
|
||||||
//
|
//
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
// File generated by CPPExt (Value)
|
// File generated by CPPExt (Value)
|
||||||
// Copyright (C) 1991,1995 by
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
//
|
//
|
||||||
// MATRA DATAVISION, FRANCE
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
//
|
//
|
||||||
// This software is furnished in accordance with the terms and conditions
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
// of the contract and with the inclusion of the above copyright notice.
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
// This software or any other copy thereof may not be provided or otherwise
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
// be made available to any other person. No title to an ownership of the
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
// software is hereby transferred.
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
//
|
// License.
|
||||||
// At the termination of the contract, the software and all copies of this
|
|
||||||
// software must be deleted.
|
|
||||||
|
|
||||||
#ifndef _NMTAlgo_Splitter_HeaderFile
|
#ifndef _NMTAlgo_Splitter_HeaderFile
|
||||||
#define _NMTAlgo_Splitter_HeaderFile
|
#define _NMTAlgo_Splitter_HeaderFile
|
||||||
@ -36,6 +43,9 @@
|
|||||||
#ifndef _TopTools_MapOfOrientedShape_HeaderFile
|
#ifndef _TopTools_MapOfOrientedShape_HeaderFile
|
||||||
#include <TopTools_MapOfOrientedShape.hxx>
|
#include <TopTools_MapOfOrientedShape.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
|
||||||
|
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||||
|
#endif
|
||||||
#ifndef _NMTAlgo_Builder_HeaderFile
|
#ifndef _NMTAlgo_Builder_HeaderFile
|
||||||
#include <NMTAlgo_Builder.hxx>
|
#include <NMTAlgo_Builder.hxx>
|
||||||
#endif
|
#endif
|
||||||
@ -130,6 +140,7 @@ TopTools_MapOfShape myToolShapes;
|
|||||||
TopTools_MapOfShape myObjShapes;
|
TopTools_MapOfShape myObjShapes;
|
||||||
TopTools_DataMapOfShapeShape myMapSIFC;
|
TopTools_DataMapOfShapeShape myMapSIFC;
|
||||||
TopTools_ListOfShape myGenerated;
|
TopTools_ListOfShape myGenerated;
|
||||||
|
TopTools_DataMapOfShapeListOfShape myModifiedFaces;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -104,48 +104,45 @@
|
|||||||
//function : RemoveShapesInside
|
//function : RemoveShapesInside
|
||||||
//purpose : remove shapes that are inside S from result
|
//purpose : remove shapes that are inside S from result
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void NMTAlgo_Splitter::RemoveShapesInside (const TopoDS_Shape& aS)
|
void NMTAlgo_Splitter::RemoveShapesInside (const TopoDS_Shape& S)
|
||||||
{
|
{
|
||||||
TopoDS_Iterator it;
|
TopoDS_Iterator it;
|
||||||
TopAbs_ShapeEnum aTypeS;
|
if (S.ShapeType() < TopAbs_SOLID) { // compound or compsolid
|
||||||
//
|
it.Initialize( S );
|
||||||
aTypeS=aS.ShapeType();
|
|
||||||
if (aTypeS < TopAbs_SOLID) { // compound or compsolid
|
|
||||||
it.Initialize(aS);
|
|
||||||
for (; it.More(); it.Next()) {
|
for (; it.More(); it.Next()) {
|
||||||
const TopoDS_Shape& aSx=it.Value();
|
RemoveShapesInside( it.Value());
|
||||||
RemoveShapesInside(aSx);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
Standard_Boolean bFromTool, bIsClosed;
|
Standard_Boolean isTool;
|
||||||
Standard_Integer i, aNbE;
|
TopoDS_Shape IntFacesComp;
|
||||||
TopoDS_Shape aIntFacesComp;
|
TopoDS_Compound C;
|
||||||
TopoDS_Compound aC;
|
|
||||||
TopTools_IndexedMapOfShape MIF; // map of internal faces
|
TopTools_IndexedMapOfShape MIF; // map of internal faces
|
||||||
TopTools_MapOfShape RFM;
|
TopTools_MapOfShape RFM;
|
||||||
TopTools_MapIteratorOfMapOfShape itF;
|
TopTools_MapIteratorOfMapOfShape itF;
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
|
|
||||||
//
|
//
|
||||||
bFromTool=myToolShapes.Contains(aS);
|
//modified by NIZNHY-PKV Wed Dec 22 18:56:27 2004 f
|
||||||
|
isTool=myToolShapes.Contains(S);
|
||||||
|
//modified by NIZNHY-PKV Wed Dec 22 18:56:31 2004 t
|
||||||
//
|
//
|
||||||
if (!myImageShape.HasImage(aS)) {
|
//isTool = Standard_False;
|
||||||
return;
|
if (!myImageShape.HasImage( S )) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
aIntFacesComp = FindFacesInside(aS, Standard_False, Standard_True);
|
IntFacesComp = FindFacesInside( S, Standard_False, Standard_True);
|
||||||
//
|
//
|
||||||
TopExp::MapShapes(aIntFacesComp, TopAbs_FACE, MIF);
|
TopExp::MapShapes( IntFacesComp, TopAbs_FACE, MIF);
|
||||||
if (MIF.IsEmpty()) {
|
if (MIF.IsEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// add to MIF split faces of S
|
// add to MIF split faces of S
|
||||||
const TopoDS_Shape& aSIm=myImageShape.Image(aS).First();
|
const TopoDS_Shape& aSIm=myImageShape.Image(S).First();
|
||||||
TopExp::MapShapes(aSIm, TopAbs_FACE, MIF);
|
TopExp::MapShapes(aSIm, TopAbs_FACE, MIF);
|
||||||
//
|
//
|
||||||
// leave in the result only those shapes not having all face in MIF
|
// leave in the result only those shapes not having all face in MIF
|
||||||
myBuilder.MakeCompound(aC);
|
myBuilder.MakeCompound(C);
|
||||||
//
|
//
|
||||||
// RFM : faces of removed shapes that encounter once
|
// RFM : faces of removed shapes that encounter once
|
||||||
it.Initialize(myShape);
|
it.Initialize(myShape);
|
||||||
@ -164,90 +161,99 @@
|
|||||||
//
|
//
|
||||||
if (expResF.More()) {
|
if (expResF.More()) {
|
||||||
// add shape to result
|
// add shape to result
|
||||||
myBuilder.Add(aC, aSR);
|
myBuilder.Add(C, aSR);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// add faces of a removed shape to RFM
|
// add faces of a removed shape to RFM
|
||||||
if (!bFromTool) { //modified by NIZNHY-PKV Thu Dec 23 09:55:39 2004 ft
|
for (expResF.ReInit(); expResF.More(); expResF.Next()) {
|
||||||
for (expResF.ReInit(); expResF.More(); expResF.Next()) {
|
const TopoDS_Shape& aF = expResF.Current();
|
||||||
const TopoDS_Shape& aF = expResF.Current();
|
if (!RFM.Remove(aF)) {
|
||||||
if (!RFM.Remove(aF)) {
|
RFM.Add(aF);
|
||||||
RFM.Add(aF);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}//modified by NIZNHY-PKV Thu Dec 23 09:55:29 2004 ft
|
}
|
||||||
}
|
}
|
||||||
}// for (; it.More(); it.Next())
|
}// for (; it.More(); it.Next())
|
||||||
//
|
//
|
||||||
if (bFromTool) {
|
//modified by NIZNHY-PKV Wed Dec 22 18:59:46 2004 f
|
||||||
myShape=aC;
|
TopoDS_Compound aCx;
|
||||||
return;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// bIsClosed
|
myBuilder.MakeCompound(aCx);
|
||||||
bIsClosed = Standard_False;
|
itF.Initialize (RFM);
|
||||||
if (aTypeS==TopAbs_SOLID) {
|
for (; itF.More(); itF.Next()) {
|
||||||
bIsClosed = Standard_True;
|
const TopoDS_Shape& aF=itF.Key();
|
||||||
|
myBuilder.Add(aCx, aF);
|
||||||
}
|
}
|
||||||
else if (aTypeS==TopAbs_SHELL) {
|
//modified by NIZNHY-PKV Wed Dec 22 18:59:48 2004 t
|
||||||
aMEF.Clear();
|
//
|
||||||
TopExp::MapShapesAndAncestors(aS, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
if (!isTool) {
|
||||||
aNbE=aMEF.Extent();
|
// rebuild S, it must remain in the result
|
||||||
for (i=1; bIsClosed && i<=aNbE; ++i) {
|
Standard_Boolean isClosed = Standard_False;
|
||||||
bIsClosed=(aMEF(i).Extent()!=1);
|
switch (S.ShapeType()) {
|
||||||
|
case TopAbs_SOLID :
|
||||||
|
isClosed = Standard_True; break;
|
||||||
|
case TopAbs_SHELL: {
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape MEF;
|
||||||
|
TopExp::MapShapesAndAncestors(S, TopAbs_EDGE, TopAbs_FACE, MEF);
|
||||||
|
Standard_Integer i;
|
||||||
|
for (i=1; isClosed && i<=MEF.Extent(); ++i) {
|
||||||
|
isClosed = ( MEF(i).Extent() != 1 );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
isClosed = Standard_False;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
|
||||||
// rebuild S, it must remain in the result
|
|
||||||
if (bIsClosed) {
|
|
||||||
// add to a new shape external faces of removed shapes, ie those in RFM
|
|
||||||
TopoDS_Shell aShell;
|
|
||||||
//
|
//
|
||||||
myBuilder.MakeShell(aShell);
|
if (isClosed) {
|
||||||
// exclude redundant internal face with edges encounterd only once
|
// add to a new shape external faces of removed shapes, ie those in RFM
|
||||||
aMEF.Clear();
|
TopoDS_Shell Shell;
|
||||||
itF.Initialize (RFM);
|
myBuilder.MakeShell(Shell);
|
||||||
for (; itF.More(); itF.Next()) {
|
// exclude redundant internal face with edges encounterd only once
|
||||||
const TopoDS_Shape& aF=itF.Key();
|
TopTools_IndexedDataMapOfShapeListOfShape MEF;
|
||||||
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF);
|
//
|
||||||
}
|
itF.Initialize (RFM);
|
||||||
// add only faces forming a closed shell
|
for ( ; itF.More(); itF.Next()) {
|
||||||
for (itF.Reset() ; itF.More(); itF.Next()) {
|
const TopoDS_Shape& aF=itF.Key();
|
||||||
const TopoDS_Shape& aF=itF.Key();
|
TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, MEF);
|
||||||
TopExp_Explorer expE (aF, TopAbs_EDGE);
|
}
|
||||||
for (; expE.More(); expE.Next()) {
|
// add only faces forming a closed shell
|
||||||
if (aMEF.FindFromKey(expE.Current()).Extent()==1) {
|
for (itF.Reset() ; itF.More(); itF.Next()) {
|
||||||
break;
|
const TopoDS_Shape& aF=itF.Key();
|
||||||
|
TopExp_Explorer expE (aF, TopAbs_EDGE);
|
||||||
|
for (; expE.More(); expE.Next()) {
|
||||||
|
if (MEF.FindFromKey(expE.Current()).Extent() == 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!expE.More()) {
|
||||||
|
myBuilder.Add( Shell, aF);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//int a=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!expE.More()) {
|
|
||||||
myBuilder.Add(aShell, aF);
|
if (S.ShapeType() == TopAbs_SOLID) {
|
||||||
|
TopoDS_Solid Solid;
|
||||||
|
myBuilder.MakeSolid( Solid );
|
||||||
|
myBuilder.Add (Solid, Shell);
|
||||||
|
myBuilder.Add (C, Solid);
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
//
|
myBuilder.Add (C, Shell);
|
||||||
if (aTypeS==TopAbs_SOLID) {
|
}
|
||||||
TopoDS_Solid aSolid;
|
} // if (isClosed) {
|
||||||
//
|
|
||||||
myBuilder.MakeSolid(aSolid);
|
|
||||||
myBuilder.Add (aSolid, aShell);
|
|
||||||
myBuilder.Add (aC, aSolid);
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
myBuilder.Add (aC, aShell);
|
it.Initialize(aSIm);
|
||||||
}
|
for (; it.More(); it.Next()) {
|
||||||
} // if (bIsClosed) {
|
myBuilder.Add (C, it.Value());
|
||||||
//
|
}
|
||||||
else {
|
|
||||||
it.Initialize(aSIm);
|
|
||||||
for (; it.More(); it.Next()) {
|
|
||||||
const TopoDS_Shape& aSx=it.Value();
|
|
||||||
myBuilder.Add (aC, aSx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
myShape=aC;
|
myShape = C;
|
||||||
}
|
}
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 10:19:30 2005 f
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Modified
|
//function : Modified
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -255,81 +261,104 @@
|
|||||||
const TopTools_ListOfShape& NMTAlgo_Splitter::Modified (const TopoDS_Shape& S)
|
const TopTools_ListOfShape& NMTAlgo_Splitter::Modified (const TopoDS_Shape& S)
|
||||||
|
|
||||||
{
|
{
|
||||||
myGenerated.Clear();
|
TopAbs_ShapeEnum aType;
|
||||||
TopTools_ListIteratorOfListOfShape it;
|
TopTools_ListIteratorOfListOfShape it;
|
||||||
TopTools_MapOfShape aMap;
|
TopTools_MapOfShape aMap;
|
||||||
TopExp_Explorer anExp;
|
TopExp_Explorer anExp;
|
||||||
|
//
|
||||||
if(S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_EDGE) {
|
myGenerated.Clear();
|
||||||
|
aType=S.ShapeType();
|
||||||
if(S.ShapeType() == TopAbs_FACE) {
|
//
|
||||||
if (myImagesFaces.HasImage( S )) {
|
switch (aType) {
|
||||||
it.Initialize(myImagesFaces.Image(S));
|
case TopAbs_FACE: {
|
||||||
anExp.Init(myShape, TopAbs_FACE);
|
if (myModifiedFaces.IsBound(S)) {
|
||||||
|
anExp.Init(myShape, aType);
|
||||||
|
for(; anExp.More(); anExp.Next()) {
|
||||||
|
aMap.Add(anExp.Current());
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopTools_ListOfShape& aLS=myModifiedFaces.Find(S);
|
||||||
|
it.Initialize(aLS);
|
||||||
|
for (; it.More(); it.Next()) {
|
||||||
|
const TopoDS_Shape& aFx=it.Value();
|
||||||
|
if (!aFx.IsSame(S)) {
|
||||||
|
if (aMap.Contains(aFx)) {
|
||||||
|
myGenerated.Append(aFx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
break;
|
||||||
if (myImagesEdges.HasImage( S )) {
|
//
|
||||||
it.Initialize(myImagesEdges.Image(S));
|
case TopAbs_EDGE: {
|
||||||
anExp.Init(myShape, TopAbs_EDGE);
|
if (myImagesEdges.HasImage(S)) {
|
||||||
|
anExp.Init(myShape, aType);
|
||||||
|
for(; anExp.More(); anExp.Next()) {
|
||||||
|
aMap.Add(anExp.Current());
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopTools_ListOfShape& aLE=myImagesEdges.Image(S);
|
||||||
|
it.Initialize(aLE);
|
||||||
|
for (; it.More(); it.Next()) {
|
||||||
|
const TopoDS_Shape& aEx=it.Value();
|
||||||
|
if (!aEx.IsSame(S)) {
|
||||||
|
if(aMap.Contains(aEx)) {
|
||||||
|
myGenerated.Append(aEx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
for(; anExp.More(); anExp.Next()) {
|
//
|
||||||
aMap.Add(anExp.Current());
|
case TopAbs_VERTEX: {
|
||||||
}
|
Standard_Integer aNbS, anIndex, i, aSDVInd;
|
||||||
|
//
|
||||||
for (; it.More(); it.Next()) {
|
const NMTTools_DSFiller& aDSF = Filler();
|
||||||
if(aMap.Contains(it.Value())) {
|
const NMTTools_PaveFiller& aPF = aDSF.PaveFiller();
|
||||||
myGenerated.Append(it.Value());
|
const NMTDS_ShapesDataStructure& aDS = aDSF.DS();
|
||||||
|
//
|
||||||
|
aNbS = aDS.NumberOfSourceShapes();
|
||||||
|
anIndex = 0;
|
||||||
|
//
|
||||||
|
for(i=1; i<=aNbS; ++i) {
|
||||||
|
const TopoDS_Shape& aS = aDS.Shape(i);
|
||||||
|
if(S.IsSame(aS)) {
|
||||||
|
anIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
//
|
||||||
|
if(!anIndex) {
|
||||||
return myGenerated;
|
break;//return myGenerated;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(S.ShapeType() == TopAbs_VERTEX) {
|
|
||||||
|
|
||||||
const NMTTools_DSFiller& aDSF = Filler();
|
|
||||||
const NMTTools_PaveFiller& aPF = aDSF.PaveFiller();
|
|
||||||
const NMTDS_ShapesDataStructure& aDS = aDSF.DS();
|
|
||||||
|
|
||||||
Standard_Integer aNbS = aDS.NumberOfSourceShapes();
|
|
||||||
Standard_Integer anIndex = 0, i;
|
|
||||||
|
|
||||||
for(i = 1; i <= aNbS; ++i) {
|
|
||||||
|
|
||||||
const TopoDS_Shape& aS = aDS.Shape(i);
|
|
||||||
if(S.IsSame(aS)) {
|
|
||||||
anIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
}
|
aSDVInd=aPF.FindSDVertex(anIndex);
|
||||||
|
if(!aSDVInd) {
|
||||||
if(anIndex == 0) return myGenerated;
|
break;//return myGenerated;
|
||||||
|
|
||||||
Standard_Integer aSDVInd = aPF.FindSDVertex(anIndex);
|
|
||||||
|
|
||||||
if(aSDVInd == 0) return myGenerated;
|
|
||||||
|
|
||||||
const TopoDS_Shape aSDV = aDS.Shape(aSDVInd);
|
|
||||||
|
|
||||||
anExp.Init(myShape, TopAbs_VERTEX);
|
|
||||||
for(; anExp.More(); anExp.Next()) {
|
|
||||||
|
|
||||||
if(aSDV.IsSame(anExp.Current())) {
|
|
||||||
myGenerated.Append(aSDV);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
}
|
const TopoDS_Shape& aSDV=aDS.Shape(aSDVInd);
|
||||||
|
//
|
||||||
}
|
anExp.Init(myShape, aType);
|
||||||
|
for(; anExp.More(); anExp.Next()) {
|
||||||
|
const TopoDS_Shape& aVx=anExp.Current();
|
||||||
|
if(aSDV.IsSame(aVx)) {
|
||||||
|
myGenerated.Append(aSDV);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
} // switch (aType) {
|
||||||
|
//
|
||||||
return myGenerated;
|
return myGenerated;
|
||||||
}
|
}
|
||||||
|
//modified by NIZNHY-PKV Mon Jan 24 10:28:40 2005 t
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Generated
|
//function : Generated
|
||||||
//purpose :
|
//purpose :
|
||||||
|
Loading…
Reference in New Issue
Block a user