本文整理汇总了C++中MeshObject::getSegment方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshObject::getSegment方法的具体用法?C++ MeshObject::getSegment怎么用?C++ MeshObject::getSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshObject
的用法示例。
在下文中一共展示了MeshObject::getSegment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
static PyObject * importer(PyObject *self, PyObject *args)
{
char* Name;
char* DocName=0;
if (!PyArg_ParseTuple(args, "et|s","utf-8",&Name,&DocName))
return NULL;
std::string EncodedName = std::string(Name);
PyMem_Free(Name);
PY_TRY {
App::Document *pcDoc = 0;
if (DocName)
pcDoc = App::GetApplication().getDocument(DocName);
else
pcDoc = App::GetApplication().getActiveDocument();
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument(DocName);
}
MeshObject mesh;
if (mesh.load(EncodedName.c_str())) {
Base::FileInfo file(EncodedName.c_str());
unsigned long segmct = mesh.countSegments();
if (segmct > 1) {
for (unsigned long i=0; i<segmct; i++) {
std::auto_ptr<MeshObject> segm(mesh.meshFromSegment(mesh.getSegment(i).getIndices()));
Mesh::Feature *pcFeature = static_cast<Mesh::Feature *>
(pcDoc->addObject("Mesh::Feature", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->Mesh.swapMesh(*segm);
pcFeature->purgeTouched();
}
}
else {
Mesh::Feature *pcFeature = static_cast<Mesh::Feature *>
(pcDoc->addObject("Mesh::Feature", file.fileNamePure().c_str()));
pcFeature->Label.setValue(file.fileNamePure().c_str());
pcFeature->Mesh.swapMesh(mesh);
pcFeature->purgeTouched();
}
}
} PY_CATCH;
Py_Return;
}