-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <GEOMImpl_ITranslate.hxx>
#include <GEOMImpl_IMirror.hxx>
#include <GEOMImpl_IProjection.hxx>
+#include <GEOMImpl_IProjOnCyl.hxx>
#include <GEOMImpl_IOffset.hxx>
#include <GEOMImpl_IScale.hxx>
#include <GEOMImpl_IRotate.hxx>
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
-#include <Basics_OCCTVersion.hxx>
-
#include "utilities.h"
-#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
-#include <TFunction_Logbook.hxx>
#include <TDF_Tool.hxx>
#include <BRep_Tool.hxx>
*/
//=============================================================================
-GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
+GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations (GEOM_Engine* theEngine)
+: GEOM_IOperations(theEngine)
{
MESSAGE("GEOMImpl_ITransformOperations::GEOMImpl_ITransformOperations");
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a translate function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a translate function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a translate function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Add a translate function
if (theCopy) {
- aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ aCopy = GetEngine()->AddObject(theObject->GetType());
aFunction = aCopy->AddFunction(GEOMImpl_TranslateDriver::GetID(), TRANSLATE_VECTOR_DISTANCE);
}
else {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
//Add a translate function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
//Add a translate function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a mirror function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a mirror function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a mirror function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
* OffsetShape
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
- (Handle(GEOM_Object) theObject, double theOffset)
+Handle(GEOM_Object)
+GEOMImpl_ITransformOperations::OffsetShape (Handle(GEOM_Object) theObject,
+ double theOffset,
+ bool theJoinByPipes)
{
SetErrorCode(KO);
if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
GEOMImpl_IOffset aTI (aFunction);
- aTI.SetShape(anOriginal);
- aTI.SetValue(theOffset);
+ aTI.SetShape( anOriginal );
+ aTI.SetValue( theOffset );
+ aTI.SetJoinByPipes( theJoinByPipes );
//Compute the offset
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.Offset("
- << theObject << ", " << theOffset << ")";
+ if (theJoinByPipes)
+ GEOM::TPythonDump(aFunction) << "geompy.Offset("
+ << theObject << ", " << theOffset << ")";
+ else
+ GEOM::TPythonDump(aFunction) << theObject << " = geompy.MakeOffsetIntersectionJoin("
+ << theObject << ", " << theOffset << ")";
SetErrorCode(OK);
return theObject;
* OffsetShapeCopy
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
- (Handle(GEOM_Object) theObject, double theOffset)
+Handle(GEOM_Object)
+GEOMImpl_ITransformOperations::OffsetShapeCopy( Handle(GEOM_Object) theObject,
+ double theOffset,
+ bool theJoinByPipes)
{
SetErrorCode(KO);
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a new Offset function
Handle(GEOM_Function) aFunction =
if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
GEOMImpl_IOffset aTI (aFunction);
- aTI.SetShape(anOriginal);
- aTI.SetValue(theOffset);
+ aTI.SetShape( anOriginal );
+ aTI.SetValue( theOffset );
+ aTI.SetJoinByPipes( theJoinByPipes );
//Compute the offset
try {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
- << theObject << ", " << theOffset << ")";
+ if (theJoinByPipes)
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffset("
+ << theObject << ", " << theOffset << ")";
+ else
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeOffsetIntersectionJoin("
+ << theObject << ", " << theOffset << ")";
SetErrorCode(OK);
return aCopy;
else
{
//Add a new Projection object
- aCopy = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
+ aCopy = GetEngine()->AddObject(GEOM_PROJECTION);
//Add a Projection function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
}
}
//Add a new Projection object
- thePointOnEdge = GetEngine()->AddObject(GetDocID(), GEOM_PROJECTION);
+ thePointOnEdge = GetEngine()->AddObject(GEOM_PROJECTION);
//Add a Projection function
Handle(GEOM_Function) aFunction = thePointOnEdge->AddFunction
return aResult;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return aResult;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a scale function
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
Handle(GEOM_Object) aCopy; //Add a new Copy object
Handle(GEOM_Function) aFunction;
if (doCopy) {
- aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ aCopy = GetEngine()->AddObject(theObject->GetType());
aFunction = aCopy->AddFunction(GEOMImpl_ScaleDriver::GetID(), SCALE_SHAPE_AXES_COPY);
}
else {
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a position function
Standard_Integer aType = POSITION_SHAPE_COPY;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
Handle(GEOM_Object) aCopy;
if (theCopy) {
- aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ aCopy = GetEngine()->AddObject(theObject->GetType());
aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
}
else
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(theObject->GetType());
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
//Add a rotate function
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
// Add a new Copy object
- Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GEOM_COPY);
// Add a transform function (depends on theSample function)
Handle(GEOM_Function) aFunction =
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
SetErrorCode(OK);
return aCopy;
}
+
+//=============================================================================
+/*!
+ * MakeProjectionOnCylinder
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder
+ (const Handle(GEOM_Object) &theObject,
+ const Standard_Real theRadius,
+ const Standard_Real theStartAngle,
+ const Standard_Real theAngleLength,
+ const Standard_Real theAngleRotation)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) {
+ return NULL;
+ }
+
+ Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
+
+ if (aLastFunction.IsNull()) {
+ //There is no function which creates an object to be projected
+ return NULL;
+ }
+
+ //Add a new Projection object
+ Handle(GEOM_Object) aResult =
+ GetEngine()->AddObject(GEOM_PROJECTION);
+
+ //Add a Projection function
+ Handle(GEOM_Function) aFunction = aResult->AddFunction
+ (GEOMImpl_ProjectionDriver::GetID(), PROJECTION_ON_CYLINDER);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ProjectionDriver::GetID()) {
+ return aResult;
+ }
+
+ GEOMImpl_IProjOnCyl aProj (aFunction);
+
+ aProj.SetShape(aLastFunction);
+ aProj.SetRadius(theRadius);
+ aProj.SetStartAngle(theStartAngle);
+ aProj.SetAngleLength(theAngleLength);
+ aProj.SetAngleRotation(theAngleRotation);
+
+ //Compute the Projection
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Projection driver failed");
+ return aResult;
+ }
+ }
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
+ return aResult;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aResult << " = geompy.MakeProjectionOnCylinder("
+ << theObject << ", " << theRadius << ", " << theStartAngle
+ << ", " << theAngleLength << ", " << theAngleRotation << ")";
+
+ SetErrorCode(OK);
+
+ return aResult;
+}