Created
December 17, 2021 14:01
-
-
Save 338rajesh/cfcf400c231351b71c976ffe5d3b1511 to your computer and use it in GitHub Desktop.
To write nodal coordinates and element connectivity data of a part, to text files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This code writes nodal coordinates and mesh connectivity data of a part, to text file | |
""" | |
from abaqus import * | |
from abaqusConstants import * | |
import mesh | |
# ==================== INPUT ============ | |
node_data_file = r"C:\Users\admin\WorkOuts\ABAQUS_WD\nodal_data.txt" | |
ele_data_file = r"C:\Users\admin\WorkOuts\ABAQUS_WD\element_data.txt" | |
model_name = 'Model-1' | |
part_name = 'Part-1' | |
# ========================================= | |
Nodes = mdb.models[model_name].parts[part_name].nodes | |
Elements = mdb.models[model_name].parts[part_name].elements | |
with open(node_data_file, 'w') as fp: | |
for i in Nodes: | |
x, y, z = i.coordinates | |
fp.write("{0},\t{1},\t{2},\t{3}\n".format(i.label, x, y, z)) | |
# | |
with open(ele_data_file, 'w') as fp: | |
for i in Elements: | |
node_tags = i.connectivity | |
node_tags = ("".join([str(j)+",\t " for j in node_tags]))[:-2] | |
fp.write("{0},\t{1}\n".format(i.label, node_tags)) | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment