scripting ferroscan 56 en
TRANSCRIPT
-
8/10/2019 Scripting Ferroscan 56 En
1/44
1 of 44
Date March 22, 2012
Hilti PS200
DocumentScripting
Scripting for Hilti PROFIS Ferroscan 5.6
Since Version 5.5 for the Hilti PROFIS Ferroscan PC Software and 3.0 for the Map Software there is limitedScripting Support available. This may help you to automate some tasks.
Scripting is an unsupported option for this Software use it at your own risk!
The scripting engine is based on Lua, to learn more about this language please look athttp://www.lua.org/pil/
As namespace for our defined functions we took host, so all described functions should be called like host.function()in your script.
http://www.lua.org/pil/http://www.lua.org/pil/http://www.lua.org/pil/ -
8/10/2019 Scripting Ferroscan 56 En
2/44
2 of 44
Scripting the PC Software
Scripting Docu for: Hilti PROFIS FerroscanVersion: 1.1.0.0 (2012-03-21 )Author: Herwig Habenbacher (MESh)
Function:
clearHorizontalCorrection()
Description:clear and ignore horizontal depth correction values
Return value:0 indicates success, other values an error
For the Export of Results we can use some correction factors:
Via this function we practically uncheck the use checkbox for the horizontal rebars.So no correction values are applied for the horizontal rebars.
-
8/10/2019 Scripting Ferroscan 56 En
3/44
3 of 44
Function:clearVerticalCorrection()
Description:clear and ignore vertical depth correction values
Return value:
0 indicates success, other values an error
This is identical to clearHorizontalCorrection(), but just for the vertical rebars.
Function:exportToBMP()
Description:export image to Bitmap
Return value:0 indicates success, other values an error
This is essential the same as calling via the menu
The Bitmap is saved under the same name as the scan file, but of course with the extension bmp
Function:exportToCSV()
Description:export data to CSV (Comma Separated Values, Spreadsheet)
Return value:0 indicates success, other values an error
The same as calling the function via menu
The File is saved under the same name as the scan file, but of course with the extension csv
-
8/10/2019 Scripting Ferroscan 56 En
4/44
4 of 44
Function:exportToCSV_Corrected()
Description:export data to CSV (Comma Separated Values, Spreadsheet) applying the correction values
Return value:0 indicates success, other values an error
Like exportToCSV(), but here the correction values are applied if available and enabled.
Function:
exportToCSV_V4()
Description:export data to CSV (Comma Separated Values, Spreadsheet) in Ferroscan V4 Format
Return value:
0 indicates success, other values an error
Like exportToCSV(), but the file format follows Ferroscan PC Software V4.x.We use this for our customers which have written their own evaluation Software for V4.xand want the new version to be compatible.
Function:exportToHIFF()
Description:export data to HIFF (Hilti Interchange File Format, for Map Software)
Return value:0 indicates success, other values an error
Similar to exportToCSV() from functionality.We need this format for further processing with the Map Software.The HIFF has stored the results in a very efficient format, so that we can process even a fewhundrets of scans very comfortable to allow further insights.
Function:exportToHTML()
Description:generate Report in HTML Web Format
Return value:0 indicates success, other values an error
Similar to exportToBMP() from functionality.Generates an HTML Report for possible further processing.
-
8/10/2019 Scripting Ferroscan 56 En
5/44
5 of 44
Function:exportToJPEG()
Description:export image to JPEG
Return value:
0 indicates success, other values an error
Similar to exportToBMP() but in JPEG format.
Function:
exportToQSX()
Description:export data to QSX (Quickscan Export from Ferroscan V4)
Return value:
0 indicates success, other values an error
Like exportToCSV(), but the file format follows Ferroscan PC Software V4.x.We use this for our customers which have written their own evaluation Software for V4.xand want the new version to be compatible.QSX is very close to XML, but was only used for Quickscan Data Exchange.
Function:exportToX3D()
Description:
export image to 3D Web FormatReturn value:
0 indicates success, other values an error
Similar to exportToBMP() but in X3D format.X3D is a 3D format for the Web (Successor of VRML) and gives you a real world impression
Function:exportToXML()
Description:
export data to XML (Generic Data Exchange)Return value:
0 indicates success, other values an error
Like exportToCSV(), but with more details in the standard XML format.
-
8/10/2019 Scripting Ferroscan 56 En
6/44
6 of 44
Function:exportToRST()
Description:export data to RST (Result Format )
Return value:
0 indicates success, other values an error
Like exportToCSV(), but in a special format for some customers.
Function:getArchiveDetails()
Description:update the current archive info and transfer it to Lua
Return value:0 indicates success, other values an error
The function saves the settings in the Lua archive slot.
You may access them via archive.currentDir orarchive.examplesDir
Example:
-- ask host for archive settingshost.getArchiveDetails()
localactPath =archive.examplesDir-- for default values you may use "or" with a directory-- local actPath = archive.examplesDir or "C:\\Examples"
-- we are looking into this projectlocalactFile =actPath .."\\" .."Prj99996\\Image_01.XFF"
-
8/10/2019 Scripting Ferroscan 56 En
7/44
7 of 44
Function:getCorrectionValues()
Description:transfer the depth correction values to Lua
Return value:
0 indicates success, other values an error
The function saves the settings in the Lua correctionValues slot.
Example:
-- local valueslocaloffsetX =0localoffsetY =0localfactorX =1localfactorY =1
-- ask host for correction values
host.getCorrectionValues()
if correctionValues.horizontal.use thenoffsetX = correctionValues.horizontal.offsetfactorX = correctionValues.horizontal.factor
endifcorrectionValues.vertical.use then
offsetY = correctionValues.vertical.offsetfactorY = correctionValues.vertical.factor
end
functioncorrectHorizontal(value )return((value *factorX)+offsetX)
endfunctioncorrectVertical(value )return((value *factorY)+offsetY)
end
-
8/10/2019 Scripting Ferroscan 56 En
8/44
8 of 44
Function:getProjectDetails()
Description:update the current project info and transfer it to Lua
Return value:
0 indicates success, other values an error
This delivers you the same information as shown in the panel for the Archive Folder:
The function saves the settings in the Lua project slot.
In this example the slots would be:
["subfoldername"]="Prj99994",["name"]="Hilti Examples Map Quick",["customer"]="You",["currentDir"]="C:\\Hilti\\Profis\\Ferroscan\\Examples\\Prj99994" ,["object"]="Demo Block",["operator"]="Hilti Measuring"
Accessible via slot, e.g. project.operator
Function:getScanDetails()
Description:update the current scan info and transfer it to Lua
Return value:0 indicates success, other values an error
This delivers information about the actual viewed scan.The function saves the settings in the Lua scan slot.
In this example the slots would be:
["kbVersion"]="2004-07-27",["currentFile"]="C:\\Examples\\Prj99996\\Image_04.XFF" ,["dateTime"]="2007-05-10 09:00:11",["kb"]="PS200:DIN-488",["serialNum"]="21906014",["typeInfo"]="PS 200 Imagescan",["version"]="5.3.1.2 [ SSW: 3.00.0 SHW: 0001 ]",["scannerBuildDate"]="Monday, 7. August 2006"
Accessible via slot, e.g. scan.serialNum
-
8/10/2019 Scripting Ferroscan 56 En
9/44
9 of 44
Function:getScanType()
Description:returns the type of the current scan: 1=Imagescan, 2=Blockscan, 3=Quickscan, other=Unknown
Return value:
1=Imagescan, 2=Blockscan, 3=Quickscan, other=Unknown
Function:
hideHorizontalBars()
Description:hide the horizontal bars
Return value:0 indicates success, other values an error
This is essential the same as unchecking the horizontal bars via the View Results panel.
The horizontal bars are not shown.
Function:hideLayerGrid()
Description:hides the grid over the image
Return value:0 indicates success, other values an error
This is essential the same as unchecking the Grid via the View Layers panel.
The Grid is not shown.
-
8/10/2019 Scripting Ferroscan 56 En
10/44
10 of 44
Function:hideLayerMarker()
Description:hides the marker over the image
Return value:
0 indicates success, other values an error
This is essential the same as unchecking the Marker via the View Layers panel.
No Markers are shown.
Function:
hideLayerOriginals()
Description:hide the original variant of the image
Return value:0 indicates success, other values an error
Similar to the hideLayerMarker() Function.The original preprocessed Layer is not shown.
Function:
hideLayerResults()
Description:hide the results of the image
Return value:0 indicates success, other values an error
Similar to the hideLayerOriginals() Function.The calculated results Layer is not shown.
Function:hideNonverifiedBars()
Description:hide the non-verified bars
Return value:0 indicates success, other values an error
Similar to the hideLayerOriginals() Function.The outer bars of a sweep (close to the grid lines) are not shown.
-
8/10/2019 Scripting Ferroscan 56 En
11/44
-
8/10/2019 Scripting Ferroscan 56 En
12/44
12 of 44
Function:printQSStatistics()
Description:print the statistic for the current Quickscan
Return value:
0 indicates success, other values an error
Prints the actual report with the given settingsstarts printing immediately without confirmationPlease note that the correction values are NOT taken into account!
Function:
saveBitmap()
Description:save the current scan as bitmap under actual filename with BMP extension
Return value:
0 indicates success, other values an error
The Bitmap is saved under the same name as the scan file, but of course with the extension bmp
Function:
saveBitmapAs( fileName )
Description:save the current scan bitmap under a new filename
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
Similar to saveBitmap() but with given filename and the extension bmp
Function:saveScan()
Description:save the current scan with the actual filename
Return value:
0 indicates success, other values an error
Function:saveScanAs( fileName )
Description:save the current scan under a new filename
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
-
8/10/2019 Scripting Ferroscan 56 En
13/44
13 of 44
Function:setCutOff( depth )
Description:set the cut-off depth ( in [mm])
Return value:
0 indicates success, other values an errorParameter and Type:depth [ integer ]
Sets the cut-off depth in [mm], mainly used with Quickscans.All bars below this depth are ignoredthat may be important for statistics.
Function:setDiameterIndex( index )
Description:set the diameter index, valid for both directions and Quickscan
Return value:0 indicates success, other values an error
Parameter and Type:index [ integer ] // -1 is diameter detection for Imagescans
Set the diameter index for analysis.The index may be different for the used knowledgebase.
Overview of indexes and diameters:
0 = 6mm / #3 / C10 / D6 / C 8mm1= 8mm / #4 / C15 / D10 / C10mm2= 10mm / #5 / C20 / D13 / C12mm
3= 12mm / #6 / C25 / D16 / C14mm4= 14mm / #7 / C30 / D19 / C16mm5= 16mm / #8 / C35 / D22 / C18mm6= 20mm / #9 / - / D25 / C20mm7= 25mm / #10 / - / D29 / C22mm8= 28mm / #11 / - / D32 / C25mm9= 30mm / - / - / D35 / C28mm
10 = 36mm / - / - / D38 / C32mm11= - / - / - / - / C36mm
If the diameter should be detected, use the index value -1
Function:setHorizontalCorrection( factor, offset )
Description:set and use horizontal depth correction values, corrected depth value = (old depth value) * factor + offset
[mm]Return value:
0 indicates success, other values an errorParameter and Type:
factor [ double ] // multiplication factoroffset [ double ] // additional offset in [mm]
Set the correction values for horizontal rebars.Please Note: this value is only used for CSV Export!
-
8/10/2019 Scripting Ferroscan 56 En
14/44
14 of 44
Function:setHorzontalDiameterIndex( index )
Description:set the horizontal diameter index, valid for Imagescans
Return value:
0 indicates success, other values an errorParameter and Type:index [ integer ]
Similar to setDiameterIndex( index ), but only affects horizontal rebars.
Function:setImageRulerOff()
Description:if drawing an image we paint only the image
Return value:0 indicates success, other values an error
For the savings of the image we use only the image without a dimensioning border (ruler)It is the same as we select that via menu:
Function:
setImageRulerOn()
Description:if drawing an image we use a ruler around
Return value:0 indicates success, other values an error
For the savings of the image we use a dimensioning border (ruler)It is the same as we select that via menu:
-
8/10/2019 Scripting Ferroscan 56 En
15/44
15 of 44
Function:setInfoComment( aComment )
Description:set the current info comment
Return value:
0 indicates success, other values an errorParameter and Type:aComment [ string ]
Function:setInfoCustomerName( aName )
Description:set the current info customer name
Return value:0 indicates success, other values an error
Parameter and Type:aName [ string ]
Function:setInfoLocationName( aName )
Description:set the current info location name
Return value:0 indicates success, other values an error
Parameter and Type:
aName [ string ]
Function:setInfoOperatorName( aName )
Description:set the current info operator name
Return value:0 indicates success, other values an error
Parameter and Type:aName [ string ]
Function:setInfoProjectName( aName )
Description:set the current info project name
Return value:0 indicates success, other values an error
Parameter and Type:aName [ string ]
-
8/10/2019 Scripting Ferroscan 56 En
16/44
16 of 44
Function:setOverlayIndex( index )
Description:set the overlay index ( = [mm])
Return value:
0 indicates success, other values an errorParameter and Type:index [ integer ]
We use the overlay index, that is the same as checking via the Overlay box in the Settings pane:
Function:setTrigger1( depth )
Description:set the trigger depth 1 ( in [mm])
Return value:0 indicates success, other values an error
Parameter and Type:depth [ integer ]
Function:setTrigger2( depth )
Description:set the trigger depth 2 ( in [mm])
Return value:0 indicates success, other values an error
Parameter and Type:depth [ integer ]
Function:setTrigger3( depth )
Description:set the trigger depth 3 ( in [mm])
Return value:0 indicates success, other values an error
Parameter and Type:depth [ integer ]
-
8/10/2019 Scripting Ferroscan 56 En
17/44
17 of 44
Function:setVerticalCorrection( factor, offset )
Description:set and use vertical depth correction values, corrected depth value = (old depth value) * factor + offset
[mm]
Return value:0 indicates success, other values an errorParameter and Type:
factor [ double ] // multiplication factoroffset [ double ] // additional offset in [mm]
Set the correction values for vertical rebars.Please Note: this value is only used for CSV Export!
Function:
setVerticalDiameterIndex( index )
Description:set the vertical diameter index, valid for Imagescans
Return value:0 indicates success, other values an error
Parameter and Type:index [ integer ]
Similar to setDiameterIndex( index ), but only affects vertical rebars.
Function:
showHorizontalBars()
Description:display the horizontal bars
Return value:0 indicates success, other values an error
The opposite to hideHorizontalBars()This is essential the same as checking the horizontal bars via the View Results panel.
The horizontal bars are now shown.
Function:showLayerGrid()
Description:display the grid over the image for easier orientation
Return value:0 indicates success, other values an error
The opposite to hideLayerGrid()The Grid is now shown.
-
8/10/2019 Scripting Ferroscan 56 En
18/44
18 of 44
Function:showLayerMarker()
Description:display the marker over the image for annotations
Return value:
0 indicates success, other values an error
The opposite to hideLayerMarker()The Marker are now shown.
Function:
showLayerOriginals()
Description:display the original variant of the image
Return value:
0 indicates success, other values an error
The opposite to hideLayerOriginals()The original processed data is now shown.
Function:
showLayerResults()
Description:display the results of the image
Return value:
0 indicates success, other values an error
The opposite to hideLayerResults()The fully analyzes results are now shown.
Function:showNonverifiedBars()
Description:display the non-verified bars
Return value:
0 indicates success, other values an error
The opposite to hideNonverifiedBars()The outside bars (close to the grid lines) are now shown.
-
8/10/2019 Scripting Ferroscan 56 En
19/44
19 of 44
Function:showVerticalBars()
Description:display the vertical bars
Return value:
0 indicates success, other values an error
The opposite to hideVerticalBars()The vertical bars are now shown.
Function:
terminate()
Description:terminate the application
Return value:
0 indicates success, other values an error
Terminates the application (PC Software)This may be useful if you want to perform the script inside a batch processing.So after termination the batch processing may proceed.
-
8/10/2019 Scripting Ferroscan 56 En
20/44
20 of 44
Scripting the Map Software
Scripting Docu for: Hilti PROFIS Ferroscan MapVersion: 1.1.0.0 (2012-03-21 )
Author: Herwig Habenbacher (MESh)
Function:
addToScene( sceneName )
Description:add current settings to scene with name
Return value:0 indicates success, other values an error
Parameter and Type:sceneName [ string ]
This is like adding a scene via the pop-up menu on the virtual wall:
All currently set values for displaying the virtual wall ( color and depth values, zooming, ) are storedinside the project and can be recalled later.
-
8/10/2019 Scripting Ferroscan 56 En
21/44
21 of 44
Function:clearHorizontalCorrection()
Description:clear and ignore horizontal depth correction values
Return value:
0 indicates success, other values an error
We can use some correction factors:
Via this function we practically uncheck the use checkbox for the horizontal rebars.So no correction values are applied for the horizontal rebars.
Function:clearVerticalCorrection()
Description:clear and ignore vertical depth correction values
Return value:0 indicates success, other values an error
Similar to clearHorizontalCorrection(),
-
8/10/2019 Scripting Ferroscan 56 En
22/44
22 of 44
Function:getArchiveDetails()
Description:update the current archive info and transfer it to Lua
Return value:0 indicates success, other values an error
The function saves the settings in the Lua archive slot.
You may access them via archive.currentDir orarchive.examplesDir
Example:
-- ask host for archive settingshost.getArchiveDetails()
localactPath =archive.examplesDir-- for default values you may use "or" with a directory
-- local actPath = archive.examplesDir or "C:\\Examples"
Function:getCorrectionValues()
Description:transfer the depth correction values to Lua
Return value:0 indicates success, other values an error
The function saves the settings in the Lua correctionValues slot.
Example:
-- local valueslocaloffsetX =0localoffsetY =0localfactorX =1localfactorY =1
-- ask host for correction valueshost.getCorrectionValues()
if correctionValues.horizontal.use then
offsetX = correctionValues.horizontal.offsetfactorX = correctionValues.horizontal.factor
endifcorrectionValues.vertical.use then
offsetY = correctionValues.vertical.offsetfactorY = correctionValues.vertical.factor
end
functioncorrectHorizontal(value )return((value *factorX)+offsetX)
endfunctioncorrectVertical(value )
return((value *factorY)+offsetY)
end
-
8/10/2019 Scripting Ferroscan 56 En
23/44
-
8/10/2019 Scripting Ferroscan 56 En
24/44
24 of 44
Function:getStatistic()
Description:update the project statistic and transfer it to Lua
Return value:
0 indicates success, other values an error
This delivers information about the actual statistic values as seen at the Statistic tab.The function saves the settings in the Lua statistics slot.
In this example the slots would be:
["calc"]={["c_quant_10"]=43.42,["numBars"]=8916,["maxVal"]=99,["c_quant_5"]=39.76,["minVal"]=8,
["median"]=55,["numBarsBelow"]=126,["arithMean"]=57.57,["std_dev"]=12.68
},
["calcLimit"]={["c_quant_10"]=43.42,["numBars"]=8916,["maxVal"]=99,["c_quant_5"]=39.76,["minVal"]=8,["upperLimit"]=125.5,["median"
]=55
,["numBarsBelow"]=126,
["arithMean"]=57.57,["std_dev"]=12.68
}
We have two main slots, calc which represents the calculation result and calcLimit whichrepresents the calculated result with upper limit.The slots can be accessed like statistics.calc.median or statistics.calcLimit.upperLimit
Function:
hideGrid()
Description:hides the grid over the image
Return value:0 indicates success, other values an error
Function:
hideHorizontalBars()
Description:
hide the horizontal barsReturn value:
0 indicates success, other values an error
-
8/10/2019 Scripting Ferroscan 56 En
25/44
-
8/10/2019 Scripting Ferroscan 56 En
26/44
26 of 44
Function:loadColorScheme( fileName )
Description:load a color scheme from a filename
Return value:
0 indicates success, other values an errorParameter and Type:fileName [ string ]
Function:loadSceneView( fileName )
Description:load a scene view from an existing scene view file
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
Function:newImagescanMap( fileName, rows, cols )
Description:create a new imagescan map with a filename, number of rows and columns
Return value:0 indicates success, other values an error
Parameter and Type:
fileName [ string ]rows [ integer ]cols [ integer ]
Function:
newQuickscanMap( fileName, width, height, scanWidth )
Description:create a new quickscan map with a filename, width, height and scanwidth in [mm]
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]width [ double ]height [ double ]scanWidth [ double ]
-
8/10/2019 Scripting Ferroscan 56 En
27/44
27 of 44
Function:openProject( fileName )
Description:open project with the given filename
Return value:
0 indicates success, other values an errorParameter and Type:fileName [ string ]
Function:printAll()
Description:print the current project
Return value:0 indicates success, other values an error
Function:
printStatistics()
Description:print the current statistic report
Return value:0 indicates success, other values an error
Function:saveBitmap()
Description:save the current project as bitmap under actual filename with BMP extension
Return value:0 indicates success, other values an error
Function:saveBitmapAs( fileName )
Description:save the current project bitmap under a new filename
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
-
8/10/2019 Scripting Ferroscan 56 En
28/44
28 of 44
Function:saveColorScheme( fileName )
Description:save the current color scheme under a new filename
Return value:
0 indicates success, other values an errorParameter and Type:fileName [ string ]
Function:saveProject()
Description:save the current project with the actual filename
Return value:0 indicates success, other values an error
Function:saveProjectAs( fileName )
Description:save the current project under a new filename
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
Function:saveScene( fileName )
Description:save the current scene under a new filename
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
Save the Scene includes the Zooming Parameters.
Function:
saveSceneView( fileName )
Description:save the current scene view under a new filename
Return value:0 indicates success, other values an error
Parameter and Type:fileName [ string ]
Save the Scene View excludes the Zooming Parameters.
-
8/10/2019 Scripting Ferroscan 56 En
29/44
29 of 44
Function:setComment( aComment )
Description:set the current comment
Return value:
0 indicates success, other values an errorParameter and Type:aComment [ string ]
Function:setCustomerName( aName )
Description:set the current customer name
Return value:0 indicates success, other values an error
Parameter and Type:aName [ string ]
Function:setCutOffValue( depth )
Description:set the cut-off value in [mm]
Return value:0 indicates success, other values an error
Parameter and Type:
depth [ integer ]
Function:setHorizontalCorrection( factor, offset )
Description:set and use horizontal depth correction values, corrected depth value = (old depth value) * factor + offset
[mm]Return value:
0 indicates success, other values an errorParameter and Type:
factor [ double ]offset [ double ]
Function:
setLocationName( aName )
Description:set the current location name
Return value:0 indicates success, other values an error
Parameter and Type:aName [ string ]
-
8/10/2019 Scripting Ferroscan 56 En
30/44
30 of 44
Function:setOperatorName( aName )
Description:set the current operator name
Return value:
0 indicates success, other values an errorParameter and Type:aName [ string ]
Function:setProjectName( aName )
Description:set the current project name
Return value:0 indicates success, other values an error
Parameter and Type:aName [ string ]
Function:setVerticalCorrection( factor, offset )
Description:set and use vertical depth correction values, corrected depth value = (old depth value) * factor + offset
[mm]Return value:
0 indicates success, other values an error
Parameter and Type:factor [ double ]offset [ double ]
Function:
setZoomRange( x1, y1, x2, y2 )
Description:set the zoom range via start- and end-point coordinates in [mm]
Return value:0 indicates success, other values an error
Parameter and Type:x1 [ integer ] // x-starty1 [ integer ] // y-startx2 [ integer ] // x-endy2 [ integer ] // y-end
Function:showGrid()
Description:display the grid over the image for easier orientation
Return value:0 indicates success, other values an error
-
8/10/2019 Scripting Ferroscan 56 En
31/44
31 of 44
Function:showHorizontalBars()
Description:display the horizontal bars
Return value:0 indicates success, other values an error
Function:
showMarker()
Description:display the marker over the image for annotations
Return value:0 indicates success, other values an error
Function:showOriginals()
Description:display the original variant of the image
Return value:0 indicates success, other values an error
This function is in mutual exclusion with showResults().
Function:showResults()
Description:display the results of the image
Return value:0 indicates success, other values an error
This function is in mutual exclusion with showOriginals().
Function:showVerticalBars()
Description:display the vertical bars
Return value:0 indicates success, other values an error
-
8/10/2019 Scripting Ferroscan 56 En
32/44
-
8/10/2019 Scripting Ferroscan 56 En
33/44
33 of 44
Function:useRangeMode()
Description:displays the special depth range mode
Return value:
0 indicates success, other values an error
This is like the tab selected in the View Settings Pane:
Function:
useStandardMode()
Description:displays the full depth range
Return value:0 indicates success, other values an error
This is like the tab selected in the View Settings Pane:
-
8/10/2019 Scripting Ferroscan 56 En
34/44
34 of 44
Function:zoomOut()
Description:leave zoom and display the full area
Return value:
0 indicates success, other values an error
-
8/10/2019 Scripting Ferroscan 56 En
35/44
35 of 44
Example Scripting the PC Software
--------------------------------------------------------------------------------- This Demo Script is an example batch processing from the Examples Folder---- Demo written by Herwig Habenbacher on 2011-08-10
-- Use it at your own risk!-------------------------------------------------------------------------------
-- ask host for archive settings, we want the examples dirhost.getArchiveDetails()localactPath =archive.examplesDir-- or "C:\\Users\\Public\\Documents\\Hilti\\Profis\\Ferroscan\\Examples"-- we are looking into this projectlocalproject ="Prj99996"
-- the batch slot has all the processing infos inside-- look at the batch processing dialog in the PC Software...batch ={-- we need the directory here, because later we just use the filenamesdirName =actPath .."\\" ..project,-- if we want to change some info values we set them here-- a nil value lets the original value unchangedinfo ={projectName =nil,customer =nil,location =nil,
operator =nil,comment =nil},-- same for diameter valuesdiameter ={overlay =nil,horzBar =nil,vertBar =nil,qsBar =nil
},statistic ={trigger1 =nil,trigger2 =nil,
trigger3 =nil,cutOff =nil},-- just for processing we always want to perform a full analysisprocessing ={performFullAnalysis =true,useImageDimensioning =false,layerOriginal =true,layerGrid =true,layerResults =true,layerMarker =true,resISHorizontal =true,resISVertical =true,resISNonverified =true
},
-
8/10/2019 Scripting Ferroscan 56 En
36/44
36 of 44
-- we just want to export to Bitmapsexports ={toCSV =false,toCSV_V4 =false,toQSX =false,toXML =false,toHIFF =true,toBMP =true,toJPEG =false,toHTML =false,toX3D =false
}}
-- list of files to be processedbatchFiles ={"Image_01.XFF","Image_02.XFF","Image_03.XFF","Image_04.XFF","Image_05.XFF","Image_06.XFF"}
-- comments may have more lines and contain also brackets like Lua's definitions-- to use them we have to make some correctionsifbatch.info.comment then
batch.info.comment =correct_brackets(batch.info.comment )end
-- use the build-in command to process these filesprocessBatch()
-- should we terminate after processing?-- host.terminate()
-
8/10/2019 Scripting Ferroscan 56 En
37/44
37 of 44
--------------------------------------------- how to process a single file with usage of the batch slotfunctionprocessSingleBatchFile(fName )
ifhost.openScan(fName)==1then-- 1=Imagescan, 2=Blockscan, 3=Quickscan, other=UnknownlocalsType =host.getScanType()
-- infoifbatch.info.projectName then
host.setInfoProjectName(batch.info.projectName)end
ifbatch.info.customer thenhost.setInfoCustomerName(batch.info.customer)
end
ifbatch.info.location thenhost.setInfoLocationName(batch.info.location)
end
ifbatch.info.operator thenhost.setInfoOperatorName(batch.info.operator)
end
ifbatch.info.comment thenhost.setInfoComment(batch.info.comment)
end
-- diameterifsType ==3then
ifbatch.diameter.qsBar thenhost.setDiameterIndex(batch.diameter.qsBar)
end
elseifbatch.diameter.horzBar thenhost.setHorzontalDiameterIndex(batch.diameter.horzBar)
endifbatch.diameter.vertBar thenhost.setVerticalDiameterIndex(batch.diameter.vertBar)
endendifbatch.diameter.overlay then
host.setOverlayIndex(batch.diameter.overlay)end
-- statistic values (Quickscan only)
ifsType ==3thenifbatch.statistic.trigger1 thenhost.setTrigger1(batch.statistic.trigger1)
endifbatch.statistic.trigger2 thenhost.setTrigger2(batch.statistic.trigger2)
endifbatch.statistic.trigger3 thenhost.setTrigger3(batch.statistic.trigger3)
endifbatch.statistic.cutOff thenhost.setCutOff(batch.statistic.cutOff)
end
end
-
8/10/2019 Scripting Ferroscan 56 En
38/44
38 of 44
-- processing - if we want to export data we have to process anyway...if batch.processing.performFullAnalysis
orbatch.exports.toCSVorbatch.exports.toCSV_Corrorbatch.exports.toCSV_V4orbatch.exports.toQSXorbatch.exports.toXMLorbatch.exports.toHIFForbatch.exports.toX3D
thenhost.performFullAnalysis()
end
if batch.processing.useImageDimensioning thenhost.setImageRulerOn()
elsehost.setImageRulerOff()
end
if batch.processing.layerOriginal thenhost.showLayerOriginals()
elsehost.hideLayerOriginals()
end
ifbatch.processing.layerGrid thenhost.showLayerGrid()
elsehost.hideLayerGrid()
end
ifbatch.processing.layerResults thenhost.showLayerResults()
else
host.hideLayerResults()end
ifbatch.processing.layerMarker thenhost.showLayerMarker()
elsehost.hideLayerMarker()
end
-- view results for ImagescansifsType ==1orsType ==2then
if batch.processing.resISHorizontal thenhost.showHorizontalBars()
elsehost.hideHorizontalBars()
endif batch.processing.resISVertical thenhost.showVerticalBars()
elsehost.hideVerticalBars()
endif batch.processing.resISNonverified thenhost.showNonverifiedBars()
elsehost.hideNonverifiedBars()
end
end
-
8/10/2019 Scripting Ferroscan 56 En
39/44
-
8/10/2019 Scripting Ferroscan 56 En
40/44
40 of 44
--------------------------------------------- how to process all filesfunctionprocessBatch()
localoldFileNamelocaldirType =batch.dirType or0
-- save old filehost.getScanDetails()oldFileName =scan.currentFile
ifdirType ==1then-- archive typelocalnumFiles =#batchFiles or0
ifnumFiles >0thenfori,v inipairs(batchFiles)dolocalfilename
ifbatch.dirName thenfilename =batch.dirName .."\\"..v
elsefilename =v
end
processSingleBatchFile(filename )end
end
else-- directory typeifbatch.dirName then
forfile inlfs.dir(batch.dirName)doifstring.find(file:lower(),".xff",1,true)then
localfilename =batch.dirName .."\\"..file
processSingleBatchFile(filename )end
endend
end
-- restore old fileifoldFileName then
host.openScan(oldFileName)end
end
-
8/10/2019 Scripting Ferroscan 56 En
41/44
-
8/10/2019 Scripting Ferroscan 56 En
42/44
42 of 44
-- we can also prepare our scene view...host.actScene ={-- some zoom settings if wantedzoom ={doZoom =false,startPoint ={x =500,y =500},
endPoint ={x =2100,y =1600}},-- which elements do we want to see?view ={original =false,grid =true,marker =true,
horizontal =true,vertical =true,allBars =true},-- depth and trigger valuesdisplay ={cutOff =100.0,trigger =30,rangeDepth =40,
rangeThickness =10,rangeOnly =false,showType =0},-- colour palettepalette ={deepBar ={color ={r =128,g = 64,b = 64}},backGround ={color ={r = 0,g = 0,b = 0}},rangeSelect ={color ={r =255,g = 0,b = 0}},depthColors ={
{t = 20, color ={r =255,g =255,b = 0}},{t = 25, color ={r =241,g =227,b = 0}},{t = 30, color ={r =227,g =199,b = 0}},{t = 35, color ={r =213,g =171,b = 0}},{t = 45, color ={r =199,g =142,b = 0}},{t = 55, color ={r =185,g =114,b = 0}},{t = 70, color ={r =171,g = 86,b = 0}},{t = 85, color ={r =157,g = 57,b = 0}},{t =100, color ={r =143,g = 29,b = 0}},{t =120, color ={r =128,g = 0,b = 0}}
}}}-- set the scenehost.addToScene("generated scene")
-- now we save the newly generated project
host.saveProject()
-- or save it under a new name-- host.saveProjectAs( actPath .. "\\" .. project .. "\\" ..-- "Example_IMap_Script_generated_New.hae" )
-- theoretically we can quit now our application --- uncomment if you want to try...-- host.terminate()
-
8/10/2019 Scripting Ferroscan 56 En
43/44
43 of 44
Selected Examples Scripting the PC Software
Example 1:
You want to select all Quickscans in a given directory, set the diameter to 16mm (DIN488).Process the data, export the results to CSV (for Excel), print the standard report and the statistic report.
----------------------------------------------------------------------------- some demos to show and explain scripting---- Unsupported stuff - use it at your own risk!---- THIS DEMO STARTS PRINTING WITHOUT QUESTION!---------------------------------------------------------------------------
-- we use this directory as an examplelocaldirName ="C:\\Users\\Public\\Documents\\Hilti\\PROFIS_Ferroscan\\Download\\Prj99998"
-- we check for a single filefunctionprocessSingleFile(fName )
ifhost.openScan(fName)==1then-- 1=Imagescan, 2=Blockscan, 3=Quickscan, other=UnknownlocalsType =host.getScanType()
-- we only process QuickscansifsType ==3then-- the diameter index for a 16mm DIN488 rebar is 5host.setDiameterIndex(5)
-- process the datahost.performFullAnalysis()
-- export resultshost.exportToCSV()
-- print outhost.printAll()
host.printQSStatistics()end
end
end
-- we search in the directory if we can find a scan-- Ferroscan scans have the file extension "xff"forfile inlfs.dir(dirName)do
ifstring.find(file:lower(),".xff",1,true)thenlocalfilename =dirName .."\\"..fileprocessSingleFile(filename )
endend
-
8/10/2019 Scripting Ferroscan 56 En
44/44
Example 2:
You want to select all Imagescans in a given directory.Apply the correction for horizontal and vertical values.Process the data, export the results to CSV (for Excel).
----------------------------------------------------------------------------- some demos to show and explain scripting---- Unsupported stuff - use it at your own risk!---- You want to select all Imagescans in a given directory,-- Apply correction values for horizontal and vertical rebars.-- Process the data, export the results to CSV (for Excel),-----------------------------------------------------------------------------
-- we use this directory as an example
localdirName ="C:\\Users\\Public\\Documents\\Hilti\\PROFIS_Ferroscan\\Download\\Prj99996"
-- we check for a single filefunctionprocessSingleFile(fName )
ifhost.openScan(fName)==1then-- 1=Imagescan, 2=Blockscan, 3=Quickscan, other=UnknownlocalsType =host.getScanType()
-- we only process ImagescansifsType ==1then
-- process the datahost.performFullAnalysis()
-- set correction values (factor, offset [mm] )host.setHorizontalCorrection(1.02,2.0)host.setVerticalCorrection(0.98,-1.0)
-- export resultshost.exportToCSV_Corrected()
end
endend
-- we search in the directory if we can find a scan-- Ferroscan scans have the file extension "xff"forfile inlfs.dir(dirName)do
ifstring.find(file:lower(),".xff",1,true)thenlocalfilename =dirName .."\\"..fileprocessSingleFile(filename )
endend