1. Loading Models#
1.1 Basic Loading#
The model-loading process is the same regardless of the solver:
import NaxToPy as n2p
# Loading a Nastran Result File
path_op2 = r"C:\Data\models\subcase\subcase_17500.op2"
model_op2 = n2p.load_model(path_op2)
# Loading a Abaqus Result File
path_odb = r"C:\Data\models\bdf\abaqus_upgrade.odb"
model_odb = n2p.load_model(path_odb)
1.2 Advance Loading#
The mesh can be imported first, and then the results. Also filtering the mesh during the loading process is possible:
import NaxToPy as n2p
def main():
path_bdf = r"C:\Data\models\subcase\SUBCASE_17500.dat"
path_op2 = [
r"C:\Data\models\subcase\subcase_17500.op2",
r"C:\Data\models\subcase\subcase_17501.op2",
r"C:\Data\models\subcase\subcase_17502.op2",
r"C:\Data\models\subcase\subcase_17503.op2"
]
# # Load the model (only mesh as it is a bdf)
model_bdf = n2p.load_model(path_bdf)
# Load from the op2 the results
model_bdf.import_results_from_files(path_op2)
# Filtering the mesh by elements
elements = [i for i in range(1000)]
dict_elements: dict = {"0": elements}
model_filter_elements = n2p.load_model(path_op2[0], dict_gen=dict_elements, filter="ELEMENTS")
# Filtering the mesh by part
model_filter_elements = n2p.load_model(path_op2[0], dict_gen={"10": []}, filter="PART")
# Filtering the mesh by nodes
nodes = [i for i in range(1000)]
model_filter_elements = n2p.load_model(path_op2[0], dict_gen={"0": nodes}, filter="NODES")
# Filtering the mesh by properties
# Only elements with properties 2100, 2101, 2200, 2201 of superelement "0" are loaded
props = {"0": [2100, 2101, 2200, 2201]}
if __name__ == "__main__":
main()
For abaqus is the same:
import NaxToPy as n2p
path_inp = r"C:\Data\models\abq\abaqus.inp"
path_odb = r"C:\Data\models\bdf\abaqus_upgrade.odb"
# Load the model (only mesh as it is a inp). File type is optional but recommended
model_inp = n2p.load_model(path_inp, file_type="InputFileAbaqus")
# Load the model (mesh and results)
model_odb = n2p.load_model(path_odb)
# Load from the odb the results
model_inp.import_results_from_files([path_odb])
# Load only two parts of the model
model_filtered = n2p.load_model(path_odb, dict_gen={"FRAME-1":[1,2,3,], "SKIN-1":[]}, filter="ELEMENTS")
For Ansys, Optistruct or other Nastran Result Files is the same too:
import NaxToPy as n2p
# Loading an Optistruct Result File
path_h3d = r"C:\Data\models\optistruct\model.h3d"
model_h3d = n2p.load_model(path_h3d)
# Loading an Ansys Result File
path_rst = r"C:\Data\models\ansys\model.rst"
model_rst = n2p.load_model(path_rst)
# Loading a Nastran Result File (h5 and xdb)
path_h5 = r"C:\Data\models\nastran\model.h5"
path_xdb = r"C:\Data\models\ansys\model.xdb"
model_h5 = n2p.load_model(path_h5)
model_xdb = n2p.load_model(path_xdb)
© 2025 Idaero Solutions S.L.
All rights reserved. This document is licensed under the terms of the LICENSE of the NaxToPy package.