model=BDF()
model.readBDF('my_model.bdf',xref=True)model.reject_cards
mesh = BDF(debug=True,log=None)
mesh.cardsToRead = set(['MPC', 'GRID'])
mesh.readBDF( 'mpc.bdf', includeDir=None, xref=False)
for mpc_id, mpc_list in mesh.mpcs.items():
for mpc_obj in mpc_list:
print (mpc_obj.__dict__)RBE3* 8621 444 123456
* .088208302855491 123 3 .077371001243591
* 123 4 234 .036704599857330
* 123 5 240 .003437699982896
* 123 6 246 .072630301117897
* 123 9 124 .060673501342535
* 123 10 235 .025742700323462
* 123 11 241 .001591900014318
* 123 12 247 .028526199981570
* 123 15 130 .022312900051474
* 123 16 236 .007842199876904
* 123 17 242 .056956101208925
* 123 125 .020848499611020 123
* 126 131 .006792999804019 123
* 132 .064821496605873 123 344
* .027657000347971 123 345 349
* .001845799968577 123 346 354
* .008852900005877 123 350
* ALPHA 1.0000000036-15
*Effectively if you omit definition of mesh.cardsToRead pyNastran tries to read all cards from your deck.
I usually prefer to control the input, therefore I define mesh.cardsToRead every time. But this is my personal approach.
In your case, simply delete this line, and it should work as you want it to.
from pyNastran.bdf.bdf import BDF
mesh = BDF(debug=True, log=None)# instantiates the class with the default set of cards# debug - prints messages# log - if you pass in a python logging object that will be used# instead of the dummy logger that is created internally
# mesh.cardsToRead = set(['RBE2','RBE3','CQUAD4'])# not required, but lets you limit the cards# if there's a problem with one
bdfFileIn="one_fastener_simple_r36_ds_101_nc.bdf"mesh.readBDF(bdfFileIn,includeDir=None,xref=False) # reads the bdf#includeDir lets you append path information onto the include files#xref=True links up nodes, elements, properties, materials to make it easier to reference data
# Print out some data from this input deck.items=len(mesh.elements)for i in range(1,items): if mesh.elements[i].type!=u'CQUAD4' and mesh.elements[i].type!=u'CBEAM': print mesh.elements[i] print mesh.elements[i].type--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.