Skip to content

[SofaPython3] Add in DataHelper dedicated to-string conversion from basedata #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

damienmarchal
Copy link
Contributor

In SofaPython it was possible do write:
node.createObject("MechanicalObejct", position=loader.position)
This was working as loader.position was returning the values of the data field.

In SofaPython3 ithis will fails as loader.position is not returning anymore the values but the data:
node.createObject("MechanicalObejct", position=loader.position)
  

Object creation is still using a systematic to-string conversion (see PR #45), so the data are converted to string using the "repr" operator which does not necesserly generate a sofa-compatible string.
When the object to convert is a BaseData... it is much better to rely on the getValueString() fonction which returns a string compatible with sofa.
 

…ata field to increase compatibility with SofaPython(2)
@fredroy fredroy merged commit 7be1b21 into sofa-framework:master Sep 23, 2021
@guparan guparan added this to the v21.12 milestone Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants