Base: refactoring of InventorBuilder

This commit is contained in:
wmayer
2022-11-29 13:28:00 +01:00
parent 6af8701a7e
commit cf3225b50f
5 changed files with 215 additions and 163 deletions

View File

@@ -558,7 +558,6 @@ void MeshObject::writeInventor(std::ostream& str, float creaseangle) const
builder.endPoints();
builder.addIndexedFaceSet(indices);
builder.endSeparator();
builder.close();
}
void MeshObject::addFacet(const MeshCore::MeshGeomFacet& facet)

View File

@@ -1047,6 +1047,7 @@ void TopoShape::exportFaceSet(double dev, double ca,
std::ostream& str) const
{
Base::InventorBuilder builder(str);
builder.beginSeparator();
TopExp_Explorer ex;
std::size_t numFaces = 0;
for (ex.Init(this->_Shape, TopAbs_FACE); ex.More(); ex.Next()) {
@@ -1100,11 +1101,13 @@ void TopoShape::exportFaceSet(double dev, double ca,
builder.addIndexedFaceSet(indices);
builder.endSeparator();
}
builder.endSeparator();
}
void TopoShape::exportLineSet(std::ostream& str) const
{
Base::InventorBuilder builder(str);
builder.beginSeparator();
// get a indexed map of edges
TopTools_IndexedMapOfShape M;
TopExp::MapShapes(this->_Shape, TopAbs_EDGE, M);
@@ -1137,6 +1140,8 @@ void TopoShape::exportLineSet(std::ostream& str) const
drawStyle.lineWidth = 2.0F;
builder.addLineSet(vertices, drawStyle, Base::ColorRGB{0, 0, 0});
}
builder.endSeparator();
}
Base::BoundBox3d TopoShape::getBoundBox() const

View File

@@ -125,13 +125,14 @@ PyObject* PointsPy::writeInventor(PyObject * args)
std::stringstream result;
Base::InventorBuilder builder(result);
builder.beginSeparator();
builder.beginPoints();
PointKernel* kernel = getPointKernelPtr();
for (Points::PointKernel::const_iterator it = kernel->begin(); it != kernel->end(); ++it)
builder.addPoint(Base::convertTo<Base::Vector3f>(*it));
builder.endPoints();
builder.addPointSet();
builder.close();
builder.endSeparator();
return Py::new_reference_to(Py::String(result.str()));
}