This commit adds getShape and setShape to TopoShape

This commit is contained in:
Wolfgang E. Sanyer
2016-08-02 15:59:39 -04:00
committed by wmayer
parent 5a30a43862
commit 7f4a437cc2
54 changed files with 400 additions and 372 deletions

View File

@@ -556,7 +556,7 @@ private:
Part::Feature *pcFeature = (Part::Feature *)pcDoc->addObject("Part::Feature", "Shape");
// copy the data
//TopoShape* shape = new MeshObject(*pShape->getTopoShapeObjectPtr());
pcFeature->Shape.setValue(pShape->getTopoShapePtr()->_Shape);
pcFeature->Shape.setValue(pShape->getTopoShapePtr()->getShape());
pcDoc->recompute();
return Py::None();
@@ -576,7 +576,7 @@ private:
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) {
const TopoDS_Shape& sh = static_cast<TopoShapePy*>((*it).ptr())->
getTopoShapePtr()->_Shape;
getTopoShapePtr()->getShape();
if (!sh.IsNull())
builder.Add(Comp, sh);
}
@@ -606,7 +606,7 @@ private:
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapeFacePy::Type))) {
const TopoDS_Shape& sh = static_cast<TopoShapeFacePy*>((*it).ptr())->
getTopoShapePtr()->_Shape;
getTopoShapePtr()->getShape();
if (!sh.IsNull())
builder.Add(shell, sh);
}
@@ -639,7 +639,7 @@ private:
try {
if (surf) {
const TopoDS_Shape& face = static_cast<TopoShapeFacePy*>(surf)->
getTopoShapePtr()->_Shape;
getTopoShapePtr()->getShape();
if (!face.IsNull() && face.ShapeType() == TopAbs_FACE) {
builder.LoadInitSurface(TopoDS::Face(face));
}
@@ -649,7 +649,7 @@ private:
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) {
const TopoDS_Shape& sh = static_cast<TopoShapePy*>((*it).ptr())->
getTopoShapePtr()->_Shape;
getTopoShapePtr()->getShape();
if (!sh.IsNull()) {
if (sh.ShapeType() == TopAbs_EDGE) {
builder.Add(TopoDS::Edge(sh), GeomAbs_C0);
@@ -694,7 +694,7 @@ private:
try {
const TopoDS_Shape& shape = static_cast<TopoShapePy*>(obj)
->getTopoShapePtr()->_Shape;
->getTopoShapePtr()->getShape();
//first, if we were given a compsolid, try making a solid out of it
TopExp_Explorer CSExp (shape, TopAbs_COMPSOLID);
TopoDS_CompSolid compsolid;
@@ -1226,7 +1226,7 @@ private:
&(Base::VectorPy::Type), &pDir)) {
throw Py::Exception();
}
const TopoDS_Shape& shape = static_cast<TopoShapePy*>(pCrv)->getTopoShapePtr()->_Shape;
const TopoDS_Shape& shape = static_cast<TopoShapePy*>(pCrv)->getTopoShapePtr()->getShape();
if (shape.IsNull()) {
throw Py::Exception(PartExceptionOCCError, "shape is empty");
}
@@ -1297,8 +1297,8 @@ private:
&(TopoShapePy::Type), &sh2))
throw Py::Exception();
const TopoDS_Shape& shape1 = static_cast<TopoShapePy*>(sh1)->getTopoShapePtr()->_Shape;
const TopoDS_Shape& shape2 = static_cast<TopoShapePy*>(sh2)->getTopoShapePtr()->_Shape;
const TopoDS_Shape& shape1 = static_cast<TopoShapePy*>(sh1)->getTopoShapePtr()->getShape();
const TopoDS_Shape& shape2 = static_cast<TopoShapePy*>(sh2)->getTopoShapePtr()->getShape();
try {
if (shape1.ShapeType() == TopAbs_EDGE && shape2.ShapeType() == TopAbs_EDGE) {
@@ -1350,7 +1350,7 @@ private:
cont = (int)GeomAbs_C0;
try {
const TopoDS_Shape& path_shape = static_cast<TopoShapePy*>(pshape)->getTopoShapePtr()->_Shape;
const TopoDS_Shape& path_shape = static_cast<TopoShapePy*>(pshape)->getTopoShapePtr()->getShape();
TopoShape myShape(path_shape);
TopoDS_Shape face = myShape.makeTube(radius, tolerance, cont, maxdegree, maxsegment);
return Py::asObject(new TopoShapeFacePy(new TopoShape(face)));
@@ -1373,8 +1373,8 @@ private:
throw Py::Exception();
try {
const TopoDS_Shape& path_shape = static_cast<TopoShapePy*>(path)->getTopoShapePtr()->_Shape;
const TopoDS_Shape& prof_shape = static_cast<TopoShapePy*>(profile)->getTopoShapePtr()->_Shape;
const TopoDS_Shape& path_shape = static_cast<TopoShapePy*>(path)->getTopoShapePtr()->getShape();
const TopoDS_Shape& prof_shape = static_cast<TopoShapePy*>(profile)->getTopoShapePtr()->getShape();
TopoShape myShape(path_shape);
TopoDS_Shape face = myShape.makeSweep(prof_shape, tolerance, fillMode);
@@ -1448,7 +1448,7 @@ private:
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
if (PyObject_TypeCheck((*it).ptr(), &(Part::TopoShapePy::Type))) {
const TopoDS_Shape& sh = static_cast<TopoShapePy*>((*it).ptr())->
getTopoShapePtr()->_Shape;
getTopoShapePtr()->getShape();
profiles.Append(sh);
}
}
@@ -1601,7 +1601,7 @@ private:
PyObject *object;
if (PyArg_ParseTuple(args.ptr(),"O!",&(Part::TopoShapePy::Type), &object)) {
TopoShape* ptr = static_cast<TopoShapePy*>(object)->getTopoShapePtr();
TopoDS_Shape shape = ptr->_Shape;
TopoDS_Shape shape = ptr->getShape();
if (!shape.IsNull()) {
TopAbs_ShapeEnum type = shape.ShapeType();
switch (type)
@@ -1647,7 +1647,7 @@ private:
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()->_Shape;
const TopoDS_Shape& sh = static_cast<Part::TopoShapePy*>(item)->getTopoShapePtr()->getShape();
if (sh.ShapeType() == TopAbs_EDGE)
edges.push_back(TopoDS::Edge(sh));
else {
@@ -1685,7 +1685,7 @@ private:
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()->_Shape;
const TopoDS_Shape& sh = static_cast<Part::TopoShapePy*>(item)->getTopoShapePtr()->getShape();
if (sh.ShapeType() == TopAbs_EDGE)
edges.push_back(TopoDS::Edge(sh));
else {
@@ -1713,7 +1713,7 @@ private:
try {
TopoDS_Shape* shape = new TopoDS_Shape();
(*shape) = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr()->_Shape;
(*shape) = static_cast<TopoShapePy*>(pcObj)->getTopoShapePtr()->getShape();
PyObject* proxy = 0;
proxy = Base::Interpreter().createSWIGPointerObj("OCC.TopoDS", "TopoDS_Shape *", (void*)shape, 1);
return Py::asObject(proxy);
@@ -1733,7 +1733,7 @@ private:
TopoShape* shape = new TopoShape();
Base::Interpreter().convertSWIGPointerObj("OCC.TopoDS","TopoDS_Shape *", proxy, &ptr, 0);
TopoDS_Shape* s = reinterpret_cast<TopoDS_Shape*>(ptr);
shape->_Shape = (*s);
shape->setShape(*s);
return Py::asObject(new TopoShapePy(shape));
}
catch (const Base::Exception& e) {