py3: Part: App: gathering commits relevant for Mod/Part/App
This commit is contained in:
parent
ed23c0d3c4
commit
a388a9d72d
|
@ -163,8 +163,9 @@ public:
|
|||
|
||||
/// Type structure of LinePyOld
|
||||
PyTypeObject LinePyOld::Type = {
|
||||
PyObject_HEAD_INIT(&PyType_Type)
|
||||
0, /*ob_size*/
|
||||
// PyObject_HEAD_INIT(&PyType_Type)
|
||||
// 0, /*ob_size*/
|
||||
PyVarObject_HEAD_INIT(&PyType_Type,0)
|
||||
"Part.Line", /*tp_name*/
|
||||
sizeof(LinePyOld), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
|
@ -186,7 +187,11 @@ PyTypeObject LinePyOld::Type = {
|
|||
/* --- Functions to access object as input/output buffer ---------*/
|
||||
0, /* tp_as_buffer */
|
||||
/* --- Flags to define presence of optional/expanded features */
|
||||
Py_TPFLAGS_HAVE_CLASS, /*tp_flags */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py_TPFLAGS_DEFAULT, /*tp_flags */
|
||||
#else
|
||||
Py_TPFLAGS_HAVE_CLASS, /*tp_flags */
|
||||
#endif
|
||||
"",
|
||||
0, /*tp_traverse */
|
||||
0, /*tp_clear */
|
||||
|
@ -214,6 +219,9 @@ PyTypeObject LinePyOld::Type = {
|
|||
0, /*tp_weaklist */
|
||||
0, /*tp_del */
|
||||
0 /*tp_version_tag */
|
||||
#if PY_MAJOR_VERSION >=3
|
||||
,0 /*tp_finalize */
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -350,7 +358,12 @@ PyMOD_INIT_FUNC(Part)
|
|||
Base::Interpreter().addType(&Part::BRepOffsetAPI_MakePipeShellPy::Type,brepModule,"MakePipeShell");
|
||||
|
||||
// Geom2d package
|
||||
PyObject* geom2dModule = Py_InitModule3("Geom2d", 0, "Geom2d");
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
static struct PyModuleDef geom2dDef = {PyModuleDef_HEAD_INIT,"Geom2dD", "Geom2d", -1, 0};
|
||||
PyObject* geom2dModule = PyModule_Create(&geom2dDef);
|
||||
#else
|
||||
PyObject* geom2dModule = Py_InitModule3("Geom2d", 0, "Geom2d");
|
||||
#endif
|
||||
Py_INCREF(geom2dModule);
|
||||
PyModule_AddObject(partModule, "Geom2d", geom2dModule);
|
||||
Base::Interpreter().addType(&Part::Geometry2dPy::Type,geom2dModule,"Geometry2d");
|
||||
|
@ -370,7 +383,9 @@ PyMOD_INIT_FUNC(Part)
|
|||
Base::Interpreter().addType(&Part::Line2dSegmentPy::Type,geom2dModule,"Line2dSegment");
|
||||
Base::Interpreter().addType(&Part::Line2dPy::Type,geom2dModule,"Line2d");
|
||||
Base::Interpreter().addType(&Part::OffsetCurve2dPy::Type,geom2dModule,"OffsetCurve2d");
|
||||
|
||||
#if 0 /* for python3 this isn't working anymore, it's solved by importing the BOPTools
|
||||
directly. (import BOPTools) */
|
||||
// this causes double initialisation of the part modul with python3.
|
||||
try {
|
||||
//import all submodules of BOPTools, to make them easy to browse in Py console.
|
||||
//It's done in this weird manner instead of bt.caMemberFunction("importAll"),
|
||||
|
@ -383,6 +398,7 @@ PyMOD_INIT_FUNC(Part)
|
|||
Base::Console().Error("Failed to import BOPTools package:\n");
|
||||
err.ReportException();
|
||||
}
|
||||
#endif
|
||||
|
||||
Part::TopoShape ::init();
|
||||
Part::PropertyPartShape ::init();
|
||||
|
|
|
@ -257,8 +257,11 @@ PyObject* AttachEnginePy::getModeInfo(PyObject* args)
|
|||
}
|
||||
Py::Dict ret;
|
||||
ret["ReferenceCombinations"] = pyListOfCombinations;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
ret["ModeIndex"] = Py::Long(mmode);
|
||||
#else
|
||||
ret["ModeIndex"] = Py::Int(mmode);
|
||||
|
||||
#endif
|
||||
try {
|
||||
Py::Module module(PyImport_ImportModule("PartGui"),true);
|
||||
if (!module.hasAttr("AttachEngineResources")) {
|
||||
|
@ -269,7 +272,11 @@ PyObject* AttachEnginePy::getModeInfo(PyObject* args)
|
|||
Py::Callable method(submod.getAttr("getModeStrings"));
|
||||
Py::Tuple arg(2);
|
||||
arg.setItem(0, Py::String(this->getAttachEnginePtr()->getTypeId().getName()));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
arg.setItem(1, Py::Long(mmode));
|
||||
#else
|
||||
arg.setItem(1, Py::Int(mmode));
|
||||
#endif
|
||||
Py::List strs = method.apply(arg);
|
||||
assert(strs.size() == 2);
|
||||
ret["UserFriendlyName"] = strs[0];
|
||||
|
@ -342,8 +349,13 @@ PyObject* AttachEnginePy::getRefTypeInfo(PyObject* args)
|
|||
AttachEngine &attacher = *(this->getAttachEnginePtr());
|
||||
eRefType rt = attacher.getRefTypeByName(typeName);
|
||||
Py::Dict ret;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
ret["TypeIndex"] = Py::Long(rt);
|
||||
ret["Rank"] = Py::Long(AttachEngine::getTypeRank(rt));
|
||||
#else
|
||||
ret["TypeIndex"] = Py::Int(rt);
|
||||
ret["Rank"] = Py::Int(AttachEngine::getTypeRank(rt));
|
||||
#endif
|
||||
|
||||
try {
|
||||
Py::Module module(PyImport_ImportModule("PartGui"),true);
|
||||
|
@ -354,7 +366,11 @@ PyObject* AttachEnginePy::getRefTypeInfo(PyObject* args)
|
|||
Py::Object submod(module.getAttr("AttachEngineResources"));
|
||||
Py::Callable method(submod.getAttr("getRefTypeUserFriendlyName"));
|
||||
Py::Tuple arg(1);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
arg.setItem(0, Py::Long(rt));
|
||||
#else
|
||||
arg.setItem(0, Py::Int(rt));
|
||||
#endif
|
||||
Py::String st = method.apply(arg);
|
||||
ret["UserFriendlyName"] = st;
|
||||
} catch (Py::Exception& e) {
|
||||
|
|
|
@ -225,7 +225,11 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long val(*it);
|
||||
#else
|
||||
Py::Int val(*it);
|
||||
#endif
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -672,7 +676,6 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Py::Long BSplineCurvePy::getDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineCurve curve = Handle_Geom_BSplineCurve::DownCast
|
||||
|
@ -1211,7 +1214,11 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key
|
|||
Py::Sequence multssq(mults);
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = multssq.begin(); it != multssq.end() && index <= occmults.Length(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long mult(*it);
|
||||
#else
|
||||
Py::Int mult(*it);
|
||||
#endif
|
||||
if (index < occmults.Length() || PyObject_Not(periodic)) {
|
||||
sum_of_mults += static_cast<int>(mult); //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
|
|
|
@ -286,7 +286,11 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long val(*it);
|
||||
#else
|
||||
Py::Int val(*it);
|
||||
#endif
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -349,7 +353,11 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long val(*it);
|
||||
#else
|
||||
Py::Int val(*it);
|
||||
#endif
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -1467,7 +1475,11 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
|||
Py::Sequence umultssq(umults);
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = umultssq.begin(); it != umultssq.end() && index <= occumults.Length(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long mult(*it);
|
||||
#else
|
||||
Py::Int mult(*it);
|
||||
#endif
|
||||
if (index < occumults.Length() || PyObject_Not(uperiodic)) {
|
||||
sum_of_umults += static_cast<int>(mult); //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
|
@ -1476,7 +1488,11 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
|||
Py::Sequence vmultssq(vmults);
|
||||
index = 1;
|
||||
for (Py::Sequence::iterator it = vmultssq.begin(); it != vmultssq.end() && index <= occvmults.Length(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long mult(*it);
|
||||
#else
|
||||
Py::Int mult(*it);
|
||||
#endif
|
||||
if (index < occvmults.Length() || PyObject_Not(vperiodic)) {
|
||||
sum_of_vmults += static_cast<int>(mult); //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
|
@ -1536,7 +1552,6 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Py::Long BSplineSurfacePy::getUDegree(void) const
|
||||
{
|
||||
Handle_Geom_BSplineSurface surf = Handle_Geom_BSplineSurface::DownCast
|
||||
|
|
|
@ -355,7 +355,6 @@ PyObject* BezierCurvePy::getResolution(PyObject* args)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Py::Long BezierCurvePy::getDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierCurve curve = Handle_Geom_BezierCurve::DownCast
|
||||
|
|
|
@ -728,7 +728,6 @@ PyObject* BezierSurfacePy::vIso(PyObject * args)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Py::Long BezierSurfacePy::getUDegree(void) const
|
||||
{
|
||||
Handle_Geom_BezierSurface surf = Handle_Geom_BezierSurface::DownCast
|
||||
|
|
|
@ -19,21 +19,21 @@
|
|||
<Documentation>
|
||||
<UserDocu>Returns the polynomial degree of this B-Spline curve.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Degree" Type="Int"/>
|
||||
<Parameter Name="Degree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="MaxDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the value of the maximum polynomial degree of any
|
||||
B-Spline curve curve. This value is 25.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MaxDegree" Type="Int"/>
|
||||
<Parameter Name="MaxDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the number of poles of this B-Spline curve.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbPoles" Type="Int"/>
|
||||
<Parameter Name="NbPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbKnots" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
@ -41,7 +41,7 @@ B-Spline curve curve. This value is 25.</UserDocu>
|
|||
Returns the number of knots of this B-Spline curve.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbPoles" Type="Int"/>
|
||||
<Parameter Name="NbPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="StartPoint" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
|
|
@ -214,7 +214,11 @@ PyObject* BSplineCurve2dPy::insertKnots(PyObject * args)
|
|||
TColStd_Array1OfInteger m(1,mults.size());
|
||||
index=1;
|
||||
for (Py::Sequence::iterator it = mults.begin(); it != mults.end(); ++it) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py::Long val(*it);
|
||||
#else
|
||||
Py::Int val(*it);
|
||||
#endif
|
||||
m(index++) = (int)val;
|
||||
}
|
||||
|
||||
|
@ -408,7 +412,7 @@ PyObject* BSplineCurve2dPy::getPoles(PyObject * args)
|
|||
try {
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
TColgp_Array1OfPnt2d p(1,curve->NbPoles());
|
||||
TColgp_Array1OfPnt2d p(1, (int)curve->NbPoles());
|
||||
curve->Poles(p);
|
||||
|
||||
Py::List poles;
|
||||
|
@ -645,7 +649,11 @@ PyObject* BSplineCurve2dPy::getMultiplicities(PyObject * args)
|
|||
curve->Multiplicities(m);
|
||||
Py::List mults;
|
||||
for (Standard_Integer i=m.Lower(); i<=m.Upper(); i++) {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
mults.append(Py::Long(m(i)));
|
||||
#else
|
||||
mults.append(Py::Int(m(i)));
|
||||
#endif
|
||||
}
|
||||
return Py::new_reference_to(mults);
|
||||
}
|
||||
|
@ -656,32 +664,32 @@ PyObject* BSplineCurve2dPy::getMultiplicities(PyObject * args)
|
|||
}
|
||||
}
|
||||
|
||||
Py::Int BSplineCurve2dPy::getDegree(void) const
|
||||
Py::Long BSplineCurve2dPy::getDegree(void) const
|
||||
{
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->Degree());
|
||||
return Py::Long(curve->Degree());
|
||||
}
|
||||
|
||||
Py::Int BSplineCurve2dPy::getMaxDegree(void) const
|
||||
Py::Long BSplineCurve2dPy::getMaxDegree(void) const
|
||||
{
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->MaxDegree());
|
||||
return Py::Long(curve->MaxDegree());
|
||||
}
|
||||
|
||||
Py::Int BSplineCurve2dPy::getNbPoles(void) const
|
||||
Py::Long BSplineCurve2dPy::getNbPoles(void) const
|
||||
{
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->NbPoles());
|
||||
return Py::Long(curve->NbPoles());
|
||||
}
|
||||
|
||||
Py::Int BSplineCurve2dPy::getNbKnots(void) const
|
||||
Py::Long BSplineCurve2dPy::getNbKnots(void) const
|
||||
{
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->NbKnots());
|
||||
return Py::Long(curve->NbKnots());
|
||||
}
|
||||
|
||||
Py::Object BSplineCurve2dPy::getStartPoint(void) const
|
||||
|
@ -716,14 +724,22 @@ Py::Object BSplineCurve2dPy::getFirstUKnotIndex(void) const
|
|||
{
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return Py::Long(curve->FirstUKnotIndex());
|
||||
#else
|
||||
return Py::Int(curve->FirstUKnotIndex());
|
||||
#endif
|
||||
}
|
||||
|
||||
Py::Object BSplineCurve2dPy::getLastUKnotIndex(void) const
|
||||
{
|
||||
Handle_Geom2d_BSplineCurve curve = Handle_Geom2d_BSplineCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->LastUKnotIndex());
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return Py::Long(curve->LastUKnotIndex());
|
||||
#else
|
||||
return Py::Int(curve->FirstUKnotIndex());
|
||||
#endif
|
||||
}
|
||||
|
||||
Py::List BSplineCurve2dPy::getKnotSequence(void) const
|
||||
|
@ -733,12 +749,12 @@ Py::List BSplineCurve2dPy::getKnotSequence(void) const
|
|||
Standard_Integer m = 0;
|
||||
if (curve->IsPeriodic()) {
|
||||
// knots=poles+2*degree-mult(1)+2
|
||||
m = curve->NbPoles() + 2*curve->Degree() - curve->Multiplicity(1) + 2;
|
||||
m = (int)(curve->NbPoles() + 2*curve->Degree() - curve->Multiplicity(1) + 2);
|
||||
}
|
||||
else {
|
||||
// knots=poles+degree+1
|
||||
for (int i=1; i<= curve->NbKnots(); i++)
|
||||
m += curve->Multiplicity(i);
|
||||
m += (int)curve->Multiplicity(i);
|
||||
}
|
||||
|
||||
TColStd_Array1OfReal k(1,m);
|
||||
|
@ -1208,9 +1224,13 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k
|
|||
Py::Sequence multssq(mults);
|
||||
Standard_Integer index = 1;
|
||||
for (Py::Sequence::iterator it = multssq.begin(); it != multssq.end() && index <= occmults.Length(); ++it) {
|
||||
#if PY_MAJOR_VERSION >=3
|
||||
Py::Long mult(*it);
|
||||
#else
|
||||
Py::Int mult(*it);
|
||||
#endif
|
||||
if (index < occmults.Length() || PyObject_Not(periodic)) {
|
||||
sum_of_mults += mult; //sum up the mults to compare them against the number of poles later
|
||||
sum_of_mults += (int)mult; //sum up the mults to compare them against the number of poles later
|
||||
}
|
||||
occmults(index++) = mult;
|
||||
}
|
||||
|
|
|
@ -24,21 +24,21 @@
|
|||
<UserDocu>Returns the polynomial degree of this Bezier curve,
|
||||
which is equal to the number of poles minus 1.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="Degree" Type="Int"/>
|
||||
<Parameter Name="Degree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="MaxDegree" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the value of the maximum polynomial degree of any
|
||||
Bezier curve curve. This value is 25.</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="MaxDegree" Type="Int"/>
|
||||
<Parameter Name="MaxDegree" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="NbPoles" ReadOnly="true">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the number of poles of this Bezier curve.
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
<Parameter Name="NbPoles" Type="Int"/>
|
||||
<Parameter Name="NbPoles" Type="Long"/>
|
||||
</Attribute>
|
||||
<Attribute Name="StartPoint" ReadOnly="true">
|
||||
<Documentation>
|
||||
|
|
|
@ -362,26 +362,25 @@ PyObject* BezierCurve2dPy::getResolution(PyObject* args)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Py::Int BezierCurve2dPy::getDegree(void) const
|
||||
Py::Long BezierCurve2dPy::getDegree(void) const
|
||||
{
|
||||
Handle_Geom2d_BezierCurve curve = Handle_Geom2d_BezierCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->Degree());
|
||||
return Py::Long(curve->Degree());
|
||||
}
|
||||
|
||||
Py::Int BezierCurve2dPy::getMaxDegree(void) const
|
||||
Py::Long BezierCurve2dPy::getMaxDegree(void) const
|
||||
{
|
||||
Handle_Geom2d_BezierCurve curve = Handle_Geom2d_BezierCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->MaxDegree());
|
||||
return Py::Long(curve->MaxDegree());
|
||||
}
|
||||
|
||||
Py::Int BezierCurve2dPy::getNbPoles(void) const
|
||||
Py::Long BezierCurve2dPy::getNbPoles(void) const
|
||||
{
|
||||
Handle_Geom2d_BezierCurve curve = Handle_Geom2d_BezierCurve::DownCast
|
||||
(getGeometry2dPtr()->handle());
|
||||
return Py::Int(curve->NbPoles());
|
||||
return Py::Long(curve->NbPoles());
|
||||
}
|
||||
|
||||
Py::Object BezierCurve2dPy::getStartPoint(void) const
|
||||
|
|
|
@ -501,7 +501,11 @@ PyObject *PropertyFilletEdges::getPyObject(void)
|
|||
int index = 0;
|
||||
for (it = _lValueList.begin(); it != _lValueList.end(); ++it) {
|
||||
Py::Tuple ent(3);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
ent.setItem(0, Py::Long(it->edgeid));
|
||||
#else
|
||||
ent.setItem(0, Py::Int(it->edgeid));
|
||||
#endif
|
||||
ent.setItem(1, Py::Float(it->radius1));
|
||||
ent.setItem(2, Py::Float(it->radius2));
|
||||
list[index++] = ent;
|
||||
|
@ -518,7 +522,11 @@ void PropertyFilletEdges::setPyObject(PyObject *value)
|
|||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
FilletElement fe;
|
||||
Py::Tuple ent(*it);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
fe.edgeid = (int)Py::Long(ent.getItem(0));
|
||||
#else
|
||||
fe.edgeid = (int)Py::Int(ent.getItem(0));
|
||||
#endif
|
||||
fe.radius1 = (double)Py::Float(ent.getItem(1));
|
||||
fe.radius2 = (double)Py::Float(ent.getItem(2));
|
||||
values.push_back(fe);
|
||||
|
|
|
@ -1870,9 +1870,15 @@ PyObject* TopoShapePy::makeShapeFromMesh(PyObject *args)
|
|||
for (Py::Sequence::iterator it = facets.begin(); it != facets.end(); ++it) {
|
||||
Data::ComplexGeoData::Facet face;
|
||||
Py::Tuple f(*it);
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
face.I1 = (int)Py::Long(f[0]);
|
||||
face.I2 = (int)Py::Long(f[1]);
|
||||
face.I3 = (int)Py::Long(f[2]);
|
||||
#else
|
||||
face.I1 = (int)Py::Int(f[0]);
|
||||
face.I2 = (int)Py::Int(f[1]);
|
||||
face.I3 = (int)Py::Int(f[2]);
|
||||
#endif
|
||||
Facets.push_back(face);
|
||||
}
|
||||
|
||||
|
@ -2290,11 +2296,19 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
|||
|
||||
for (BRepExtrema_OverlappedSubShapes::Iterator anIt1 (proximity.OverlapSubShapes1()); anIt1.More(); anIt1.Next()) {
|
||||
//PyList_Append(overlappss1, new TopoShapeFacePy(new TopoShape(proximity.GetSubShape1 (anIt1.Key()))));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyList_Append(overlappssindex1,PyLong_FromLong(anIt1.Key()+1));
|
||||
#else
|
||||
PyList_Append(overlappssindex1,PyInt_FromLong(anIt1.Key()+1));
|
||||
#endif
|
||||
}
|
||||
for (BRepExtrema_OverlappedSubShapes::Iterator anIt2 (proximity.OverlapSubShapes2()); anIt2.More(); anIt2.Next()) {
|
||||
//PyList_Append(overlappss2, new TopoShapeFacePy(new TopoShape(proximity.GetSubShape2 (anIt2.Key()))));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyList_Append(overlappssindex2,PyLong_FromLong(anIt2.Key()+1));
|
||||
#else
|
||||
PyList_Append(overlappssindex2,PyInt_FromLong(anIt2.Key()+1));
|
||||
#endif
|
||||
}
|
||||
//return Py_BuildValue("OO", overlappss1, overlappss2); //subshapes
|
||||
return Py_BuildValue("OO", overlappssindex1, overlappssindex2); //face indexes
|
||||
|
|
Loading…
Reference in New Issue
Block a user