return aCylinder;
}
+//=============================================================================
+/*!
+ * MakeCylinderRHA
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRHA (double theR, double theH, double theA)
+{
+ SetErrorCode(KO);
+
+ //Add a new Cylinder object
+ Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+
+ //Add a new Cylinder function with R and H parameters
+ Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H_A);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
+
+ GEOMImpl_ICylinder aCI (aFunction);
+
+ aCI.SetR(theR);
+ aCI.SetH(theH);
+ aCI.SetA(theA);
+
+ //Compute the Cylinder value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Cylinder driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aCylinder
+ << " = geompy.MakeCylinderRHA(" << theR << ", " << theH << ", " << theA*180./M_PI << "*math.pi/180.)";
+
+ SetErrorCode(OK);
+ return aCylinder;
+}
//=============================================================================
/*!
return aCylinder;
}
+//=============================================================================
+/*!
+ * MakeCylinderPntVecRHA
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
+ Handle(GEOM_Object) theVec,
+ double theR, double theH, double theA)
+{
+ SetErrorCode(KO);
+
+ if (thePnt.IsNull() || theVec.IsNull()) return NULL;
+
+ //Add a new Cylinder object
+ Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
+
+ //Add a new Cylinder function for creation a cylinder relatively to point and vector
+ Handle(GEOM_Function) aFunction =
+ aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H_A);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
+
+ GEOMImpl_ICylinder aCI (aFunction);
+
+ Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
+ Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
+
+ if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
+
+ aCI.SetPoint(aRefPnt);
+ aCI.SetVector(aRefVec);
+ aCI.SetR(theR);
+ aCI.SetH(theH);
+ aCI.SetA(theA);
+
+ //Compute the Cylinder value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Cylinder driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinderA("
+ << thePnt << ", " << theVec << ", " << theR << ", " << theH << ", " << theA*180./M_PI << "*math.pi/180.)";
+
+ SetErrorCode(OK);
+ return aCylinder;
+}
+
//=============================================================================
/*!
* MakeFilling
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling
- (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg,
- double theTol2D, double theTol3D, int theNbIter,
- int theMethod, bool isApprox)
+Handle(GEOM_Object)
+GEOMImpl_I3DPrimOperations::MakeFilling (std::list< Handle(GEOM_Object)> & theContours,
+ int theMinDeg, int theMaxDeg,
+ double theTol2D, double theTol3D, int theNbIter,
+ int theMethod, bool isApprox)
{
SetErrorCode(KO);
- if (theShape.IsNull()) return NULL;
-
+ Handle(TColStd_HSequenceOfTransient) contours = GEOM_Object::GetLastFunctions( theContours );
+ if ( contours.IsNull() || contours->IsEmpty() ) {
+ SetErrorCode("NULL argument shape");
+ return NULL;
+ }
//Add a new Filling object
Handle(GEOM_Object) aFilling = GetEngine()->AddObject(GetDocID(), GEOM_FILLING);
if (aFunction->GetDriverGUID() != GEOMImpl_FillingDriver::GetID()) return NULL;
GEOMImpl_IFilling aFI (aFunction);
-
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
-
- if (aRefShape.IsNull()) return NULL;
-
- aFI.SetShape(aRefShape);
+ aFI.SetShapes(contours);
aFI.SetMinDeg(theMinDeg);
aFI.SetMaxDeg(theMaxDeg);
aFI.SetTol2D(theTol2D);
//Make a Python command
GEOM::TPythonDump pd (aFunction);
- pd << aFilling << " = geompy.MakeFilling(" << theShape ;
+ pd << aFilling << " = geompy.MakeFilling(" << theContours ;
if ( theMinDeg != 2 ) pd << ", theMinDeg=" << theMinDeg ;
if ( theMaxDeg != 5 ) pd << ", theMaxDeg=" << theMaxDeg ;
if ( fabs(theTol2D-0.0001) > Precision::Confusion() )
- pd << ", theTol2D=" << theTol2D ;
+ { pd << ", theTol2D=" << theTol2D ; }
if ( fabs(theTol3D-0.0001) > Precision::Confusion() )
- pd << ", theTol3D=" << theTol3D ;
+ { pd << ", theTol3D=" << theTol3D ; }
if ( theNbIter != 0 ) pd << ", theNbIter=" << theNbIter ;
if ( theMethod==1 ) pd << ", theMethod=GEOM.FOM_UseOri";
else if( theMethod==2 ) pd << ", theMethod=GEOM.FOM_AutoCorrect";
- if(isApprox) pd << ", isApprox=" << isApprox ;
+ if ( isApprox ) pd << ", isApprox=" << isApprox ;
pd << ")";
SetErrorCode(OK);