bdfInterface Package

addCard Module

Inheritance diagram of pyNastran.bdf.bdfInterface.addCard

class pyNastran.bdf.bdfInterface.addCard.AddMethods[source]

Bases: object

add_AEFACT(aefact, allowOverwrites=False)[source]
add_AELIST(aelist)[source]
add_AEPARM(aeparam)[source]
add_AERO(aero)[source]
add_AEROS(aero)[source]
add_AESTAT(aestat)[source]
add_AESURF(aesurf)[source]
add_ASET(set_obj)[source]
add_BCRPARA(card, allowOverwrites=False)[source]
add_BCTADD(card, allowOverwrites=False)[source]
add_BCTPARA(card, allowOverwrites=False)[source]
add_BCTSET(card, allowOverwrites=False)[source]
add_BSET(set_obj)[source]
add_BSURF(card, allowOverwrites=False)[source]
add_BSURFS(card, allowOverwrites=False)[source]
add_CAERO(caero)[source]
add_CSET(set_obj)[source]
add_DAREA(darea, allowOverwrites=False)[source]
add_DCONSTR(dconstr)[source]
add_DDVAL(ddval)[source]
add_DEQATN(deqatn, allowOverwrites=False)[source]
add_DESVAR(desvar)[source]
add_DMI(dmi, allowOverwrites=False)[source]
add_DMIG(dmig, allowOverwrites=False)[source]
add_DMIJ(dmij, allowOverwrites=False)[source]
add_DMIJI(dmiji, allowOverwrites=False)[source]
add_DMIK(dmik, allowOverwrites=False)[source]
add_DRESP(dresp)[source]
add_DVMREL(dvmrel)[source]
add_DVPREL(dvprel)[source]
add_FLFACT(flfact)[source]
add_FLUTTER(flutter)[source]
add_FREQ(freq)[source]
add_GUST(gust)[source]
add_LSEQ(load)[source]
add_MKAERO(mkaero)[source]
add_NLPARM(nlparm)[source]
add_NLPCI(nlpci)[source]
add_PAERO(paero)[source]
add_PARAM(param, allowOverwrites=False)[source]
add_PBUSHT(prop, allowOverwrites=False)[source]
add_PDAMPT(prop, allowOverwrites=False)[source]
add_PELAST(prop, allowOverwrites=False)[source]
add_PHBDY(prop)[source]
add_QSET(set_obj)[source]
add_SESET(set_obj)[source]
add_SET(set_obj)[source]
add_SPLINE(spline)[source]
add_SPOINT(spoint)[source]
add_TRIM(trim, allowOverwrites=False)[source]
add_TSTEP(tstep, allowOverwrites=False)[source]
add_TSTEPNL(tstepnl, allowOverwrites=False)[source]
add_cmethod(cMethod, allowOverwrites=False)[source]
add_constraint(constraint)[source]
add_constraint_MPC(constraint)[source]
add_constraint_MPCADD(constraint)[source]
add_constraint_SPC(constraint)[source]
add_constraint_SPCADD(constraint)[source]
add_convection_property(prop)[source]
add_coord(coord, allowOverwrites=False)[source]
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.

add_damper(elem, allowOverwrites=False)[source]

Warning

can dampers have the same ID as a standard element?

add_dload(dload)[source]
add_dload_entry(dload)[source]
add_element(elem, allowOverwrites=False)[source]
add_hyperelastic_material(material, allowOverwrites=False)[source]
add_load(load)[source]
add_mass(mass, allowOverwrites=False)[source]
add_material_dependence(material, allowOverwrites=False)[source]
add_method(method, allowOverwrites=False)[source]
add_node(node, allowOverwrites=False)[source]
add_property(prop, allowOverwrites=False)[source]
add_property_mass(prop, allowOverwrites=False)[source]
add_random_table(table)[source]
add_rigid_element(elem, allowOverwrites=False)[source]
add_structural_material(material, allowOverwrites=False)[source]
add_suport(suport)[source]
add_table(table)[source]
add_thermal_BC(bc, key)[source]
add_thermal_element(elem)[source]

same as add_element at the moment...

add_thermal_load(load)[source]
add_thermal_material(material, allowOverwrites=False)[source]

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

pyNastran.bdf.bdfInterface.assign_type.string(card, ifield, fieldname)[source]

Converts a field into a string

Parameters:
  • card – BDF card as a list
  • ifield – field number
  • fieldname – name of field
pyNastran.bdf.bdfInterface.assign_type.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)

BDF_Card Module

Inheritance diagram of pyNastran.bdf.bdfInterface.BDF_Card

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

index(value)[source]
nFields()[source]

Gets how many fields are on the card

Parameters:self – the object pointer
Returns nfields:
 the number of fields on the card
pop()[source]

Pops the last value off

bdf_writeMesh Module

crossReference Module

Inheritance diagram of pyNastran.bdf.bdfInterface.crossReference

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_aero()[source]

Links up all the aero cards

_cross_reference_constraints()[source]

Links the SPCADD, SPC, SPCAX, SPCD, MPCADD, MPC cards.

_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_loads()[source]

Links the loads to nodes, coordinate systems, and other loads.

_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_nodes()[source]

Links the nodes to coordinate systems

_cross_reference_properties()[source]

Links the properties to materials

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

getCard Module