NodeKeyword¶
This class is used to manage nodes of the KeyFile.
-
class
qd.cae.dyna.
NodeKeyword
¶ - Attributes
field_size
field_size
position
Notes —– Line index of the
Keyword
.
Methods
add_node
(id, x, y, z[, additional_card_data])- Parameters
align
Type of alignment for comment names and fields:
append_line
(line)- Parameters
get_card_valueByIndex
(iCard, iField[, …])- Parameters
get_card_valueByName
(name[, field_size])- Parameters
get_keyword_name
()- Returns
get_line
()- Parameters
get_lines
()- Returns
- Returns
- Returns
- Returns
has_long_fields
()- Returns
insert_line
(iLine, line)- Parameters
load
()- Raises
reformat_all
([skip_cards])- Parameters
reformat_field
(iCard, iField[, field_size, …])- Parameters
remove_line
(iLine)- Parameters
set_card_valueByDict
(fields[, field_size])- Parameters
set_card_valueByIndex
(iCard, iField, value)- Parameters
set_card_valueByName
(name, value[, field_size])- Parameters
set_line
(iLine, line)- Parameters
set_lines
(lines)- Parameters
switch_field_size
([skip_cards])- Parameters
-
add_node
(id, x, y, z, additional_card_data="")¶ - Parameters
- idint
id of the node
- xfloat
x-coordinate
- yfloat
y-coordinate
- zfloat
z-coordinate
- additional_card_datastr
further card data (see Notes section).
- Returns
- nodeNode
newly created part object
- Raises
- ValueError
if id does already exist in the database
Notes
The
additional_card_data
is a string appended to the keyword when writing the output file. The string is appended behind the coordinates.Examples
>>> # (optional) TC and RC fields for node >>> additional_data = " 0 0" >>> node = kw.add_node(123, 3.141, 5.926, 5.35, additional_data)
-
get_nNodes
()¶ - Returns
- nNodesint
number of nodes in keyword
Examples
>>> kw.get_nNodes() 26357
-
get_node_ids
()¶ - Returns
- node_idslist of int
isd of all nodes in the card
Examples
>>> kw.get_node_ids() [1, 2, 3, 4]
-
get_nodes
()¶ - Returns
- nodeslist of Node
all node objects in the keyword
Examples
>>> len(kw.get_nodes()) 26357
-
load
()¶ - Raises
- RuntimeError
if a parsing error occurs
Notes
This function parses the string data in the node object. The function is automatically triggered when reading an input file.
One may also assign new node data as a string to the keyword and trigger
load
manually.The string data will be erased during parsing and thus is removed from the string buffer.
Examples
>>> # The keyword has already one node >>> kw.get_nNodes() 1 >>> # lets see it >>> print(kw) *NODE $ some comment line $ id x y z 1 0. 0. 0. >>> # append new node data to the keyword >>> kw.append(" 2 0. 0. 0.") >>> # and load it >>> kw.load()