Mechanical Python Code example - write nodal information to .csv file
I have a model where several nodal named selections are defined:
etc. These named selection are named with the format "nodalns_fvf_XX".
I also have a .csv file, saved in the user_files directory of the project. This .csv file will be used to define a 3D look-up table in ACP. The "XX" value in the named selection's name will define the fiber volume fraction to be used on that node ("XX" in the NS name defines a FVF of 0.XX, ie "nodalns_fvf_50" should define a fiber volume fraction of 0.50 for all nodes in this named selection).
I want a script that will:
- loop through all named selections
- identify the named selections with the specific names (in this case, that their name contains "nodalns_fvf"
- for each node in these named selection, write to the csv file the (X,Y,Z) position of the node, and the fiber volume fraction to be used on that node.