N2PNastranInputData#
- class NaxToPy.Core.Classes.N2PNastranInputData.N2PNastranInputData(dictcardscston2p: dict, inputfiledata)[source]#
Bases:
objectClass with the complete data of a MEF input file (text file).
Note
The property
N2PModelContent.ModelInputDatacan be aN2PNastranInputDataif the input file is from Nastran (.bdf) or Opstitruct (.fem), or aN2PAbaqusInputData(.inp) if is from Abaqus.Example
>>> model = n2p.load_model("my_nastran_input_file.bdf") >>> inputdata = model.ModelInputData # This is a N2PNastranInputData
- create_card(card_type: str, bdf_file: str, rawContent: str = None, superElemntId: int = 0) N2PCard[source]#
Method that creates a new card of the type specified. By default, the card is created empty, with small field format.
Example
>>> new_cbar = model.ModelInputData.create_card("CBAR", "C:\bdf\mesh\model.bdf") >>> # new_cbar is now a N2PCard object of type CBAR empty. You can set its properties: >>> new_cbar.EID = 1001 >>> new_cbar.PID = 2001 >>> new_cbar.GA = 10 >>> new_cbar.GB = 20 >>> new_cbar.X1 = 1.0 >>> new_cbar.X2 = 0.0 >>> new_cbar.X3 = 0.0
>>> # It is also possible to create a card with raw content and specifying the superelement id: >>> raw_content = "CBAR 1002 2001 30 40 0.0 1.0 0.0" >>> new_cbar2 = model.ModelInputData.create_card("CBAR", "C:\bdf\mesh\model.bdf", rawContent=raw_content, superElemntId=0)
- find_cards(superElements: int, category: Literal['GRID', 'ELEMENT', 'CONNECTOR', 'PROPERTY', 'MATERIAL', 'COORDINATESYSTEM', 'LOAD', 'CONSTRAINT'], cardTypes: list[str] = None, filters: dict[str, object] = None) list[N2PCard][source]#
Searches for cards based on specified criteria:
superElements (mandatory): integer number of 8 bits (1 byte)
category (mandatory): Element, property, material, etc
cardTypes (optional): Specific type of card: CQUAD4, PBEAM, COORD2R
- filters (optional): Each category has common fields. It is possible to filter acordinf to those fields.
GRID: “ID”, “CP”, “CD”, “PS”, “SEID”, “X1”, “X2”, “X3”
ELEMENT: “EID, “PID”, “NodeArray”
CONNECTOR:
PROPERTY: “PID”
MATERIAL: “MID”
COORDINATESYSTEM: “CoordinateSystemIds”, “ReferenceSystemId”
LOAD:
CONSTRAINT:
Example
>>> grids = model.ModelInputData.find_cards(0, "GRID") >>> cuads = model.ModelInputData.find_cards(0, "ELEMENT", ["CQUAD4"]) >>> pshell_3 = model.ModelInputData.find_cards(0, "PROPERTY", ["PSHELL"], {"PID": 3}) >>> grids_cp10 = model.ModelInputData.find_cards(0, "GRID", None, {"CP": 10})
- get_cards_by_field(fields: list[str], row: int = 0, col: int = 0) list[N2PCard][source]#
ATTENTION: Deprecated method in version 3.2.0. Use find_cards() instead.
- get_failed_cards() list[N2PCard][source]#
Method that returns a list with the N2PCard objects of the input FEM file that have not been mapped correctly.
- print_include_hierarchy() None[source]#
Function that prints in the console the hierarchy of includes of a Nastran input file.
- print_model_directory_structure() None[source]#
Function that prints in the console the directory structure of a Nastran input file.
- rebuild_file(folder: str) None[source]#
Method that writes the solver input file with the same file structure that was read in the folder is specified
- Parameters:
folder – str -> Path of the folder where the file or files will be written.
- property CaseControlInstructions: list[N2PInputDataNas]#
Executive Control Statements and Control Case Commands
- Type:
List with the instructions of the model. They are the commands above the BEGIN BULK
- property ExecutiveControlInstructions: list[N2PInputDataNas]#
Executive Control Statements and Control Case Commands
- Type:
List with the instructions of the model. They are the commands above the BEGIN BULK
- property GetAbsolutePathsOfBdfFiles: list[str]#
List with theabsolute file paths of all BDF files that compose this model
- property ListBulkDataCards: list[N2PCard]#
List with the N2PCard objects of the input FEM file. It has all bulk data cards of the model
- property ListInstructions: list[N2PInputDataNas]#
Executive Control Statements and Control Case Commands
- Type:
List with the instructions of the model. They are the commands above the BEGIN BULK
N2PInputDataNas#
- class NaxToPy.Core.Classes.N2PNastranInputData.N2PInputDataNas(inputdata)[source]#
Bases:
objectGeneral class for the information in an input file of Nastran
- last_status_message() None[source]#
Method that checks if the last operation on the model was successful. If not, it raises an error with the message of the last operation.
- property BdfFile: str#
- property BdfFilePath: str#
- property RawContent: str#
- property SectionInfo: object#