Ask Your Question
0

Automatic export from OUT to PDF

asked 2015-05-14 02:17:01 -0500

Cao Huy gravatar image

Hi, folks,

I am trying to export PDF from OUT file, automatically. Everything works well, ecxept the pssplot.dragdropplotdata command. It seems the command didn't drop any thing in the plot window, which it's supposed to do.

Below here is my piece of code:

#Import from xls
import xlrd 
import os,sys
import pssplot
dir = '''D:\Huy\Test3\\'''
xls_file = dir+'Multiple_CCT.xls'       # xlsx is not acceptable
wb = xlrd.open_workbook(xls_file) 
sh = wb.sheet_by_index(0)
nr = sh.nrows 
pssplot.newplotbook()
for num in range(1,nr):
    #Read from Xls
    OUT= dir+str(int(sh.row_values(num)[0]))+"-"+ str(int(sh.row_values(num)[1]))+"-CCT0.0800s.out"
    NAME=str(int(sh.row_values(num)[0]))+"-"+ str(int(sh.row_values(num)[1]))+"-CCT0.0800s"
    pssplot.openchandatafile(OUT)
    pssplot.dragdropplotdata(NAME,r"""1 - ANGL 35201[G1 220.00]1""")
    pssplot.dragdropplotdata(NAME,r"""2 - ANGL 49502[G2 500.00]1""")
    pssplot.dragdropplotdata(NAME,r"""3 - ANGL 60501[G3 500.00]1""")
    pssplot.exportplot(dir+NAME+"_ANGLE.pdf",4)
edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2020-05-25 04:11:27 -0500

jfconroy gravatar image

I think a better approach is the following. 1) Get the data into Python from the *.out or *.outx file using the

dyntools.CHNF(outfilename)

command. 2) Use matplotlib to do the plots, which is much more flexible and has much more options than pssplot. 3) Save your graph as a pdf using matplotlib.

edit flag offensive delete link more
0

answered 2015-05-16 20:12:52 -0500

jconto gravatar image

updated 2020-05-19 18:04:57 -0500

I run within the PSSe GUI, v33, a similar code for a single plot and it did created the pdf as well as it showed the plot on the plot window.
My out file was 'GOP1.out' and my NAME variable was 'GOP1'. Also I made sure that the channel name exists in the OUT file.

The file plot1.zip stored at my Google drive public site contains the plot1.py script. Before run it in the PSSe GUI, update filenames and other variables for your case.

A better way to plot to pdf is with "channels", also stored at the same site.

edit flag offensive delete link more

Comments

I have applied the code recorded from PSSE but it the dragdrop command just doesn't work and I don't know why. Also, I have reinstall PSSE, but the problem remain still. :(

Cao Huy gravatar imageCao Huy ( 2015-05-17 20:26:47 -0500 )edit

Test the code I used. Check my updated answer.

jconto gravatar imagejconto ( 2015-05-18 19:06:09 -0500 )edit

Just throwing this out there, but sometimes the things act strange if you have too many out files open at once, or out files of the same name. Also there is really limited error output if your out file/channel strings are wrong. Does recording with a new PSSE window and only one out file work OK?

cajief gravatar imagecajief ( 2015-05-19 10:34:39 -0500 )edit

Sorry for my late reply. I have another project needed to be finished recently. Thank for your reply.

Cao Huy gravatar imageCao Huy ( 2015-05-27 04:59:55 -0500 )edit

@calief:: I afaird that's not the problem, cause I've tried recording and executing with only one file.

Cao Huy gravatar imageCao Huy ( 2015-05-27 05:01:27 -0500 )edit
0

answered 2020-05-19 01:56:37 -0500

Hazim gravatar image

Hi sir, i cant access your link fakepath\plot.py.gif. please help me sir

edit flag offensive delete link more

Comments

I updated the link!

jconto gravatar imagejconto ( 2020-05-19 18:04:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Stats

Asked: 2015-05-14 02:17:01 -0500

Seen: 1,371 times

Last updated: May 25