bdfInterface Package¶
addCard Module¶
- class pyNastran.bdf.bdfInterface.addCard.AddMethods[source]¶
Bases: object
- add_creep_material(material, allowOverwrites=False)[source]¶
Note
May be removed in the future. Are CREEP cards materials? They have an MID, but reference structural materials.
assign_type Module¶
Parses Nastran fields
- pyNastran.bdf.bdfInterface.assign_type._get_dtype(value)[source]¶
Get the type of the input value in a form that is clear.
Parameters: value – the value to get the type of
- pyNastran.bdf.bdfInterface.assign_type.blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.components(card, ifield, fieldname)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- pyNastran.bdf.bdfInterface.assign_type.components_or_blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.double(card, ifield, fieldname)[source]¶
Converts a field into a double
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- pyNastran.bdf.bdfInterface.assign_type.double_or_blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.double_or_string(card, ifield, fieldname)[source]¶
Converts a field into a double or a string
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- pyNastran.bdf.bdfInterface.assign_type.double_string_or_blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
Returns value: a double, string, or default value
Raises SyntaxError: if there is an invalid type
- pyNastran.bdf.bdfInterface.assign_type.field(card, ifield, fieldname)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- pyNastran.bdf.bdfInterface.assign_type.fields(f, card, fieldname, i, j=None)[source]¶
Todo
improve fieldname
- pyNastran.bdf.bdfInterface.assign_type.integer(card, ifield, fieldname)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- pyNastran.bdf.bdfInterface.assign_type.integer_double_or_blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.integer_double_or_string(card, ifield, fieldname)[source]¶
Converts a field into an integer, double or a string
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- pyNastran.bdf.bdfInterface.assign_type.integer_double_string_or_blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.integer_or_blank(card, ifield, fieldname, default=None)[source]¶
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.integer_or_double(card, ifield, fieldname)[source]¶
Converts a field into an integer or double
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
Returns value: the value with the proper type
Raises SyntaxError: if there’s an invalid type
- pyNastran.bdf.bdfInterface.assign_type.integer_or_string(card, ifield, fieldname)[source]¶
Converts a field into an integer or string
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.integer_string_or_blank(card, ifield, fieldname, default=None)[source]¶
Converts a field into an integer, string or sets the default using a blank value
Parameters: - card – BDF card as a list
- ifield – field number
- fieldname – name of field
- default – the default value for the field (default=None)
- pyNastran.bdf.bdfInterface.assign_type.interpret_value(value_raw, card='')[source]¶
Converts a value from nastran format into python format.
Parameters: - raw_value – a string representation of a value
- card –
???
Returns value: the Nastran reprentation of the value
BDF_Card Module¶
Defines the BDFCard class that is passed into the various Nastran cards.
- class pyNastran.bdf.bdfInterface.BDF_Card.BDFCard(card=None, debug=False)[source]¶
Bases: object
A BDFCard is a list that has a default value of None for fields out of range.
- field(i, default=None)[source]¶
Gets the ith field on the card
Parameters: - self – the object pointer
- i (integer) – the ith field on the card (following list notation)
- default – the default value for the field
Returns value: the value on the ith field
- fields(i=0, j=None, defaults=None)[source]¶
Gets multiple fields on the card
Parameters: - self – the object pointer
- i (integer >= 0) – the ith field on the card (following list notation)
- j (integer or None (default=end of card)) – the jth field on the card (None means till the end of the card)
- defaults – the default value for the field (as a list) len(defaults)=i-j-1
Returns value: the values on the ith-jth fields
bdf_writeMesh Module¶
crossReference Module¶
Links up the various cards in the BDF.
For example, with cross referencing...
>>> model = BDF()
>>> model.read_bdf(bdf_filename, xref=True)
>>> nid1 = 1
>>> node1 = model.nodes[nid1]
>>> node.nid
1
>>> node.xyz
[1., 2., 3.]
>>> node.Cid()
3
>>> node.cid
CORD2S, 3, 1, 0., 0., 0., 0., 0., 1.,
1., 0., 0.
# get the position in the global frame
>>> node.Position()
[4., 5., 6.]
# get the position with respect to another frame
>>> node.PositionWRT(model, cid=2)
[4., 5., 6.]
Without cross referencing...
>>> model = BDF()
>>> model.read_bdf(bdf_filename, xref=True)
>>> nid1 = 1
>>> node1 = model.nodes[nid1]
>>> node.nid
1
>>> node.xyz
[1., 2., 3.]
>>> node.Cid()
3
>>> node.cid
3
# get the position in the global frame
>>> node.Position()
Error!
Cross-referencing allows you to easily jump across cards and also helps with calculating things like position, area, and mass. The BDF is designed around the idea of cross-referencing, so it’s recommended that you use it.
- class pyNastran.bdf.bdfInterface.crossReference.XrefMesh[source]¶
Bases: object
Links up the various cards in the BDF.
The main BDF class defines all the parameters that are used.
- _cross_reference_coordinates()[source]¶
Links up all the coordinate cards to other coordinate cards and nodes
- _cross_reference_elements()[source]¶
Links the elements to nodes, properties (and materials depending on the card).
- _cross_reference_masses()[source]¶
Links the mass to nodes, properties (and materials depending on the card).
- _cross_reference_materials()[source]¶
Links the materials to materials (e.g. MAT1, CREEP) often this is a pass statement
- cross_reference(xref=True, xref_elements=True, xref_properties=True, xref_materials=True, xref_loads=True, xref_constraints=True, xref_aero=True)[source]¶
Links up all the cards to the cards they reference
Parameters: - xref – cross references the model (default=True)
- xref_element – set cross referencing of elements (default=True)
- xref_properties – set cross referencing of properties (default=True)
- xref_materials – set cross referencing of materials (default=True)
- xref_loads – set cross referencing of loads (default=True)
- xref_constraints – set cross referencing of constraints (default=True)
- xref_aero – set cross referencing of CAERO/SPLINEs (default=True)
To only cross-reference nodes:
model = BDF() model.read_bdf(bdf_filename, xref=False) model.cross_reference(xref=True, xref_loads=False, xref_constraints=False, xref_materials=False, xref_properties=False, xref_aero=False, xref_masses=False)
Warning
be careful if you call this method