Page 1 of 1

Macro to copy and paste curve to same plot

Posted: Mon Dec 02, 2013 9:23 am
by rodgiles
Hi,

I'm trying to 'copy and paste' the data from curve 1 to a new curve in the same plot using a macro. The code I have is..

>
SelectCurve(1)
CopyText()
Paste()
>
But either nothing gets copied to the clipboard or DPlot crashes, I'm using version 2.3.4.3. What am I doing wrong?

Thanks,

Rod

Posted: Mon Dec 02, 2013 12:21 pm
by DPlotAdmin
What am I doing wrong?
I've no idea. I tried this just now and it worked fine. Can you save your graph as a DPlot file and send it to me?

Re: Macro to copy and paste curve to same plot

Posted: Tue Dec 03, 2013 4:11 am
by rodgiles
Hi,

I tried the code snippet with a test plot containing 4 points and it copied and pasted without problems. When I try with the actual data, it fails to copy. Could it be a problem using data copied from another plot file? If I copy the data to a new plot using the edit:Move/Copy Curves command, then either the SelectCurve(1) or CopyText() commands do not work (I can't tell where the Macro stops). There's nothing in the clipboard.

This is the complete code listing of the Macro I'm trying to create:

Code: Select all

EditOperateX("x/360+0.5")
SelectCurve(1)
CopyText()
Paste()
SelectCurve(2)
EditOperateX("x+1")
CombineCurves(1,2,1,0)
SelectCurve(1)
CopyText()
Paste()
SelectCurve(2)
EditOperateX("x+2")
CombineCurves(1,2,1,0)
SelectCurve(1)
CopyText()
Paste()
SelectCurve(2)
EditOperateX("x+4")
CombineCurves(1,2,1,0)
SelectCurve(1)
CopyText()
Paste()
SelectCurve(2)
EditOperateX("x+8")
CombineCurves(1,2,1,0)
FFTMethod(1)
SelectCurve(1)
FFT()
It's a simple code to create an FFT of a roundness plot. I'm using the EditOperate() and CombineCurves() commands to create 16 repeats of the original curve and then carry out an FFT to find the order components of the out of roundness. I have measurement points at 0.5 degree intervals, hence 721 points per dataset. Needless to say I have a large number of roundness datasets to process and I would like to use a macro to speed the process up.

Best Regards,

Rod

Posted: Tue Dec 03, 2013 1:19 pm
by DPlotAdmin
I threw together an example and used your macro and it all worked fine, up until the FFT() command - which did nothing. It failed because the points are not evenly-spaced (but it won't tell you that when running from a macro). You can easily confirm whether that's the problem by running your macro, then manually trying an FFT.

Posted: Thu Dec 05, 2013 6:58 pm
by DPlotAdmin
Any luck? News? Whatever?