Personal tools
You are here: Home Forum Use export nodes of group in ascii format

export nodes of group in ascii format

Up to Use
  • export nodes of group in ascii format

    Posted by alzina at May 30. 2006
    Hello,

    In my model programed with python (TUI), i created a group of node. I would like  to  save  node numbers in array in order to export them (ascii format) to an another software. But i don't find functions (TUI) able  to make this operation.

    Thank you in advance,
    Arnaud
    • Re: export nodes of group in ascii format

      Posted by Daniel Weida at October 26. 2006
      alzina wrote:
      Hello,

      In my model programed with python (TUI), i created a group of node. I would like  to  save  node numbers in array in order to export them (ascii format) to an another software. But i don't find functions (TUI) able  to make this operation.

      Thank you in advance,
      Arnaud


      Hello Arnaud,
      if you want to export all nodes from the mesh with the name "my_mesh":

      ***********************
      mesh=my_mesh.GetMesh()
      fil=open('model.nodes','w')   
      for currentNode in range(mesh.NbNodes()):
          nodeCoords=mesh.GetNodeXYZ(currentNode+1)
          fil.write(('%d %14e %14e %14e\n') % (currentNode,nodeCoords[0],nodeCoords[1],nodeCoords[2]))
      fil.close()
      ***********************
      hope this will solve your problem
      Daniel Weida
      • Re: export nodes of group in ascii format

        Posted by JMB at November 13. 2006
        Daniel Weida wrote:
        alzina wrote:
        Hello,

        In my model programed with python (TUI), i created a group of node. I would like  to  save  node numbers in array in order to export them (ascii format) to an another software. But i don't find functions (TUI) able  to make this operation.

        Thank you in advance,
        Arnaud


        Hello Arnaud,
        if you want to export all nodes from the mesh with the name "my_mesh":

        ***********************
        mesh=my_mesh.GetMesh()
        fil=open('model.nodes','w')   
        for currentNode in range(mesh.NbNodes()):
            nodeCoords=mesh.GetNodeXYZ(currentNode+1)
            fil.write(('%d %14e %14e %14e\n') % (currentNode,nodeCoords[0],nodeCoords[1],nodeCoords[2]))
        fil.close()
        ***********************
        hope this will solve your problem
        Daniel Weida


        Hello,

        Since I am new to Python, is it possible to take this snippet of code and use it to export nodes to a file by running a version of the above script in a GUI mode?  Has anybody written such a script that I could use?

        Thanks
        JMB
Powered by Ploneboard
Document Actions