0

Automatic export from OUT to PDF

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)
Cao Huy's avatar
173
Cao Huy
asked 2015-05-14 02:17:01 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

3 Answers

0

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

Hazim's avatar
1
Hazim
answered 2020-05-19 01:56:37 -0500
edit flag offensive 0 remove flag delete link

Comments

I updated the link!

jconto's avatar jconto (2020-05-19 18:04:37 -0500) edit
add a comment see more comments
0

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.

jfconroy's avatar
186
jfconroy
answered 2020-05-25 04:11:27 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

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.

jconto's avatar
2.9k
jconto
answered 2015-05-16 20:12:52 -0500, updated 2020-05-19 18:04:57 -0500
edit flag offensive 0 remove flag delete link

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's avatar Cao Huy (2015-05-17 20:26:47 -0500) edit

Test the code I used. Check my updated answer.

jconto's avatar jconto (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's avatar cajief (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's avatar Cao 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's avatar Cao Huy (2015-05-27 05:01:27 -0500) edit
add a comment see more comments

Your Answer

Login/Signup to Answer