SteveDoyle2/pyNastran

add_cbeam method handles g0/x differently than add_cbar

Closed this issue · 9 comments

When writing the card for a CBEAM, the orientation vector is not exported:

from pyNastran.bdf.bdf import BDF
nastran_model = BDF()
nastran_model.add_cbeam(1001, 1001, [1, 2], [0., 1., 0.], '')
nastran_model.write_bdf('output_test_cbeam.bdf', size=8)

The exported file looks like:

$pyNastran: version=msc
$pyNastran: punch=True
$pyNastran: encoding=utf-8
$pyNastran: nnodes=0
$pyNastran: nelements=1
$ELEMENTS
CBEAM       1001    1001       1       2

I would have expected to get:
CBEAM 1001 1001 1 2 0. 1. 0.

Am I doing something wrong ?

I tried with nastran_model.add_cbeam(1001, 1001, [1, 2], [0., 1., 0.]) first but I was getting an error because g0 was not defined as it is not optional, so I tried blanking it with '' but that might be overriding the vector, indeed. How am I supposed to write it in order to specify only the vector ?

My problem is that neither X nor g0 are optional, therefore I have to define a g0, and it always overrides X.
I am a beginner in python so I might be missing something obvious. How would you generate the line below ?
CBEAM 1001 1001 1 2 0. 1. 0.

Your first two lines return the same error I was getting :
TypeError: AddCards.add_cbeam() missing 1 required positional argument: 'g0'

The third one works, I will go with that. Thanks a lot !

I updated the CBEAM to have similar defaults as the CBAR on the add_card method.