0

Hi, there

I have the code (from Jice) using List below

targetlines=["*beam section,section=%s, elset=%s, material=%s",
                         "%s",
                         "%f, %f, %f"]

 resultlines=[targetlines[0] % (dResult['SEC'],section_type,mat_data),
                     targetlines[1] %  section_data,
                     targetlines[2] % (math.sin(float(dResult['ANG'])*math.pi/180),
                                               math.cos(float(dResult['ANG'])*math.pi/180),
                                               0)]

, which worked well

However when I modified it to

targetlines=["*element,type=b31, elset=%s",
                     "%s",
                     "*beam section,section=%s, elset=%s, material=%s",
                     "%s",
                     "%f, %f, %f"]

  resultlines=[targetlines[0] % dResult['SEC'],
                      targetlines[1] % (section_type,dResult['SEC'],mat_data),
                      targetlines[2] % line1b,
                       targetlines[3] % section_data,
                      targetlines[4] % (math.sin(float(dResult['ANG'])*math.pi/180),
                                               math.cos(float(dResult['ANG'])*math.pi/180),
                                               0)]

I got error below
"resultlines=[targetlines[0] % dResult,
TypeError: not all arguments converted during string formatting"

I cannot understand why as I already had value of dResult.

Could you please give some clue about it? Thank you a lot.

regards

ning

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by ning2009
0

you inverted targetlines[1] and targetlines[2]

Hi, Jice

I am too old to make codes. Have a nice weekend.

ning

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.