Use a tuple instead of GeomAPI_Pnt in model.selection() commands.
}
}
+%typemap(in) const std::list<double> & (std::list<double> temp) {
+ double * temp_attribute;
+ int newmem = 0;
+ if (PyTuple_Check($input)) {
+ for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
+ PyObject * item = PySequence_GetItem($input, i);
+ if (PyNumber_Check(item)) {
+ temp.push_back((double)PyFloat_AsDouble(item));
+ } else {
+ PyErr_SetString(PyExc_TypeError, "argument must double value.");
+ return NULL;
+ }
+ Py_DECREF(item);
+ }
+ $1 = &temp;
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be a tuple of double values.");
+ return NULL;
+ }
+}
+
+%typecheck(SWIG_TYPECHECK_POINTER) std::list<double>, const std::list<double>& {
+ double * temp_object;
+ std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
+ int newmem = 0;
+ if (PyTuple_Check($input)) {
+ for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
+ PyObject * item = PySequence_GetItem($input, i);
+ if (PyNumber_Check(item)) {
+ $1 = 1;
+ } else {
+ $1 = 0;
+ break;
+ }
+ Py_DECREF(item);
+ }
+ } else {
+ $1 = 0;
+ }
+}
+
// all supported interfaces
%include "ModelHighAPI_Double.h"
%include "ModelHighAPI_Dumper.h"
anIndex = anOutput.str();
}
- myDumpBuffer << anIndex << "\", ";
- *this << aMiddlePoint;
+ myDumpBuffer << anIndex << "\", ("
+ << aMiddlePoint->x() << ", "
+ << aMiddlePoint->y() << ", "
+ << aMiddlePoint->z() << ")";
aStandardDump = false;
} else if (theAttrSelect->isWeakNaming() ||
(myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() &&
{
}
+ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
+ const std::list<double>& theSubShapeInnerPoint)
+: myVariantType(VT_TypeInnerPointPair)
+{
+ double aCoordinates[3] = { 0.0, 0.0, 0.0 };
+ double* aCIt = aCoordinates;
+ std::list<double>::const_iterator aPIt = theSubShapeInnerPoint.begin();
+ for (; aPIt != theSubShapeInnerPoint.end(); ++aPIt, ++aCIt)
+ *aCIt = *aPIt;
+
+ GeomPointPtr anInnerPoint(new GeomAPI_Pnt(aCoordinates[0], aCoordinates[1], aCoordinates[2]));
+ myTypeInnerPointPair = std::pair<std::string, GeomPointPtr>(theType, anInnerPoint);
+}
+
ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
const std::string& theContextName, const int theIndex)
: myVariantType(VT_WeakNamingPair)
//--------------------------------------------------------------------------------------
#include "ModelHighAPI.h"
+#include <list>
#include <memory>
#include <string>
#include <utility>
ModelHighAPI_Selection(const std::string& theType,
const std::shared_ptr<GeomAPI_Pnt>& theSubShapeInnerPoint);
+ /// Constructor for sub-shape by inner point coordinates given by a tuple
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Selection(const std::string& theType,
+ const std::list<double>& theSubShapeInnerPoint);
+
/// Constructor for sub-shape by weak naming identifier
MODELHIGHAPI_EXPORT