Back to index

salome-geom  6.5.0
Classes | Functions | Variables
GEOMImpl_ICurvesOperations.cxx File Reference
#include <Python.h>
#include <structmember.h>
#include <Standard_Stream.hxx>
#include <GEOMImpl_ICurvesOperations.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
#include <GEOMImpl_PolylineDriver.hxx>
#include <GEOMImpl_CircleDriver.hxx>
#include <GEOMImpl_SplineDriver.hxx>
#include <GEOMImpl_EllipseDriver.hxx>
#include <GEOMImpl_ArcDriver.hxx>
#include <GEOMImpl_SketcherDriver.hxx>
#include <GEOMImpl_3DSketcherDriver.hxx>
#include <GEOMImpl_IPolyline.hxx>
#include <GEOMImpl_ICircle.hxx>
#include <GEOMImpl_ISpline.hxx>
#include <GEOMImpl_IEllipse.hxx>
#include <GEOMImpl_IArc.hxx>
#include <GEOMImpl_ISketcher.hxx>
#include <GEOMImpl_I3DSketcher.hxx>
#include <Basics_OCCTVersion.hxx>
#include "utilities.h"
#include <TDF_Tool.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>

Go to the source code of this file.

Classes

struct  PyStdOut

Functions

static void PyStdOut_dealloc (PyStdOut *self)
static PyObject * PyStdOut_write (PyStdOut *self, PyObject *args)
PyObject * newPyStdOut (std::string &out)
 Handle (GEOM_Object) GEOMImpl_ICurvesOperations
 MakeCircleThreePnt.

Variables

static PyMethodDef PyStdOut_methods []
static PyMemberDef PyStdOut_memberlist []
static PyTypeObject PyStdOut_Type

Class Documentation

struct PyStdOut

Definition at line 76 of file GEOMImpl_ICurvesOperations.cxx.

Collaboration diagram for PyStdOut:
Class Members
string * out
PyObject_HEAD int softspace

Function Documentation

MakeCircleThreePnt.

GetObject.

MakeSketcherOnPlane.

Make3DSketcher.

MakeSketcher.

MakeCurveParametric.

MakeSplineInterpolation.

MakeSplineBezier.

MakePolyline.

MakeArcOfEllipse.

MakeArcCenter.

MakeArc.

MakeEllipse.

MakeCirclePntVecR.

MakeCircleCenter2Pnt.

Definition at line 203 of file GEOMImpl_ICurvesOperations.cxx.

{
  SetErrorCode(KO);

  if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;

  //Add a new Circle object
  Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);

  //Add a new Circle function for creation a circle relatively to three points
  Handle(GEOM_Function) aFunction =
    aCircle->AddFunction(GEOMImpl_CircleDriver::GetID(), CIRCLE_THREE_PNT);
  if (aFunction.IsNull()) return NULL;

  //Check if the function is set correctly
  if (aFunction->GetDriverGUID() != GEOMImpl_CircleDriver::GetID()) return NULL;

  GEOMImpl_ICircle aCI (aFunction);

  Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
  Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
  Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();

  if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;

  aCI.SetPoint1(aRefPnt1);
  aCI.SetPoint2(aRefPnt2);
  aCI.SetPoint3(aRefPnt3);

  //Compute the Circle value
  try {
#if OCC_VERSION_LARGE > 0x06010000
    OCC_CATCH_SIGNALS;
#endif
    if (!GetSolver()->ComputeFunction(aFunction)) {
      SetErrorCode("Circle 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) << aCircle << " = geompy.MakeCircleThreePnt("
    << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";

  SetErrorCode(OK);
  return aCircle;
}

Here is the call graph for this function:

PyObject* newPyStdOut ( std::string &  out)

Definition at line 163 of file GEOMImpl_ICurvesOperations.cxx.

{
  PyStdOut *self;
  self = PyObject_New(PyStdOut, &PyStdOut_Type);
  if (self == NULL)
    return NULL;
  self->softspace = 0;
  self->out=&out;
  return (PyObject*)self;
}
static void PyStdOut_dealloc ( PyStdOut self) [static]

Definition at line 83 of file GEOMImpl_ICurvesOperations.cxx.

{
  PyObject_Del(self);
}
static PyObject* PyStdOut_write ( PyStdOut self,
PyObject *  args 
) [static]

Definition at line 89 of file GEOMImpl_ICurvesOperations.cxx.

{
  char *c;
  int l;
  if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
    return NULL;

  //std::cerr << c ;
  *(self->out)=*(self->out)+c;

  Py_INCREF(Py_None);
  return Py_None;
}

Variable Documentation

PyMemberDef PyStdOut_memberlist[] [static]
Initial value:
 {
  {(char*)"softspace", T_INT,  offsetof(PyStdOut, softspace), 0,
   (char*)"flag indicating that a space needs to be printed; used by print"},
  {NULL} 
}

Definition at line 109 of file GEOMImpl_ICurvesOperations.cxx.

PyMethodDef PyStdOut_methods[] [static]
Initial value:
 {
  {"write",  (PyCFunction)PyStdOut_write,  METH_VARARGS,
    PyDoc_STR("write(string) -> None")},
  {NULL,    NULL}   
}

Definition at line 103 of file GEOMImpl_ICurvesOperations.cxx.

PyTypeObject PyStdOut_Type [static]

Definition at line 115 of file GEOMImpl_ICurvesOperations.cxx.