×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Combining multiple XY reports into excel worksheet

Combining multiple XY reports into excel worksheet

Combining multiple XY reports into excel worksheet

(OP)
Hello All

I am using a python script to post-process some data from a pipe span analysis using Abaqus 2016.

After I run the analysis, I submit a python script to extract multiple mode shapes of pipe vibrations based on the number of frequencies the user inputs. In the script I generate an XY report for every frame after extracting the desired field output (each frame represents a mode shape).

CODE --> python

x0= session.xyDataObjects['IL-'+str(FrameCount)]
session.xyReportOptions.setValues(numDigits=5)
session.writeXYReport(fileName='IL-'+str(FrameCount)+'.xls', appendMode=OFF, xyData=(x0, )) 

The FrameCount variable is a counter.

With the current script a lot of excel sheets are generated and the user has to manually look into each one.

Is it possible to merge all the data in excel such that there is only 1 column representing the X values (pipe length) and multiple columns representing the different Y-values (displacements)?

Thank you

RE: Combining multiple XY reports into excel worksheet

Hi
Make you own report by script and save it in one file

RE: Combining multiple XY reports into excel worksheet

(OP)
Hello

Can you explain a little more what you mean?

If I save all the generated XY plots in 1 report or excel worksheet, the X values are repeated because they do not change. I want to have only 1 set of X values for multiple Y values.

RE: Combining multiple XY reports into excel worksheet

Hello
I mean that you can get all data you need from odb and save them in array,after this you can save array to excel file

RE: Combining multiple XY reports into excel worksheet

For a good sugestion it is necessary to know more about the problem.

You have one xy-plot per result frame, right? What data is on the two axis of that plot and how are the xy data generated?
What is the final goal - what do you want to have at the end in excel?

RE: Combining multiple XY reports into excel worksheet

(OP)
Thanks for the reply Mustaine3.

For this case. I have 2 xy-plots per result frame (x-coordinate vs. displacement) and (x-coordinate vs. contact pressure). That means for every result frame, I am having 2 output i.e. if I have 40 frames, the script will output 80 excel files. The x values for all the frame outputs of a certain xy-plot are the same (x-ccordinate) but the y values change.

The code section below is how I generate the data:

CODE --> python

pth = session.Path(name='Path-1', type=NODE_LIST, expression=(('PART-1-1', ('1:401:1', )), ))

FramesNumber = len(odb_dynamic_IL.steps.values()[2].frames)

for FrameCount in range(FramesNumber):
	session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(variableLabel='U', outputPosition=NODAL, refinement=(COMPONENT, 'U2'))
	session.viewports['Viewport: 1'].odbDisplay.setFrame(step=2, frame=FrameCount)
	session.XYDataFromPath(name='IL-'+str(FrameCount), path=pth, includeIntersections=False, shape=DEFORMED, labelType=X_COORDINATE)
	x0= session.xyDataObjects['IL-'+str(FrameCount)]
	session.xyReportOptions.setValues(numDigits=5)
	session.writeXYReport(fileName='IL-'+str(FrameCount)+'.xls', appendMode=OFF, xyData=(x0, )) 

The final goal is to have only 2 output excel files regardelss of the number of frames I have.

I just want to be able to view all the results for a specific field output in a single excel file where 1 column represents the x-coordinate and the other columns correspond to each frame's filed output.

I hope this clarified my question.

RE: Combining multiple XY reports into excel worksheet

Hi
Here attached I`m sending you my script which save history output of displacements to file. Hope this helps.

CODE --> python

from odbAccess import *
odb = openOdb(path='Job-0.odb')
steps = odb.steps	#Repository
flag = -1
Us = []
Uk = ['StepName']
for stepKey in steps.keys():
	flag += 1
	step = steps[stepKey]
	regions = step.historyRegions
	Ur = [stepKey]
	for regionKey in regions.keys():
		region = regions[regionKey]
		outputs = region.historyOutputs
		if 'U1' in outputs.keys():
			if flag == 0:
				Uk.append(regionKey)
			U1 = "{:.1f}".format(outputs['U1'].data[1][1])
			U2 = "{:.1f}".format(outputs['U2'].data[1][1])
			U3 = "{:.1f}".format(outputs['U3'].data[1][1])
			Ur.append(U1+','+U2+','+U3)
	if flag == 0:
		Us.append(Uk)
	Us.append(Ur)
rptfile = open('UTdata.rpt','w')
for line in Us:
	rptline = '\t'.join(line)+'\n'
	rptfile.writelines(rptline)
rptfile.close() 

RE: Combining multiple XY reports into excel worksheet

@Igor76
The path plots are not stored in the odb. They are created in A/CAE and session objects.


@A.Jalal
In your code you save each curve in x0. Just access those data and write in a way you want into a .csv file. Afterwards you just have to open that file in Excel.

Just look at x0 and you'll see that it is a simple list with a tuple for each data point.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources