- This topic has 1 reply, 2 voices, and was last updated 3 years, 5 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Home › Forum › SofaPython3 › Using SofaPython3 › [SOLVED] Translating “include” object to SofaPython3
Tagged: SOFA_2012, Windows_10
Dear all,
sorry to bother you again.
I have some issues when using TriangleCollisionModel in my SOFA files. SphereCollisionModels are working. I have seen other posts in the forum which seem to have the same issue. changing back a version also did not do the job in my case.
As a remedy I want to translate 1000PR.scn (which is working) from xml to SofaPython3.
I do not know hot to translate the following line:
<include href="Objects/HexahedronSetTopology.xml" src="@../grid" drawHexa="1" />
I tried to use scn2python to translate it to SofaPython, but it crashes at this exact line.
Does anybody know hot to put this line to SofaPython3?
Thanks in advance,
Serkan
EDIT: I solved this issue by simply taking the contents of the file and paste them accordingly in SofaPython3 “notation”.
Hey Serkan,
Indeed, as you said in your edit, you just need to translate the content of “HexahedronSetTopology.xml” into python commands. Just for future readers that would come by this topic, what Serkan here found out is that the following xml lines:
<RegularGridTopology name="grid" min="0 0 0" max="5 5 20" n="5 5 20"/>
<include href="Objects/HexahedronSetTopology.xml" src="@../grid" drawHexa="1" />
is basically equivalent to
<RegularGridTopology name="grid" min="0 0 0" max="5 5 20" n="5 5 20" />
<Node name="Group">
<HexahedronSetTopologyContainer name="Container" src="@../grid" tags=" " />
<HexahedronSetTopologyModifier name="Modifier" />
<HexahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" />
</Node>
and would become the following in python:
root.addObject('RegularGridTopology', name='grid', min=[-7.5, -7.5, 0], max=[7.5, 7.5, 80], n=[9, 9, 21])
root.addObject('HexahedronSetTopologyContainer', name='Container', src='@grid')
root.addObject('HexahedronSetTopologyModifier', name='Modifier')
root.addObject('HexahedronSetGeometryAlgorithms', name='GeomAlgo', template='Vec3d')
J-N
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.