This example in Altair Exchange

Finally, I read how to write a script for HyperMesh in python. In this example, the script reads the coordinates of points from a cvs file.

import os
import hm
import hm.entities as e
from hwx import gui
import csv
model=hm.Model()
os.chdir(r"D:\projects\wordpress\ex431")
with open('ex431_coordinates.csv', mode ='r') as file:
  lines = csv.reader(file, quoting = csv.QUOTE_NONNUMERIC)
  for line in lines:
      nodeNew=e.Node(model)
      nodeNew.localcoordinates = line

It feels like the python code is translated into a tcl script and then executed in HyperMesh. Because HyperMesh continues to record executed commands in this form.

*createentity nodes
*setvalue nodes user_ids={3} 100217={10 0 0}
*createentity nodes
*setvalue nodes user_ids={4} 100217={9.98744 0.50104 0.10025}
*createentity nodes
*setvalue nodes user_ids={5} 100217={9.94979 1.00083 0.2005}
*createentity nodes
*setvalue nodes user_ids={6} 100217={9.88715 1.4981 0.30075}

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading