Author Topic: Surfer v. 14 has a broken script  (Read 8188 times)

wrigke

  • Professor
  • ****
  • Posts: 40
Surfer v. 14 has a broken script
« on: August 30, 2017, 07:41:49 AM »
When interfacing CalcImage with Surfer v. 14, an error ensues while trying to export images from CI to Surfer.  It appears to be a problem with the Surfer script.  Is there a fix?

Karen

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #1 on: August 30, 2017, 09:43:44 AM »
When interfacing CalcImage with Surfer v. 14, an error ensues while trying to export images from CI to Surfer.  It appears to be a problem with the Surfer script.  Is there a fix?

Hi Karen,
I sent your report to Golden Software a few days ago and they responded that this is a "known issue" with Surfer v. 14, and that they would be fixing it in a subsequent release. In the meantime they suggest a "workaround".

The problem is that this line in any of the CalcImage scripts fails with an error : ActiveX Automation: Object var is 'Nothing'

SurferImageMap.ColorScale.Selected = True

Golden Software support suggests the following steps:

1. After the script is created in CalcImage and it asks if you want to run the script automatically, click "No".

2. Then from the Start button find the Golden Software | Surfer program menu group and click the Scripter app menu (if you have both Grapher and Surfer installed be sure to click the Scripter menu associated with Surfer).

3. From Scripter click the File | Open menu and browse to the script file you just created in CalcImage.  I usually find the CalcImage project folder and sort by date and click the most recent .bas file in the folder.

4. Now scroll down and find all occurances of the following (problematic) line of code:

SurferImageMap.ColorScale.Selected = True

and place the cursor on that line and type F9 to set a breakpoint there.  There may be more than one place this occurs in the script depending on the specific output type.

5. Now click the Script | Run menu and allow the script to start running. When the script pauses at the breakpoint you placed:

6. Select the Color Relief <your grid file name here>.grd layer in the Contents window.

7. In the Properties window, on the General page, check the checkbox next to Show color scale.

8. In Scripter, click the maroon breakline circle to remove the breakline. Resume running the script by clicking Script | Run.

What a PITA I know, but Golden Software said as soon as they fix Surfer v. 14 they would let me know, and I will immediately post here letting everyone know they can update their Surfer v. 14.

john
« Last Edit: August 30, 2017, 11:09:17 AM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #2 on: August 31, 2017, 10:40:31 AM »
Hi Karen,
Golden Software reports that they fixed the issue you found in v. 14 of Surfer/Scripter.   Dang, they respond almost as fast as Probe Software!    :)

However, they cannot roll it out just yet for general release, but they gave me a patched version that you can grab from the PFE Dropbox.

If you (or anyone else with v. 14 of Surfer) needs this Surfer fix and you don't have access to the PFE Dropbox, just let me know.
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Anette von der Handt

  • Global Moderator
  • Professor
  • *****
  • Posts: 351
    • UMN Probelab
Re: Surfer v. 14 has a broken script
« Reply #3 on: August 31, 2017, 03:28:37 PM »
Hi,

just a heads up: I installed the patch and it worked fine for the polygon extraction (thumbs up).

I noticed that the output maps had "hill shading" enabled as well as the interpolated pixel option (both can be found under the "general" tab in the map properties). I will see if it has something to do with my preferences or if we need to modify the scripts but would be interested to see if other have it too.
Against the dark, a tall white fountain played.

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #4 on: September 01, 2017, 02:04:48 PM »
So Golden Software (Leslie McWhirter) says: "There are no image maps in Surfer 14, the image map has been renamed color relief map. The image map name is still supported via automation so old scripts work, but a color relief map is created when this object is invoked."

So that is why the shaded hill relief is now turned on by default.  As Anette pointed out, these can be turned off in the properties tab, but you could also add these lines to your existing scripts:

SurferImageMap.HillShading = False
SurferImageMap.InterpolatePixels = False

I will do this for the scripts distributed in the installer myself, so an update should fix the default scripts, but any customized scripts will need to be edited yourself.
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #5 on: September 05, 2017, 03:33:33 PM »
To help those with v. 14 of Surfer, I've attached below modified "partial" scripts which are used by CalcImage for creating quant/atomic/formula x-ray maps in Surfer.

You should copy all 5 scripts to your ProgramData\Probe Software\Probe for EPMA folder and overwrite the existing scripts- unless you have modfied the "custom" scripts yourself.  In that case you will want to edit your customized scripts by hand by inserting these lines of code just after the color palette (rainbow) is set:

' For compatibility with Surfer v. 14, turn off hill shading and interpolate pixels
If Val(Left$(SurferApp.Version, 2)) >= Val("14") Then
SurferImageMap.HillShading = False
SurferImageMap.InterpolatePixels = False
End If

I haven't modified the other scripts yet, but will get to these other scripts ASAP.  Or you could modify them yourself if you can't wait.
john
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #6 on: September 09, 2017, 09:49:09 PM »
The installer for the latest version (11.9.9) of Probe for EPMA should automatically update your existing CalcImage scripts so they are compatible with v. 14 of Surfer.

However, the installer will not update your "custom" scripts. So if you have modified the custom scripts, you'll need to edit your customized scripts as described in the post above.

If you haven't modified any of your CalcImage "custom" scripts, then simply download the zip file attached below and extract all the files to your C:\ProgramData\Probe Software\Probe for EPMA and overwrite all the scripts.

Even if you don't have version 14 of Surfer you should update your custom scripts in case you ever update Surfer in the future.  The updated CalcImage scripts are compatible with older versions of Surfer.
john
« Last Edit: December 11, 2017, 08:16:36 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Julien

  • Professor
  • ****
  • Posts: 83
  • The truth is out there...
    • Geoloweb - J. Allaz personal website
Re: Surfer v. 14 has a broken script
« Reply #7 on: December 11, 2017, 11:02:01 AM »
The same problem is occurring with Surfer 13. By default the HillShading option is activated. This can be solved by modifying the default Scripter script files in ProgramData\ProbeSoftware\Probe for EPMA\gridxy.BAS, polyxy.BAS, slicexy.BAS and stripxy1, 2 and 3.BAS and editing the following lines:

ORIGINAL

' For compatibility with Surfer v. 14, turn off hill shading and interpolate pixels
If Val(Left$(SurferApp.Version, 2)) >= Val("14") Then
SurferImageMap.HillShading = False
SurferImageMap.InterpolatePixels = False
End If

MODIFIED

' For compatibility with Surfer v. 13, turn off hill shading and interpolate pixels
If Val(Left$(SurferApp.Version, 2)) >= Val("13") Then
SurferImageMap.HillShading = False
SurferImageMap.InterpolatePixels = False
End If

Julien

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #8 on: December 11, 2017, 02:38:09 PM »
The same problem is occurring with Surfer 13. By default the HillShading option is activated. This can be solved by modifying the default Scripter script files in ProgramData\ProbeSoftware\Probe for EPMA\gridxy.BAS, polyxy.BAS, slicexy.BAS and stripxy1, 2 and 3.BAS and editing the following lines:

ORIGINAL

' For compatibility with Surfer v. 14, turn off hill shading and interpolate pixels
If Val(Left$(SurferApp.Version, 2)) >= Val("14") Then
SurferImageMap.HillShading = False
SurferImageMap.InterpolatePixels = False
End If

MODIFIED

' For compatibility with Surfer v. 13, turn off hill shading and interpolate pixels
If Val(Left$(SurferApp.Version, 2)) >= Val("13") Then
SurferImageMap.HillShading = False
SurferImageMap.InterpolatePixels = False
End If

Hi Julien,
I talked to Golden Software and sure enough you are correct.  They did add "hill shading" as a default option for image maps in version 13 of Surfer *before* they replaced the image map function in version 14 of Surfer.   I didn't know this because no one reported it until v. 14 (Karen Wright) and I just updated from v. 11 of Surfer to v. 15, so I missed the issue also.

So I will go ahead and modify all the scripts to use v. 13 instead of 14 for setting the "hill shading" feature off.  And again, the next PFE update will update your default scripts automatically, but the customized scripts will have to be updated or edited manually.

I'll attach a ZIP file of the modified custom script templates when they are ready to download.
john
« Last Edit: December 11, 2017, 06:50:30 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #9 on: December 11, 2017, 08:27:56 PM »
Hi Julien,
The latest PFE update will get you the other updated script templates for the Surfer 13 issue you reported, e.g., slice, poly, etc. Remember, you can also grab the edited custom scripts from the ZIP attached to this post (I just updated the attached ZIP file):

http://probesoftware.com/smf/index.php?topic=959.msg6260#msg6260

If you've previously edited your custom scripts yourself for other purposes, you'll want to edit them by hand (as you have already done for one script), for this "hill shading" issue (only because you have Surfer 13), based on your above post here:

http://probesoftware.com/smf/index.php?topic=959.msg6533#msg6533

Basically everyone should just update PFE and all will be well for those using Surfer v 13.  Older and newer versions of Surfer will not see this issue. The current version of Surfer is v. 15:

http://www.goldensoftware.com/products/surfer

They have a very nice web page...
john
« Last Edit: December 11, 2017, 08:31:38 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Dan R

  • Professor
  • ****
  • Posts: 82
    • GE Research Materials Characterization
Re: Surfer v. 14 has a broken script
« Reply #10 on: May 02, 2019, 06:32:08 AM »
I ran into a new script problem when i upgraded to Surfer 16. The following changes fix the script now:

               ' Load color spectrum depending on version number
               If Val(Left$(SurferApp.Version, 2)) <= Val("8.") Then
                  ImageMap.ColorMap.LoadFile(SurferApp.Path & "\Samples\Rainbow2.clr")
               ElseIf Val(Left$(SurferApp.Version, 2)) <= Val("15.") Then
                   ImageMap.ColorMap.LoadFile(SurferApp.Path & "\ColorScales\Rainbow2.clr")
               Else
                  ImageMap.ColorMap.LoadFile(SurferApp.Path & "\Samples\GE_Standard.clr")
               End If
      
               'For compatibility with Surfer v. 13, turn off hill shading and interpolate pixels
                  If Val(Left$(SurferApp.Version, 2)) >= Val("13") Then
                     ImageMap.HillShading = False
                     ImageMap.InterpolatePixels = False
                  End If

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3265
  • Other duties as assigned...
    • Probe Software
Re: Surfer v. 14 has a broken script
« Reply #11 on: May 02, 2019, 08:38:24 AM »
Hi Dan,
Are you saying that the problem was it wasn't using a custom color scale that you created at GE?

Here is the current code:

' Load color spectrum depending on version number
If Val(Left$(SurferApp.Version, 2)) <= Val("8.") Then
   SurferColorMap.LoadFile(SurferApp.Path & "\Samples\Rainbow2.clr")
ElseIf Val(Left$(SurferApp.Version, 2)) <= Val("15.") Then
       SurferColorMap.LoadFile(SurferApp.Path & "\ColorScales\Rainbow2.clr")
Else
   SurferColorMap.LoadFile(SurferApp.Path & "\Samples\Rainbow.clr")
End If

In my mind this means that Surfer 16 (or higher) will use the Rainbow.clr color scale in the Samples folder. That should work unless one is using a customized script.  If you just want to use your own custom script simply replace all the above with:

ImageMap.ColorMap.LoadFile(SurferApp.Path & "\Samples\GE_Standard.clr")
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Dan R

  • Professor
  • ****
  • Posts: 82
    • GE Research Materials Characterization
Re: Surfer v. 14 has a broken script
« Reply #12 on: May 02, 2019, 12:10:55 PM »
Correct John. The Custom Color scale was not the issue. The issue I think is the LoadColorMap not defined properly for the _strip, and _poly extractions. The normal output for presentation mode seems to be okay.
-Dan

Probeman

  • Emeritus
  • *****
  • Posts: 2829
  • Never sleeps...
    • John Donovan
Re: Surfer v. 14 has a broken script
« Reply #13 on: May 02, 2019, 01:44:05 PM »
Correct John. The Custom Color scale was not the issue. The issue I think is the LoadColorMap not defined properly for the _strip, and _poly extractions. The normal output for presentation mode seems to be okay.
-Dan

OK, cool.  These strip and poly scripts were updated for Surfer 16 a little while ago.  The current version of PFE should fix the default scripts. Customized scripts will have to be edited.

Note there is now polygon and profile extractions available in CalcImage now (without needing Surfer):

https://probesoftware.com/smf/index.php?topic=1144.0

Gareth Seward also wrote up a tutorial on some of the more advanced aspects:

https://probesoftware.com/smf/index.php?topic=1151.0
« Last Edit: May 02, 2019, 02:19:13 PM by Probeman »
The only stupid question is the one not asked!