API Reference#

Direct Functions#

NaxToPy.OpenFiletoN2P(n2v_instance: N2ModelContent) N2PModelContent[source]#

Read a N2ModelContent object and transform it into a N2PModelContent object.

Parameters:

n2v_instance – N2ModelContent. Mandatory.

NaxToPy.envelope_list(*args: list) list[list][source]#

Function that generates the envelope of a cloud of points. Args could be DF or lists.

-args*: Lists as columns of the cloud of points: e = n2p.envelope([3,4,2,…], [6,2,7,…], …)

-arg: A single DataFrame: e = n2p.envelope(df)

Returns:

list[list]

Note

The column 0 is the solver element id when using DataFrame, but it is the position in the elements list when using lists!!! to know the solver id: get_elements()[index_0]

NaxToPy.envelope_ndarray(array2D: ndarray) ndarray[source]#

Function that generates the envelope of a cloud of points. Args must be a numpy.array. This function is faster than envelope_list.

Parameters:

array2D (ndarray) – 2D Array [n*m]. Each row is point of the cloud, so there are n points. Each column is a coordinate of the point, so it is an m dimensional space.

Returns:

ndarray

Note

The column 0 is the position in the elements list!!! to know the solver id: get_elements()[index_0]

NaxToPy.initialize(path: str, parallelprocessing: bool = False) N2PModelContent[source]#

Deprecated function. This funtion has been substituted by load_model()

NaxToPy.load_model(path: str, parallelprocessing: bool = True, file_type: Literal['InputFileNastran', 'InputFileAbaqus', 'Binary'] = None, dict_gen: dict = None, filter: Literal['ELEMENTS', 'PROPERTIES', 'PARTS', 'NODES'] = None, loadconnectors=True) N2PModelContent[source]#

Read an output result file in binary format from Nastran, Abaqus, Optistruct or Ansys and transform it into a N2PModelContent Object. It also can read models from input files in Nastran format.

Supports .op2, .xdb, .odb, .h5, .h3d and .rst file extensions read from a local filesystem or URL.

Supports Nastran Input Files (typically .bdf extension) and Abaqus Input File (typically .inp extension)

Parameters:
  • path – str. Mandatory.

  • parallelprocessing – bool. Optional. If true, the low libraries open the result files in several processes. It is slightly faster.

  • file_type – str. Optional. It specifies if it is Nastran input file (“InputFileNastran”), Abaqus input file (“InputFileAbaqus”) or binary result file (“Binary”).

  • filter – str. Optional. It specifies what to load in dict_gen (elements, properties, parts or nodes)

  • dict_gem – dict. Optional. Dictionary that represents what elements/properties/parts/nodes to load. For elements and nodes, the dictionary is in the form {Part ID (str): [Elements ID/Nodes ID]}. For parts or properties, the dictionary could simply be in the form {Part ID (str) / Property ID (str): []}.

Returns:

Instance with all the model data.

Return type:

N2PModelContent

Examples

>>> model1 = load_model(r"C:\MODELS\FEM\model1.dat")
>>> # file_type is not needed. It only helps the program and saves a checking
>>> model2 = load_model(r"C:\MODELS\FEM\model2.dat", file_type="InputFileNastran")
>>> # parallelprocessing is only aviable for Binary files. It is helpful in some big files.
>>> model3 = load_model(r"C:\MODELS\RESULTS\model1.op2", parallelprocessing=True)
>>> model4 = load_model(r"C:\MODELS\RESULTS\model2.xdb", file_type="Binary")
>>> model5 = load_model(r"C:\MODELS\RESULTS\model5.h3d")
>>> model6 = load_model(r"C:\MODELS\RESULTS\model6.odb", True, "Binary")

Contents#