mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-25 06:12:04 +05:00
NPAL16173: EDF454: Result of revolving a shell should be a compound.
This commit is contained in:
parent
81200c50e6
commit
97fc7b1c06
@ -864,7 +864,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle(
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
|
||||
GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolutionAxisAngle("
|
||||
<< theBase << ", " << theAxis << ", " << theAngle * 180.0 / PI << "*math.pi/180.0)";
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "GEOMAlgo_FinderShapeOnQuad.hxx"
|
||||
#include "GEOMAlgo_FinderShapeOn2.hxx"
|
||||
#include "GEOMAlgo_ClsfBox.hxx"
|
||||
//#include "GEOMAlgo_ClsfSurf.hxx"
|
||||
#include "GEOMAlgo_Gluer1.hxx"
|
||||
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
|
||||
#include "GEOMAlgo_CoupleOfShapes.hxx"
|
||||
@ -62,6 +61,7 @@
|
||||
#include <BRepExtrema_ExtCF.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@ -78,6 +78,7 @@
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
@ -1587,8 +1588,10 @@ Handle(TColStd_HSequenceOfInteger)
|
||||
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
|
||||
|
||||
// Check presence of triangulation, build if need
|
||||
if (!CheckTriangulation(theShape))
|
||||
if (!CheckTriangulation(theShape)) {
|
||||
SetErrorCode("Cannot build triangulation on the shape");
|
||||
return aSeqOfIDs;
|
||||
}
|
||||
|
||||
// Call algo
|
||||
GEOMAlgo_FinderShapeOn1 aFinder;
|
||||
@ -2207,8 +2210,10 @@ Handle(TColStd_HSequenceOfInteger)
|
||||
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
|
||||
|
||||
// Check presence of triangulation, build if need
|
||||
if (!CheckTriangulation(aShape))
|
||||
if (!CheckTriangulation(aShape)) {
|
||||
SetErrorCode("Cannot build triangulation on the shape");
|
||||
return aSeqOfIDs;
|
||||
}
|
||||
|
||||
// Call algo
|
||||
gp_Pnt aPntTL = BRep_Tool::Pnt(TopoDS::Vertex(aTL));
|
||||
@ -2651,6 +2656,33 @@ void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL)
|
||||
SL.Append( aShapes( OrderInd(Index) ));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CompsolidToCompound
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TopoDS_Shape GEOMImpl_IShapesOperations::CompsolidToCompound (const TopoDS_Shape& theCompsolid)
|
||||
{
|
||||
if (theCompsolid.ShapeType() != TopAbs_COMPSOLID) {
|
||||
return theCompsolid;
|
||||
}
|
||||
|
||||
TopoDS_Compound aCompound;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(aCompound);
|
||||
|
||||
TopTools_MapOfShape mapShape;
|
||||
TopoDS_Iterator It (theCompsolid, Standard_True, Standard_True);
|
||||
|
||||
for (; It.More(); It.Next()) {
|
||||
TopoDS_Shape aShape_i = It.Value();
|
||||
if (mapShape.Add(aShape_i)) {
|
||||
B.Add(aCompound, aShape_i);
|
||||
}
|
||||
}
|
||||
|
||||
return aCompound;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckTriangulation
|
||||
//purpose :
|
||||
@ -2659,7 +2691,6 @@ bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
|
||||
{
|
||||
TopExp_Explorer exp (aShape, TopAbs_FACE);
|
||||
if (!exp.More()) {
|
||||
SetErrorCode("Shape without faces given");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@ class GEOM_Engine;
|
||||
class Handle(GEOM_Object);
|
||||
class Handle(TColStd_HArray1OfInteger);
|
||||
|
||||
class GEOMImpl_IShapesOperations : public GEOM_IOperations {
|
||||
class GEOMImpl_IShapesOperations : public GEOM_IOperations
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
|
||||
Standard_EXPORT ~GEOMImpl_IShapesOperations();
|
||||
@ -112,19 +113,22 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
|
||||
const GEOMAlgo_State theState);
|
||||
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
|
||||
GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Handle(GEOM_Object)& theAxis,
|
||||
const Standard_Real theRadius,
|
||||
const GEOMAlgo_State theState);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
|
||||
GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Handle(GEOM_Object)& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
const GEOMAlgo_State theState);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
|
||||
GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Handle(GEOM_Object)& theAx1,
|
||||
const GEOMAlgo_State theState);
|
||||
@ -136,13 +140,15 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
|
||||
const Handle(GEOM_Object)& thePnt,
|
||||
const GEOMAlgo_State theState);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
|
||||
GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Handle(GEOM_Object)& theAxis,
|
||||
const Standard_Real theRadius,
|
||||
const GEOMAlgo_State theState);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
|
||||
GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Handle(GEOM_Object)& theCenter,
|
||||
const Standard_Real theRadius,
|
||||
@ -201,8 +207,6 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
|
||||
Handle(GEOM_Object) theShapeWhat);
|
||||
|
||||
Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
|
||||
|
||||
/*!
|
||||
* \brief Searches a shape equal to theWhat in the context of theWhere
|
||||
* \param theShapeWhere - a context shap
|
||||
@ -240,6 +244,30 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
|
||||
const Standard_Integer theShapeType,
|
||||
GEOMAlgo_State theState);
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Sort shapes in the list by their coordinates.
|
||||
* \param SL The list of shapes to sort.
|
||||
*/
|
||||
Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL);
|
||||
|
||||
/*!
|
||||
* \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
|
||||
*
|
||||
* If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
|
||||
*
|
||||
* \param theCompsolid The compsolid to be converted.
|
||||
* \retval TopoDS_Shape Returns the resulting compound.
|
||||
*/
|
||||
Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
|
||||
|
||||
/*!
|
||||
* \brief Build a triangulation on \a theShape if it is absent.
|
||||
* \param theShape The shape to check/build triangulation on.
|
||||
* \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
|
||||
*/
|
||||
Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
|
||||
|
||||
private:
|
||||
Handle(GEOM_Object) MakeShape (list<Handle(GEOM_Object)> theShapes,
|
||||
const Standard_Integer theObjectType,
|
||||
@ -250,8 +278,6 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations {
|
||||
// methods common for all GetShapesOnXXX() functions
|
||||
// ----------------------------------------------------
|
||||
|
||||
bool CheckTriangulation (const TopoDS_Shape& aShape);
|
||||
|
||||
/*!
|
||||
* \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
|
||||
* \param theShapeType - the shape type to check
|
||||
|
@ -21,16 +21,28 @@
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include <GEOMImpl_PipeDriver.hxx>
|
||||
|
||||
#include <GEOMImpl_IShapesOperations.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
#include <GEOMImpl_IPipeShellSect.hxx>
|
||||
#include <GEOMImpl_IPipe.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
|
||||
#include <ShapeAnalysis_FreeBounds.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepBuilderAPI_Sewing.hxx>
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||
#include <BRepBuilderAPI_MakeWire.hxx>
|
||||
#include <BRepOffsetAPI_MakePipeShell.hxx>
|
||||
|
||||
#include <TopAbs.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@ -38,32 +50,24 @@
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Shell.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <BRepOffsetAPI_MakePipeShell.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <GEOMImpl_IPipeDiffSect.hxx>
|
||||
#include <GEOMImpl_IPipeShellSect.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
#include <Standard_TypeMismatch.hxx>
|
||||
#include <Standard_ConstructionError.hxx>
|
||||
#include "utilities.h"
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <ShapeAnalysis_FreeBounds.hxx>
|
||||
#include <TColgp_SequenceOfPnt.hxx>
|
||||
#include <ShapeAnalysis_Edge.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <GeomAPI_ProjectPointOnCurve.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <BRepBuilderAPI_Sewing.hxx>
|
||||
|
||||
//#include <BRepTools.hxx>
|
||||
#include "utilities.h"
|
||||
|
||||
|
||||
//=======================================================================
|
||||
@ -345,7 +349,6 @@ static void FindNextPairOfFaces(const TopoDS_Shape& aCurFace,
|
||||
}
|
||||
|
||||
FindNextPairOfFaces(F1other, aMapEdgeFaces1, aMapEdgeFaces2, FF, aCI);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1250,7 +1253,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
|
||||
}
|
||||
|
||||
aFunction->SetValue(aShape);
|
||||
TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
|
||||
aFunction->SetValue(aRes);
|
||||
|
||||
log.SetTouched(Label());
|
||||
if(aCI) delete aCI;
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include <GEOMImpl_PrismDriver.hxx>
|
||||
|
||||
#include <GEOMImpl_IShapesOperations.hxx>
|
||||
#include <GEOMImpl_IPrism.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
@ -114,7 +116,8 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
||||
aFunction->SetValue(aShape);
|
||||
TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
|
||||
aFunction->SetValue(aRes);
|
||||
|
||||
log.SetTouched(Label());
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include <GEOMImpl_RevolutionDriver.hxx>
|
||||
|
||||
#include <GEOMImpl_IShapesOperations.hxx>
|
||||
#include <GEOMImpl_IRevolution.hxx>
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
@ -114,7 +116,9 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons
|
||||
}
|
||||
|
||||
if (aShape.IsNull()) return 0;
|
||||
aFunction->SetValue(aShape);
|
||||
|
||||
TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
|
||||
aFunction->SetValue(aRes);
|
||||
|
||||
log.SetTouched(Label());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user