NaxToPy API Reference#
Direct Functions#
- class NaxToPy.N2PLog[source]#
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.
- LevelList#
- class Critical[source]#
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 C100(path, error) str [source]#
Critical error raised when the model couldn’t be initialized.
- static C102(py_version) str [source]#
Critical Error raised when the current python version is not supported.
- static C104() str [source]#
Critical Error raised when the console argument in n2ptoexe is not a bool type.
- static C105(directions) None [source]#
Critical Error raised when the argument abaqus version in n2ptoexe is wrong or not supported.
- static C106() str [source]#
Critical Error raised when the pyinstaller is not installed and it couldn´t be downloaded.
- static C110(ver, naxver) str [source]#
Error raised when there aren’t installed a compatible version of with minor changes.
- static C112() str [source]#
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 C113(lib, ver, listver) str [source]#
Error raised when the NaxToPy versions the dll is compatible with is not this one
- static C201() None [source]#
Critical error raised when the type of the argument of N2PAbaqusInputData.get_keywords_by_type is not a string.
- static user(message: str) None [source]#
Method prepared to be called by the user for adding CRITICAL errors to the loggin.
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).
- Parameters:
message – str
Example
“CXXXX: BODY OF THE MESSAGE”
- class Debug[source]#
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 D102() None [source]#
Method that shows if the property Program_Call of N2ModelContent was changed
- static D201(result_file) None [source]#
Message that shows that the results from a file were loaded correctly
- static D501(current_time, tinit) None [source]#
Information given for computation time of elastic modulus.
- static D502(current_time, tinit) None [source]#
Information given for computation time of set intersection
- static D503(current_time, tinit) None [source]#
Information given for computation time of fastener update
- static D603(current_time, tinit) None [source]#
Information given for fasteners attachments obtention time.
- static D604(current_time, tinit) None [source]#
Information given for fasteners whole calculation time.
- static D605(current_time, tinit) None [source]#
Information given for fasteners distance obtention time.
- static D606(current_time, tinit) None [source]#
Information given for fasteners force obtention time.
- static D607(current_time, tinit) None [source]#
Information given for fasteners bypass loads obtention time.
- static user(message: str) None [source]#
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).
- Parameters:
message – str
Example
“DXXXX: Body of the message”
- class Error[source]#
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 E102() None [source]#
Error raised when the value to set the directory where the .log file is not a string.
- static E103() None [source]#
Error raised when the value to set the file name of the .log is not a string.
- static E106() None [source]#
Error raised when there is an error while closing the windows register after modifing.
- static E107(levellist) None [source]#
Error raised when the register level is intended to change and the level is not one of the possible choices.
- static E110(path) None [source]#
Error raised when the n2ptoexe tries to createa exe from a module that dont use NaxToPy.
- static E111() str [source]#
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 [source]#
Error raised when the id of the node is not in the node dictionary.
- static E202(*args) None [source]#
Error raised when the id of the element is not in the element dictionary.
- static E203(*args) None [source]#
Error raised when the id of the coordinate system is not in the coord dictionary.
- static E204(*args) None [source]#
Error raised when the id of the connector is not in the coord dictionary.
- static E208() None [source]#
Error raised when there is not any result. Some arguments may be the problem.
- static E209(name) None [source]#
Error raised when there is not ID for the property (Abaqus don’t use ids for properties).
- static E210(name) None [source]#
Error raised when there is not PartID for the property (Abaqus don’t use ids for properties).
- static E211() None [source]#
Error raised when the increment asked is not an id(int) or a name(str).
- static E220() str [source]#
Error raised when there is an error during the processing of the output coord system.
- static E225() None [source]#
Error raised when the get connectors need the part and not only the id.
- static E228(formula, vz_msg) None [source]#
Error raised when the formula introduced for a new derived loadcase is wrong
- static E229(formula, vz_msg) None [source]#
Error raised when the formula introduced for a new envelope loadcase is wrong
- static E230(formula, vz_msg) None [source]#
Error raised when the formula introduced for a new derived component is wrong
- static E231() str [source]#
Error raised when the argument “where” of load_user_coord_sys_from_csv is not “NODES” or “ELEMENTS”
- static E237(aveSections, supported) str [source]#
Error when the aveSections option is not supported
- static E300(args) None [source]#
Error raised when the program fail to save the model (as a N2PModelContent object).
- static E301(args) None [source]#
Error raised when the extension of the file path that is intended to save is wrong.
- static E302(args) None [source]#
Error raised when the program faile to load the model (as a N2PModelContent object) from a .N2P file.
- static E303(args) None [source]#
Error raised when the extension of the file path that is intended to load is wrong.
- static E305() None [source]#
Error raised when the length of the columns of the cloud of points don’t macht in N2PEnvelope.
- static E308() None [source]#
Error raised when qhull library fails (wrong inputs, coplanar points, etc).
- static E309() None [source]#
Error raised when qhull library fails (wrong inputs, coplanar points, etc).
- static E310() None [source]#
Error raised when the inputs list(tuple(LC, Incr)) for getting results for LC and Incr are wrong.
- static E312(lc, result) None [source]#
Error raised when the components asked for the N2PReport are not found in the result of the loadcase
- static E313() None [source]#
Error raised when there is an error in the arguments, probably in the formulas.
- static E314() None [source]#
Error raised when there is an error generating the report in VizzerClasses.
- static E316() str [source]#
Error raised when the string used in N2PAbaqusInputData.get_keywords_by_type is not a valid one
- static E318() None [source]#
Error raised when the inputs components in get_result_by_LCs_Incr is not a string or a list of strings.
- static E319() None [source]#
Error raised when not all the inputs components are in N2PResult.Components
- static E400() None [source]#
Error raised when the atttribute of a N2PCard is intended to change and the new value lenght don’t match with the previous.
- static E500() None [source]#
Error raised when an element not found correctly when trying to create plates.
- static E503(bolt) None [source]#
Error raised when fastener is said to have the Head in a middle element1D.
- static E508(plate) None [source]#
Error raised when there is a problem with the geometry of the plate.
- static E510() None [source]#
Error raised when there is an error in the isoparametric transformation.
- static E512() None [source]#
Error raised when the number of components of the vector and the reference systems are not multiple of 3 in the rotation.
- static E518() None [source]#
Error raised when solver_id_list is not present but part_id is in get_joints(…)
- static E519() None [source]#
Error raised when part_id is not present but solver_id_list is in get_joints()
- static E522() None [source]#
Error raised when, in N2PGetFasteners, the get_distance or get_attachments method is used before the get_joints() one
- static E523() None [source]#
Error raised when, in N2PGetLoadFasteners, no N2PJoints have been imported
- static E524() None [source]#
Error raised when, in N2PGetLoadFasteners, the get_forces_joints() or get_bypass_joints() methods are used before the get_results_joints() one
- static E525(loadcase) None [source]#
Error raised when the loadcases attribute is not filled with integers
- static E529() None [source]#
Error raised when, in N2PGetLoadFasteners, the export_results() method is used before the get_forces_joints() one
- static E530() None [source]#
Error raised when, in N2PGetLoadFasteners, the export_results() method is used before the get_bypass_joints() one
- static E532(element) None [source]#
Error raised when one wants to determine if a point is in an element that is not supported.
- static E533(element) None [source]#
Error raised when one wants to project a point into an element with not enough nodes
- static E534() None [source]#
Error raised when, in N2PGetLoadFasteners, no result files have been imported
- static E536(attribute, instance) None [source]#
Error raised when an input (as a list) has no valid elements inside.
- static E537() None [source]#
Error raised when the first column of the dataset (ID Entity column) is not composed of integers.
- static E650() None [source]#
Error raised when trying to assign a non isotropic material to a isotropic one
- static E651() None [source]#
Error raised when trying to assign a non orthotropic material to a orthotropic one
- static E652() None [source]#
Error raised when trying to assign a wrong hardening to a plastic class
- static E656() None [source]#
Error raised when trying to assign a wrong N2PMaterial instance to a material subclass
- static E657() None [source]#
Error raised when trying to get a Plastic instance which is not assigned
- static E659() None [source]#
Error raised when trying to get an Allowable instance which is not assigned
- static E661(materialid) None [source]#
Error raised when trying to use the N2PNeuber module without assign a YieldStress to a material
- static E662(materialid) None [source]#
Error raised when trying to use the N2PNeuber module without assign a RO_exponent to a material
- static E670() None [source]#
Error raised when trying to get an Allowable instance which is not assigned
- static E672(*args) None [source]#
Error raised when the id of the material is not in the material dictionary.
- static E673(*args) None [source]#
Error raised when the id of the property is not in the property dictionary.
- static E700() None [source]#
Error raised when trying to write in a dataset that has different data types than the one in the data entry
- static E702(entityID) None [source]#
Error raised when, in a dataset, one tries to write a row whose entity ID is already in the dataset
- static E703() None [source]#
Error raised when dataset introduced in HDF5 is not an nparray or a string
- static E800() None [source]#
Error raised when a module (Failure Aanlysis) is initialized with a wrong model assignment.
- static E801() None [source]#
Error raised when a module (Failure Analysis) is initialized with a wrong Element list assignment.
- static E802() None [source]#
Error raised when a module (Failure Analysis) is initialized with a wrong LoadCase list assignment.
- static E803(criteria, criteria_dict: dict) None [source]#
Error raised when a Failure Criterion assigned by user is not supported by module computations.
- static E804() None [source]#
Error raised when a Failure Criterion analysis is trying to be launched and Material Instances have not their Allowable values assigned yet.
- static E805() None [source]#
Error raised when trying to initialize a Property class with a wrong N2PProperty / N2PMaterial instance / user input
- static E806() None [source]#
Error raised when trying to initialize a CompositeShell subclass with non-composite N2PProperty instance
- static E851(key) None [source]#
Error raised when key of IntegrationDistance is not a N2PElement instance
- static user(message: str) None [source]#
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).
- Parameters:
message – str
Example
“EXXXX: BODY OF THE MESSAGE”
- class Info[source]#
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 [source]#
Information that show that the NaxTo libraries were correctly found at vizzer_libs.
- static I106(register, key_version) None [source]#
Information given when the register is modified correctly.
- static I108() None [source]#
Information given when the program use the develover version of NaxToModel.
- static I113() None [source]#
Information given when the program use the compiled version of NaxToModel.
- static I201(file) None [source]#
Information given when the .exe file built with n2ptoexe() is correctly created.
- class property LevelList: list[str]#
Property that retuns the list with the message levels in the log
- class Warning[source]#
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 [source]#
Warning raised when numpy is not installed and it will be installed using pip
- static W101() None [source]#
Warning raised when the register level of the .log file is intended to change, as it could make more difficult to track errors
- static W103() None [source]#
Warning raised when the Windows Register is modified by NaxToPy: The Path value is deleted
- static W104(naxver) None [source]#
Warning raised when the version NaxTo that this NaxToPy version is prepared for is not found
- static W107(versions: list) None [source]#
The NaxToModel.dll was loaded successfully, but it may not be fully compatible.
- static W201() None [source]#
Warning raised when the AbaqusVersion is asked but the solver is not Abaqus
- static W202() None [source]#
Warning raised when the number of elements don’t match with the size of the results
- static W203(key) None [source]#
Warning raised when there are two connectors with the same id. So they are saved in the connector dict as a list.
- static W205() None [source]#
Warning raised when there the Deprecated function “Initialize” is called.
- static W206() None [source]#
Warning raised when there the Deprecated property “ActiveIncrement” is called.
- static W207() None [source]#
Warning raised when there the Deprecated class “N2PModelInputData” is called.
- static W208(coord) None [source]#
Asking for results in self defined coordinate system at the same time in antother option.
- static W209() None [source]#
An average variation parameter have been set when aveNodes value is not average (-3)
- static W300() None [source]#
Warning raised when there are more dimensions than points in n2p.envelope
- static W301(name) None [source]#
Warning raised when the name for the new derived load case already exist
- static W506(bolt) None [source]#
Warning raised when a fastener intersection with the plate is not found.
- static W507(bolt) None [source]#
Warning raised when different types of properties found in the same joined plate elements.
- static W508(bolt) None [source]#
Warning raised when direction of elements 1D wrt connected plates not consistent.
- static W509(bolt) None [source]#
Warning raised when different type of elements 1D in the same bolt.
- static W510(listids) None [source]#
Warning raised when a fastener has not a provided head position.
- static W521(lcID) None [source]#
Warning raised when a load case doesn’t have a complete set of results
- static W522() None [source]#
Warning raised when, in N2PGetLoadFasteners, the get_fasteners attribute is set while the model or list_joints attribute is also set
- static W523() None [source]#
Warning raised when, in N2PGetLoadFasteners, the model attribute is set while the get_fasteners attribute is also set
- static W524() None [source]#
Warning raised when, in N2PGetLoadFasteners, the list_joints attribute is set while the get_fasteners attribute is also set
- static W525() None [source]#
Warning raised when, in N2PGetLoadFasteners, the type_export attribute is not NAXTOPY, PAG ALTAIR
- static W526(parameter) None [source]#
Warning raised when the bypass parameters dictionary is not well defined
- static W528() None [source]#
Warning raised when, in N2PGetLoadFasteners, the export_precison attribute is not 4 or 8
- static W650() None [source]#
Warning raised when specific arguments have been introduce to the plastic class.
- static W651() None [source]#
Warning raised when a non ISOTROPIC/MAT1 asociated to the element has been chosen.
- static W700() None [source]#
Warning raised when a data entry does not have its compulsory information
- static W701(elementType) None [source]#
Warning raised when, while writing an HDF5, the element type is not element, corner or node.
- static W702() None [source]#
Error thrown when attempting to retrieve the material of a Beam General Section.
- static W800() None [source]#
Warning raised when, given a list of elements, not all the elements have a composite PropertyType associated.
- clv = 'WARNING'#
- flv = 'INFO'#
- classmethod get_directory() str [source]#
Method that returns the folder where the .log file is being saved
- classmethod set_console_level(clv: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) None [source]#
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: str) None [source]#
Method that sets the folder where the .log file must be saved
- Parameters:
value – str -> Path to the folder where the .log must be saved.
- classmethod set_file_level(flv: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']) None [source]#
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”.
- 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) 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:
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")
- NaxToPy.n2ptoexe(path: str, console: bool = True, solver: Literal['ALL', 'NASTRAN', 'ABAQUS', 'ANSYS', 'OPTISTRUCT'] = 'ALL', abaqusversion: list[Literal['2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '6.11', '6.12', '6.13', '6.14']] = None, splash: str = '', extra_packages: list[str] = None, extra_files: list[str] = None, hidden_imports: list[str] = None) None [source]#
Function that creates .exe files of programs that use NaxToPy
- Parameters:
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’]
splash – str -> Optional. Path to the splash image. If used, the user must introduce pyi_splash.close() at the beginning of the execution of the module. Import pyi_splash first. The splash image will appear during the .exe unpacking. Image should be png and smaller than 500x500 pixels.
extra_packages – list[str] -> If some packages are not imported correctly by the function, they can be added manually. An example of a package that usually fails is ‘sv_ttk’.
extra_files – list[str] -> Lis of path of extra dll, images or other files the user want to add the exe. The files will be saved in the ./bin directory inside the exe. To acces to the files use: path_file = os.path.join(sys._MEIPASS, r”binmylib.dll”)
Examples
>>> n2ptoexe(r"C:\Scripts\myscript1.py") >>> n2ptoexe(r"C:\Scripts\myscript2.py", console=False, solver="NASTRAN") >>> n2ptoexe(r"C:\Scripts\myscript3.py", console=True, solver="OPTISTRUCT", splash=r"C:\Scripts\mysplash.jpg") >>> n2ptoexe(r"C:\Scripts\myscript4.py", extra_packages=["sv_ttk"], extra_files=[r"C:\Scripts\icon.png"]) >>> n2ptoexe(r"C:\Scripts\myscript5.py", hidden_imports=["plyer.platforms.win.notification"])