Skip to content

Conversation

@remibessard
Copy link
Contributor

@remibessard remibessard commented Dec 11, 2025

Being new in this process I will proobably mixup things...

Here is a small update of the MeshVTKLoader so that it can load polydata vtk files.
This was required for my work in PREMYOM to load OpenSim files.

I hope the compilation goes smoothly. If not, the next step will obviously be to correct these potential errors.

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@bakpaul bakpaul changed the title UPDATE MeshVTKLoader so that it can read polydata description of meshes [IO] Update MeshVTKLoader so that it can read polydata description of meshes Dec 11, 2025
@fredroy fredroy added pr: enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request labels Dec 11, 2025
@hugtalbot
Copy link
Contributor

Hi @remibessard
Just so that you know a new loader (more generic/versatile) has recently been implemented by @alxbilger : https://github.com/SofaDefrost/SOFA.VTK

@hugtalbot hugtalbot added this to the v26.06 milestone Dec 12, 2025
@remibessard
Copy link
Contributor Author

Ha, thx for sharing this information.
of course I did not know, and this was not there last summer when I needed it.
Moreover, I am happy not to add this dependency to VTK.

But I will be happy to use this code when it will replace the VTKLoader in SOFA, that's for sure !

Comment on lines +1333 to +1336
//// Process line
//std::cout << "Line: ";
//for (int v : values) std::cout << v << " ";
//std::cout << "\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//// Process line
//std::cout << "Line: ";
//for (int v : values) std::cout << v << " ";
//std::cout << "\n";

Comment on lines +1340 to +1342
//VTKDataIO<Vec<3, std::int32_t> >* d = new VTKDataIO<Vec<3, std::int32_t> >;
//d->read(polys2.str(), 0);
//BaseVTKDataIO* d = BaseVTKReader::newVTKDataIO(string(typeStrTemp));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//VTKDataIO<Vec<3, std::int32_t> >* d = new VTKDataIO<Vec<3, std::int32_t> >;
//d->read(polys2.str(), 0);
//BaseVTKDataIO* d = BaseVTKReader::newVTKDataIO(string(typeStrTemp));

Comment on lines +1347 to +1350
//BaseVTKDataIO* d = BaseVTKReader::newVTKDataIO(string(typeStrTemp));
//d->read(polys4.str(), 0);
//d->read(polys5.str(), 0);
//d->read(polys6.str(), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//BaseVTKDataIO* d = BaseVTKReader::newVTKDataIO(string(typeStrTemp));
//d->read(polys4.str(), 0);
//d->read(polys5.str(), 0);
//d->read(polys6.str(), 0);

Comment on lines +1482 to +1496
//if (currentNodeName.compare("PolyData") == 0)
//{
// dataArrayNode = node->FirstChildElement("DataArray");
// for (; dataArrayNode;
// dataArrayNode = dataArrayNode->NextSiblingElement("DataArray"))
// {
// dataArrayElement = dataArrayNode->ToElement();
// checkError(dataArrayElement);
// const string currentDataArrayName = string(dataArrayElement->Attribute("Name"));
// BaseVTKDataIO* celldata = loadDataArray(dataArrayElement, numberOfCells);
// checkError(celldata);
// celldata->name = currentDataArrayName;
// inputCellDataVector.push_back(celldata);
// }
//}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//if (currentNodeName.compare("PolyData") == 0)
//{
// dataArrayNode = node->FirstChildElement("DataArray");
// for (; dataArrayNode;
// dataArrayNode = dataArrayNode->NextSiblingElement("DataArray"))
// {
// dataArrayElement = dataArrayNode->ToElement();
// checkError(dataArrayElement);
// const string currentDataArrayName = string(dataArrayElement->Attribute("Name"));
// BaseVTKDataIO* celldata = loadDataArray(dataArrayElement, numberOfCells);
// checkError(celldata);
// celldata->name = currentDataArrayName;
// inputCellDataVector.push_back(celldata);
// }
//}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: enhancement About a possible enhancement pr: status to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants