NaxToPy package

Subpackages

Module contents

class NaxToPy.N2PLog

Bases: ABC

Class prepared for the control of the program.

It uses the module logging to register the main instructions and data of the NaxToPy Package. It can’t be instanced.

Attributes:

LevelList

class Critical

Bases: object

Class with all the critical errors.

The critical are methods that do not return anything, they write in the log file and console the error. Optionally a raise Exception could be added. Always a sys.exit() should be executed at the end.

static C001(message)
static C100(path, error) None

Critical error raised when the model couldn’t be initialized.

static C101(error) None

Critical error raised when the mesh couldn’t be generated.

static C102(py_version) None

Critical Error raised when the current python version is not supported.

static C103() None

Critical Error raised when VizzerClasses.dll is not properly load.

static C104() None

Critical Error raised when the console argument in n2ptoexe is not a bool type.

static C105(directions) None

Critical Error raised when the argument abaqus version in n2ptoexe is wrong or not supported.

static C106() None

Critical Error raised when the pyinstaller is not installed and it couldn´t be downloaded.

static C107() None

Error raised when the NaxTo libraries couldn’t be found.

static C108(path) None

Error raised when the file couldn’t be found.

static C109(ver, comp_ver) None

Error raised when NaxTo is not installed.

static C110(ver, comp_ver) None

Error raised when there aren’t installed a compatible version of with minor changes.

static C111(ver) None

Error raised when there version of NaxTo is not found.

static C112() None

Error raised when there is an Elements safearray error in VizzerClasses (Vizzer Error: -1003). This error could happen when the memory of the processor tthat call the low level libraries has a leak (is not correctly erased). A solution may be change the initialize method to parallel.

static C200() None

Critical error raised when numpy couldn’t be installed.

static user(message: str) None

Method prepared to be called by the user for adding CRITICAL errors to the loggin.

Anyone who is using NaxToPy can write in the register their own CRITICAL error message. Use the following structure as a standard message (C + four digits + Body).

Args:

message: str

Example:

“CXXXX: BODY OF THE MESSAGE”

class Debug

Bases: object

Class with all the debug data.

The DXXX are methods that keep in the register the information in the debuggibg procces about the processes that the package is keeping. Use only in the debug stages.

static D100(instruction, timee) None

Method for timing the instructions during debug

static D101(path) None

Method that shows the location of the VizzerClasses library found

static D102() None

Method that shows if the property Program_Call of N2ModelContent was changed

static D103(parallel) None

Method that shows the parallel option set at low level

static user(message: str) None

Method prepared to be called by the user for adding debugs data to the loggin

Anyone who is using NaxToPy can write in the register their own debug message. Use the following structure as a standard message (D + four digits + Body).

Args:

message: str

Example:

“DXXXX: Body of the message”

class Error

Bases: object

Class with all the errors that can be expected.

They should be handeled by a try-exception clasule. The errors are method that do not return anything, they write in the log file and console the error.

static E101() None

Error raised when the NaxTo libraries couldn’t be found.

static E102() None

Error raised when the value to set the directory where the .log file is not a string.

static E103() None

Error raised when the value to set the file name of the .log is not a string.

static E104() None

Error raised when directory of the .log couldn’t be changed.

static E105() None

Error raised when the file name of the .log could’nt be changed.

static E106() None

Error raised when there is an error while closing the windows register after modifing.

static E107(levellist) None

Error raised when the register level is intended to change and the level is not one of the possible choices.

static E108() None

Error raised when the change of register level of the .log file fails.

static E109() None

Error raised when the change of register level of the console fails.

static E110(path) None

Error raised when the n2ptoexe tries to createa exe from a module that dont use NaxToPy.

static E111() None

Error raised when a file with an extension of a binary result file is intended to be loaded as nastran input text file

static E201(*args) None

Error raised when the id of the node is not in the node dictionary.

static E202(*args) None

Error raised when the id of the element is not in the element dictionary.

static E203(*args) None

Error raised when the id of the coordinate system is not in the coord dictionary.

static E204(*args) None

Error raised when the id of the connector is not in the coord dictionary.

static E205(*args) None

Error raised when the arguments are no recognize by the function.

static E206(arg) None

Error raised when the component don’t have any results.

static E207(arg) None

Error raised when there is not any Increment with the ID specified.

static E208() None

Error raised when there is not any result. Some arguments may be the problem.

static E209(name) None

Error raised when there is not ID for the property (Abaqus don’t use ids for properties).

static E210(name) None

Error raised when there is not PartID for the property (Abaqus don’t use ids for properties).

static E211() None

Error raised when the increment asked is not an id(int) or a name(str).

static E212(id) None

Error raised when the increment asked is found.

static E213(name) None

Error raised when the result asked is found.

static E214() None

Error raised when the result asked is not name(str).

static E215(name) None

Error raised when the component asked is not found.

static E216() None

Error raised when the component asked is not name(str).

static E217(name) None

Error raised when the derived component asked is not found.

static E218() None

Error raised when the sections asked in the get_array function.

static E219() None

Error raised when the component selected is not transformable.

static E220() None

Error raised when there is an error during the processing of the output coord system.

static E221(arg) None

Error raised when the id of the load case is not found.

static E222(arg) None

Error raised when the NAME of the load case is not found.

static E223() None

Error raised when the get element need the part and not only the id.

static E224() None

Error raised when the get nodes need the part and not only the id.

static E225() None

Error raised when the get connectors need the part and not only the id.

static E226() None

Error raised when ABD matrix is not invertible.

static E227(rep_id) None

Error raised when there is a repeated ID in the properties

static E300(args) None

Error raised when the program fail to save the model (as a N2PModelContent object).

static E301(args) None

Error raised when the extension of the file path that is intended to save is wrong.

static E302(args) None

Error raised when the program faile to load the model (as a N2PModelContent object) from a .N2P file.

static E303(args) None

Error raised when the extension of the file path that is intended to load is wrong.

static E304() None

Error raised when NaxToPy.ico is not found.

static E305() None

Error raised when the length of the columns of the cloud of points don’t macht in N2PEnvelope.

static E306() None

Error raised when the arguments of envelope are not valid.

static E307() None

Error raised when the dataframe of envelope has NaN values.

static E308() None

Error raised when qhull library fails (wrong inputs, coplanar points, etc).

static E309() None

Error raised when qhull library fails (wrong inputs, coplanar points, etc).

static E310() None

Error raised when the inputs list(tuple(LC, Incr)) for getting results for LC and Incr are wrong.

static E400() None

Error raised when the atttribute of a N2PCard is intended to change and the new value lenght don’t match with the previous.

static user(message: str) None

Method prepared to be called by the user for adding errors to the loggin

This anyone who is using NaxToPy can write in the register their own error message. Use the following structure as a standard message (E + four digits + Body).

Args:

message: str

Example:

“EXXXX: BODY OF THE MESSAGE”

class Info

Bases: object

Class with all the information data. The IXXX are methods that keep in the register the information about the processes that the package is keeping.

static I101(vizzer_libs) None

Information that show that the NaxTo libraries were correctly found at vizzer_libs.

static I102(value) None
static I103(value) None
static I104() None
static I105() None

Information given when the register is modified correctly.

static I106(register, key_version) None

Information given when the register is modified correctly.

static I107() None

Information given when the program is called from a .exe file.

static I108() None

Information given when the program use the develover version of VizzerClasses.

static I109() None

Information given when the VizzerClasses library is load correctly.

static I110(path) None

Information given when the file .N2P is saved correctly.

static I111(path) None

Information given when the result file is initialize correctly.

static I112() None

Information given when the result the mesh is build correctly.

static I200() None

Information given when the NaxToPy.ico is found correctly.

static I201(file) None

Information given when the .exe file built with n2ptoexe() is correctly created.

static I202(id) None

Information given when the .exe file built with n2ptoexe() is correctly created.

static I203() None

Information given when the module N2PEnvelope is executing.

static user(message) None

Method prepared to be used by the user so anyone who is using NaxToPy can write in the register their own information message. Use the following structure as a standard message (I + four digits + Body).

“IXXXX: Body of the message”

class property LevelList: list[str]

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

class Warning

Bases: object

Class with all the warnings. The WXXX are methods that keep in the register the warnings that might be revised. They don’t affect directly to the correct working of the package.

static W100() None

Warning raised when numpy is not insatlled and it will be installed using pip

static W101() None

Warning raised when the register level of the .log file is intended to change, as it could make more difficult to track errors

static W200() None

Warning raised when the executable file is build without the icon

static W201() None

Warning raised when the AbaqusVersion is asked but the solver is not Abaqus

static W202() None

Warning raised when the number of elements don’t match with the size of the results

static W203(key) None

Warning raised when there are two connectors with the same id. So they are saved in the connector dict as a list.

static W204() None

Warning raised when there is no Model Data from an Input File.

static W205() None

Warning raised when there the Deprecated function “Initialize” is called.

static W300() None

Warning raised when there are more dimensions than points in n2p.envelope

static user(message) None

Method prepared to be used by the user so anyone who is using NaxToPy can write in the register their own warning message. Use the following structure as a standard message (W + four digits + Body).

“WXXXX: Body of the message”

classmethod activate_log() None
clv = 'WARNING'
classmethod deactivate_log() None
flv = 'INFO'
classmethod get_directory() str
classmethod get_file_name() str
classmethod set_console_level(clv) None

Method to set a different level for console register. The default level is “WARNING”. Only The level register and higher will be printed in the console. The possible levels are:

“DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”.

classmethod set_directory(value) None
classmethod set_file_level(flv) None

Method to set a different level for the file .log of the register. The default level is “INFO”. Only The level register and higher will be printed in the .log file. Higher levels could make more difficult to track errors. The possible levels are:

“DEBUG”, “INFO”, “WARNING”, “ERROR”, “CRITICAL”.

classmethod set_file_name(value: str) None
NaxToPy.envelope_list(*args: list) list

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)

Return:

list[list] or DataFrame

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

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

Args:

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.

Return:

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

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

NaxToPy.load_model(path: str, parallelprocessing: bool = False, file_type: str | None = None) N2PModelContent

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)

Args:

path: str 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”) or binary result file (“Binary”).

Returns:

model: N2PModelContent

NaxToPy.n2ptoexe(path: str, console: bool = True, solver: str = 'ALL', abaqusversion: list[str] | None = None) None

Function that creates .exe files of programs that use NaxToPy

Args:

path: str -> path of the module that will be used to create the .exe file

console: bool -> If True (Default), the .exe will opne a console of python.

If False, the .exe will not open any python console.

solver: srt | list[str] -> Default=”ALL” Solver or list of solvers that the module will work with.

Posible solvers are: “NASTRAN”, “ABAQUS”, “ANSYS”, “OPTISTRUCT”

abaqusversion: str | list[srt] -> Default=’2022’. Only when “ABAQUS” is selected a str or a list of

ABAQUS version are aviable. Posible abaqus versions: [‘2016’, ‘2017’, ‘2018’, ‘2019’, ‘2020’, ‘2021’, ‘2022’, ‘6.11’, ‘6.12’, ‘6.13’, ‘6.14’]