Toponaming: Remove all FC_USE_TNP_FIX protected old code
This commit is contained in:
@@ -325,41 +325,7 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "Os", &pcPyShapeOrList, &className)) {
|
||||
try {
|
||||
#ifdef FC_USE_TNP_FIX
|
||||
getTopoShapePtr()->makeElementFace(getPyShapes(pcPyShapeOrList),0,className);
|
||||
#else
|
||||
std::unique_ptr<FaceMaker> fm = Part::FaceMaker::ConstructFromType(className);
|
||||
|
||||
//dump all supplied shapes to facemaker, no matter what type (let facemaker decide).
|
||||
if (PySequence_Check(pcPyShapeOrList)){
|
||||
Py::Sequence list(pcPyShapeOrList);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
PyObject* item = (*it).ptr();
|
||||
if (PyObject_TypeCheck(item, &(Part::TopoShapePy::Type))) {
|
||||
const TopoDS_Shape& sh = static_cast<Part::TopoShapePy*>(item)->getTopoShapePtr()->getShape();
|
||||
fm->addShape(sh);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "Object is not a shape.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} else if (PyObject_TypeCheck(pcPyShapeOrList, &(Part::TopoShapePy::Type))) {
|
||||
const TopoDS_Shape& sh = static_cast<Part::TopoShapePy*>(pcPyShapeOrList)->getTopoShapePtr()->getShape();
|
||||
if (sh.IsNull())
|
||||
throw NullShapeException("Shape is null!");
|
||||
if (sh.ShapeType() == TopAbs_COMPOUND)
|
||||
fm->useCompound(TopoDS::Compound(sh));
|
||||
else
|
||||
fm->addShape(sh);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "First argument is neither a shape nor list of shapes.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fm->Build();
|
||||
|
||||
getTopoShapePtr()->setShape(fm->Face());
|
||||
#endif
|
||||
return 0;
|
||||
} catch (Base::Exception &e) {
|
||||
e.setPyException();
|
||||
@@ -425,25 +391,8 @@ PyObject* TopoShapeFacePy::addWire(PyObject *args)
|
||||
|
||||
PyObject* TopoShapeFacePy::makeOffset(PyObject *args)
|
||||
{
|
||||
#ifdef FC_USE_TNP_FIX
|
||||
Py::Dict dict;
|
||||
return TopoShapePy::makeOffset2D(args, dict.ptr());
|
||||
#else
|
||||
double dist;
|
||||
if (!PyArg_ParseTuple(args, "d",&dist))
|
||||
return nullptr;
|
||||
auto f = getTopoDSFace(this);
|
||||
BRepBuilderAPI_FindPlane findPlane(f);
|
||||
if (!findPlane.Found()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "No planar face");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BRepOffsetAPI_MakeOffset mkOffset(f);
|
||||
mkOffset.Perform(dist);
|
||||
|
||||
return new TopoShapePy(new TopoShape(mkOffset.Shape()));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -455,61 +404,7 @@ evolve = spine.makeEvolved(Profile=profile, Join=PartEnums.JoinType.Arc)
|
||||
*/
|
||||
PyObject* TopoShapeFacePy::makeEvolved(PyObject *args, PyObject *kwds)
|
||||
{
|
||||
#ifdef FC_USE_TNP_FIX
|
||||
return TopoShapePy::makeEvolved(args, kwds);
|
||||
#else
|
||||
PyObject* Profile;
|
||||
PyObject* AxeProf = Py_True;
|
||||
PyObject* Solid = Py_False;
|
||||
PyObject* ProfOnSpine = Py_False;
|
||||
int JoinType = int(GeomAbs_Arc);
|
||||
double Tolerance = 0.0000001;
|
||||
|
||||
static const std::array<const char *, 7> kwds_evolve{"Profile", "Join", "AxeProf", "Solid", "ProfOnSpine",
|
||||
"Tolerance", nullptr};
|
||||
if (!Base::Wrapped_ParseTupleAndKeywords(args, kwds, "O!|iO!O!O!d", kwds_evolve,
|
||||
&TopoShapeWirePy::Type, &Profile, &JoinType,
|
||||
&PyBool_Type, &AxeProf, &PyBool_Type, &Solid,
|
||||
&PyBool_Type, &ProfOnSpine, &Tolerance)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const TopoDS_Face& spine = TopoDS::Face(getTopoShapePtr()->getShape());
|
||||
BRepBuilderAPI_FindPlane findPlane(spine);
|
||||
if (!findPlane.Found()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "No planar face");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const TopoDS_Wire& profile = TopoDS::Wire(static_cast<TopoShapeWirePy*>(Profile)->getTopoShapePtr()->getShape());
|
||||
|
||||
GeomAbs_JoinType joinType;
|
||||
switch (JoinType) {
|
||||
case GeomAbs_Tangent:
|
||||
joinType = GeomAbs_Tangent;
|
||||
break;
|
||||
case GeomAbs_Intersection:
|
||||
joinType = GeomAbs_Intersection;
|
||||
break;
|
||||
default:
|
||||
joinType = GeomAbs_Arc;
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
BRepOffsetAPI_MakeEvolved evolved(spine, profile, joinType,
|
||||
Base::asBoolean(AxeProf),
|
||||
Base::asBoolean(Solid),
|
||||
Base::asBoolean(ProfOnSpine),
|
||||
Tolerance);
|
||||
TopoDS_Shape shape = evolved.Shape();
|
||||
return Py::new_reference_to(shape2pyshape(shape));
|
||||
}
|
||||
catch (Standard_Failure& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.GetMessageString());
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PyObject* TopoShapeFacePy::valueAt(PyObject *args)
|
||||
|
||||
Reference in New Issue
Block a user