mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-26 07:40:48 +05:00
Debug of barre
This commit is contained in:
parent
918efd9524
commit
c6123f20a8
@ -1056,9 +1056,9 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
|
|||||||
|
|
||||||
Standard_Integer nbBases = theBases->Length();
|
Standard_Integer nbBases = theBases->Length();
|
||||||
|
|
||||||
if (!nbBases)
|
if (!nbBases)
|
||||||
return anObj;
|
return anObj;
|
||||||
|
|
||||||
Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length());
|
Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length());
|
||||||
//Add a new Pipe object
|
//Add a new Pipe object
|
||||||
Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
|
Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
|
||||||
@ -1100,7 +1100,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
|
|||||||
if(anItemLoc.IsNull())
|
if(anItemLoc.IsNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItem);
|
Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
|
||||||
if(aLoc.IsNull())
|
if(aLoc.IsNull())
|
||||||
continue;
|
continue;
|
||||||
Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
|
Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
|
||||||
@ -1114,17 +1114,16 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections(
|
|||||||
if(!aSeqBases->Length())
|
if(!aSeqBases->Length())
|
||||||
return anObj;
|
return anObj;
|
||||||
|
|
||||||
|
|
||||||
aCI.SetBases(aSeqBases);
|
aCI.SetBases(aSeqBases);
|
||||||
aCI.SetLocations(aSeqLocs);
|
aCI.SetLocations(aSeqLocs);
|
||||||
aCI.SetPath(aRefPath);
|
aCI.SetPath(aRefPath);
|
||||||
aCI.SetWithContactMode(theWithContact);
|
aCI.SetWithContactMode(theWithContact);
|
||||||
aCI.SetWithCorrectionMode(theWithCorrections);
|
aCI.SetWithCorrectionMode(theWithCorrections);
|
||||||
|
|
||||||
//Compute the Pipe value
|
//Compute the Pipe value
|
||||||
try {
|
try {
|
||||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
SetErrorCode("ThruSections driver failed");
|
SetErrorCode("Pipe with defferent section driver failed");
|
||||||
return anObj;
|
return anObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class GEOMImpl_IPipe
|
|||||||
Handle(GEOM_Function) GetBase() { return _func->GetReference(PIPE_ARG_BASE); }
|
Handle(GEOM_Function) GetBase() { return _func->GetReference(PIPE_ARG_BASE); }
|
||||||
Handle(GEOM_Function) GetPath() { return _func->GetReference(PIPE_ARG_PATH); }
|
Handle(GEOM_Function) GetPath() { return _func->GetReference(PIPE_ARG_PATH); }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
|
||||||
Handle(GEOM_Function) _func;
|
Handle(GEOM_Function) _func;
|
||||||
};
|
};
|
||||||
|
@ -45,13 +45,19 @@ class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe
|
|||||||
{ _func->SetReferenceList(PIPEDS_LIST_BASES,theBases); }
|
{ _func->SetReferenceList(PIPEDS_LIST_BASES,theBases); }
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) GetBases ()
|
Handle(TColStd_HSequenceOfTransient) GetBases ()
|
||||||
{ return _func->GetReferenceList(PIPEDS_LIST_BASES); }
|
{
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aBases = _func->GetReferenceList(PIPEDS_LIST_BASES);
|
||||||
|
return aBases;
|
||||||
|
}
|
||||||
|
|
||||||
void SetLocations (const Handle(TColStd_HSequenceOfTransient)& theLocations)
|
void SetLocations (const Handle(TColStd_HSequenceOfTransient)& theLocations)
|
||||||
{ _func->SetReferenceList(PIPEDS_LIST_LOCATIONS,theLocations); }
|
{ _func->SetReferenceList(PIPEDS_LIST_LOCATIONS,theLocations); }
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) GetLocations ()
|
Handle(TColStd_HSequenceOfTransient) GetLocations ()
|
||||||
{ return _func->GetReferenceList(PIPEDS_LIST_BASES); }
|
{
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aLocs = _func->GetReferenceList(PIPEDS_LIST_LOCATIONS);
|
||||||
|
return aLocs;
|
||||||
|
}
|
||||||
|
|
||||||
//void SetPath (const Handle(GEOM_Function)& thePath) { _func->SetReference(PIPEDS_ARG_PATH, thePath); }
|
//void SetPath (const Handle(GEOM_Function)& thePath) { _func->SetReference(PIPEDS_ARG_PATH, thePath); }
|
||||||
|
|
||||||
@ -69,9 +75,6 @@ class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe
|
|||||||
int GetWithCorrectionMode()
|
int GetWithCorrectionMode()
|
||||||
{ return _func->GetInteger(PIPEDS_ARG_WITHCORRECT); }
|
{ return _func->GetInteger(PIPEDS_ARG_WITHCORRECT); }
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Handle(GEOM_Function) _func;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,6 +42,11 @@
|
|||||||
#include <Standard_NullObject.hxx>
|
#include <Standard_NullObject.hxx>
|
||||||
#include <Standard_TypeMismatch.hxx>
|
#include <Standard_TypeMismatch.hxx>
|
||||||
#include <Standard_ConstructionError.hxx>
|
#include <Standard_ConstructionError.hxx>
|
||||||
|
#include "utilities.h"
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <TopoDS_Compound.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetID
|
//function : GetID
|
||||||
@ -70,7 +75,6 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
{
|
{
|
||||||
if (Label().IsNull()) return 0;
|
if (Label().IsNull()) return 0;
|
||||||
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||||
|
|
||||||
GEOMImpl_IPipe* aCI= 0;
|
GEOMImpl_IPipe* aCI= 0;
|
||||||
Standard_Integer aType = aFunction->GetType();
|
Standard_Integer aType = aFunction->GetType();
|
||||||
if(aType == PIPE_BASE_PATH)
|
if(aType == PIPE_BASE_PATH)
|
||||||
@ -83,50 +87,55 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Handle(GEOM_Function) aRefPath = aCI->GetPath();
|
Handle(GEOM_Function) aRefPath = aCI->GetPath();
|
||||||
TopoDS_Shape aShapePath = aRefPath->GetValue();
|
TopoDS_Shape aShapePath = aRefPath->GetValue();
|
||||||
|
|
||||||
|
|
||||||
if (aShapePath.IsNull())
|
if (aShapePath.IsNull())
|
||||||
{
|
{
|
||||||
Standard_NullObject::Raise("MakePipe aborted : null path argument");
|
cout<<"Driver : path is null"<<endl;
|
||||||
if(aCI) delete aCI;
|
if(aCI) delete aCI;
|
||||||
|
Standard_NullObject::Raise("MakePipe aborted : null path argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get path contour
|
// Get path contour
|
||||||
TopoDS_Wire aWire;
|
TopoDS_Wire aWirePath;
|
||||||
if (aShapePath.ShapeType() == TopAbs_WIRE) {
|
if (aShapePath.ShapeType() == TopAbs_WIRE) {
|
||||||
aWire = TopoDS::Wire(aShapePath);
|
aWirePath = TopoDS::Wire(aShapePath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (aShapePath.ShapeType() == TopAbs_EDGE) {
|
if (aShapePath.ShapeType() == TopAbs_EDGE) {
|
||||||
|
|
||||||
TopoDS_Edge anEdge = TopoDS::Edge(aShapePath);
|
TopoDS_Edge anEdge = TopoDS::Edge(aShapePath);
|
||||||
aWire = BRepBuilderAPI_MakeWire(anEdge);
|
aWirePath = BRepBuilderAPI_MakeWire(anEdge);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge");
|
|
||||||
if(aCI) delete aCI;
|
if(aCI) delete aCI;
|
||||||
|
Standard_TypeMismatch::Raise("MakePipe aborted : path shape is neither a wire nor an edge");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
if (aType == PIPE_BASE_PATH) {
|
if (aType == PIPE_BASE_PATH)
|
||||||
|
{
|
||||||
|
|
||||||
Handle(GEOM_Function) aRefBase = aCI->GetBase();
|
Handle(GEOM_Function) aRefBase = aCI->GetBase();
|
||||||
|
|
||||||
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||||
|
|
||||||
if (aShapeBase.IsNull()) {
|
if (aShapeBase.IsNull()) {
|
||||||
Standard_NullObject::Raise("MakePipe aborted : null base argument");
|
|
||||||
if(aCI) delete aCI;
|
if(aCI) delete aCI;
|
||||||
|
Standard_NullObject::Raise("MakePipe aborted : null base argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make pipe
|
// Make pipe
|
||||||
aShape = BRepOffsetAPI_MakePipe(aWire, aShapeBase);
|
aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
//building pipe with different sections
|
//building pipe with different sections
|
||||||
else if (aType == PIPE_DIFFERENT_SECTIONS) {
|
else if (aType == PIPE_DIFFERENT_SECTIONS)
|
||||||
|
{
|
||||||
GEOMImpl_IPipeDiffSect* aCIDS = (GEOMImpl_IPipeDiffSect*)aCI;
|
GEOMImpl_IPipeDiffSect* aCIDS = (GEOMImpl_IPipeDiffSect*)aCI;
|
||||||
|
//GEOMImpl_IPipeDiffSect* aCIDS = static_cast<GEOMImpl_IPipeDiffSect*>(aCI);
|
||||||
BRepOffsetAPI_MakePipeShell aBuilder(aWire);
|
BRepOffsetAPI_MakePipeShell aBuilder(aWirePath);
|
||||||
Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases ();
|
Handle(TColStd_HSequenceOfTransient) aBasesObjs = aCIDS->GetBases ();
|
||||||
Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations ();
|
Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations ();
|
||||||
Standard_Boolean aWithContact = (aCIDS->GetWithContactMode());
|
Standard_Boolean aWithContact = (aCIDS->GetWithContactMode());
|
||||||
@ -134,60 +143,121 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
Standard_Integer i =1, nbBases = aBasesObjs->Length(),
|
Standard_Integer i =1, nbBases = aBasesObjs->Length(),
|
||||||
nbLocs = (aLocObjs.IsNull() ? 0 :aLocObjs->Length());
|
nbLocs = (aLocObjs.IsNull() ? 0 :aLocObjs->Length());
|
||||||
|
|
||||||
if(nbLocs && nbLocs != nbBases)
|
if(nbLocs && nbLocs != nbBases)
|
||||||
{
|
{
|
||||||
Standard_ConstructionError::Raise("Invalid input data for building PIPE: number of sections is not equql to number of locations ");
|
|
||||||
if(aCI) delete aCI;
|
if(aCI) delete aCI;
|
||||||
|
Standard_ConstructionError::Raise("Number of sections is not equal to number of locations ");
|
||||||
}
|
}
|
||||||
Standard_Integer nbAdded =0;
|
TopTools_SequenceOfShape aSeqBases;
|
||||||
for( ; i <= nbBases; i++) {
|
TopTools_SequenceOfShape aSeqLocs;
|
||||||
|
TopTools_SequenceOfShape aSeqFaces;
|
||||||
|
for( ; i <= nbBases; i++)
|
||||||
|
{
|
||||||
Handle(Standard_Transient) anItem = aBasesObjs->Value(i);
|
Handle(Standard_Transient) anItem = aBasesObjs->Value(i);
|
||||||
if(anItem.IsNull())
|
if(anItem.IsNull())
|
||||||
continue;
|
continue;
|
||||||
Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem);
|
Handle(GEOM_Function) aRefBase = Handle(GEOM_Function)::DownCast(anItem);
|
||||||
if(aRefBase.IsNull())
|
if(aRefBase.IsNull())
|
||||||
continue;
|
continue;
|
||||||
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
TopoDS_Shape aShapeBase = aRefBase->GetValue();
|
||||||
if(aShapeBase.IsNull())
|
if(aShapeBase.IsNull())
|
||||||
continue;
|
continue;
|
||||||
|
TopAbs_ShapeEnum aTypeBase = aShapeBase.ShapeType();
|
||||||
|
|
||||||
if(nbLocs) {
|
//if for section was specified face with a few wires then a few
|
||||||
Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i);
|
// pipes were build and make solid
|
||||||
if(anItemLoc.IsNull())
|
if(aTypeBase == TopAbs_FACE)
|
||||||
continue;
|
{
|
||||||
Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc);
|
//for case one path should be used other type function
|
||||||
TopoDS_Shape aShapeLoc = aRefLoc->GetValue();
|
aSeqFaces.Append(aShapeBase);
|
||||||
if(aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX)
|
TopExp_Explorer aExpW(aShapeBase,TopAbs_WIRE);
|
||||||
continue;
|
for( ; aExpW.More(); aExpW.Next())
|
||||||
TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc);
|
{
|
||||||
aBuilder.Add(aShapeBase,aVert,aWithContact,aWithCorrect);
|
TopoDS_Shape aWireProf = aExpW.Current();
|
||||||
nbAdded++;
|
aSeqBases.Append(aWireProf);
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
aBuilder.Add(aShapeBase,aWithContact,aWithCorrect);
|
else if(aTypeBase == TopAbs_WIRE || aTypeBase == TopAbs_VERTEX)
|
||||||
nbAdded++;
|
aSeqBases.Append(aShapeBase);
|
||||||
}
|
else if(aTypeBase == TopAbs_EDGE)
|
||||||
|
{
|
||||||
|
TopoDS_Edge anEdge = TopoDS::Edge(aShapeBase);
|
||||||
|
TopoDS_Shape aWireProf = BRepBuilderAPI_MakeWire(anEdge);
|
||||||
|
aSeqBases.Append(aWireProf);
|
||||||
|
}
|
||||||
|
if(nbLocs)
|
||||||
|
{
|
||||||
|
Handle(Standard_Transient) anItemLoc = aLocObjs->Value(i);
|
||||||
|
if(anItemLoc.IsNull())
|
||||||
|
continue;
|
||||||
|
Handle(GEOM_Function) aRefLoc = Handle(GEOM_Function)::DownCast(anItemLoc);
|
||||||
|
TopoDS_Shape aShapeLoc = aRefLoc->GetValue();
|
||||||
|
if(aShapeLoc.IsNull() || aShapeLoc.ShapeType() != TopAbs_VERTEX)
|
||||||
|
continue;
|
||||||
|
aSeqLocs.Append(aShapeLoc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!nbAdded || !aBuilder.IsReady())
|
|
||||||
|
nbLocs = aSeqLocs.Length();
|
||||||
|
Standard_Integer nbShapes = aSeqBases.Length();
|
||||||
|
Standard_Integer step = nbShapes/nbBases;
|
||||||
|
|
||||||
|
if(nbShapes < nbBases || fmod(nbShapes,nbBases))
|
||||||
{
|
{
|
||||||
Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
|
|
||||||
if(aCI) delete aCI;
|
if(aCI) delete aCI;
|
||||||
|
Standard_ConstructionError::Raise("Invalid sections were specified for building pipe");
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer ind =0;
|
||||||
|
for( i=1; i <= nbShapes && ind < nbShapes; i++) //i+nbBases <= nbShapes
|
||||||
|
{
|
||||||
|
TopTools_SequenceOfShape usedBases;
|
||||||
|
Standard_Integer j = 1;
|
||||||
|
for( ; j <= nbBases ; j++)
|
||||||
|
{
|
||||||
|
ind = i + (j-1)*step;
|
||||||
|
|
||||||
|
TopoDS_Shape aWireProf = aSeqBases.Value(ind);
|
||||||
|
usedBases.Append(aWireProf);
|
||||||
|
if(nbLocs)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aShapeLoc = aSeqLocs.Value(j);
|
||||||
|
TopoDS_Vertex aVert = TopoDS::Vertex(aShapeLoc);
|
||||||
|
aBuilder.Add(aWireProf,aVert,aWithContact,aWithCorrect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
aBuilder.Add(aWireProf,aWithContact,aWithCorrect);
|
||||||
|
}
|
||||||
|
if(!aBuilder.IsReady())
|
||||||
|
{
|
||||||
|
if(aCI) delete aCI;
|
||||||
|
Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid");
|
||||||
|
}
|
||||||
|
aBuilder.Build();
|
||||||
|
aShape = aBuilder.Shape();
|
||||||
|
aSeqFaces.Append(aShape);
|
||||||
|
for( j = 1; j <=usedBases.Length(); j++)
|
||||||
|
aBuilder.Delete(usedBases.Value(j));
|
||||||
|
}
|
||||||
|
|
||||||
|
//for case if section is face
|
||||||
|
if(aSeqFaces.Length() >1)
|
||||||
|
{
|
||||||
|
BRep_Builder aB;
|
||||||
|
TopoDS_Compound aComp;
|
||||||
|
aB.MakeCompound(aComp);
|
||||||
|
for( i = 1; i <= aSeqFaces.Length(); i++)
|
||||||
|
aB.Add(aComp,aSeqFaces.Value(i));
|
||||||
|
aShape = aComp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
aBuilder.Build();
|
|
||||||
aShape = aBuilder.Shape();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
|
||||||
BRepCheck_Analyzer ana (aShape, Standard_False);
|
BRepCheck_Analyzer ana (aShape, Standard_False);
|
||||||
if (!ana.IsValid()) {
|
if (!ana.IsValid()) {
|
||||||
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
|
||||||
if(aCI) delete aCI;
|
if(aCI) delete aCI;
|
||||||
|
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
||||||
}
|
}
|
||||||
|
|
||||||
aFunction->SetValue(aShape);
|
aFunction->SetValue(aShape);
|
||||||
|
@ -556,8 +556,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(co
|
|||||||
|
|
||||||
for (ind = 0; ind < aNbBases; ind++) {
|
for (ind = 0; ind < aNbBases; ind++) {
|
||||||
if (theBases[ind] == NULL) continue;
|
if (theBases[ind] == NULL) continue;
|
||||||
Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
|
Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(),
|
||||||
(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
|
theBases[ind]->GetEntry());
|
||||||
if(aBase.IsNull())
|
if(aBase.IsNull())
|
||||||
continue;
|
continue;
|
||||||
if(aNbLocs)
|
if(aNbLocs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user