This document provides an overview of scripting functions available for the Hilti PROFIS Ferroscan software version 5.6. It describes functions for exporting scan data to various file formats like CSV, XML and JPEG. It also includes functions for retrieving scan details, hiding or showing different layers, and clearing depth correction values. The scripting is done using the Lua scripting language and functions are called through a "host" namespace.
This document provides an overview of scripting functions available for the Hilti PROFIS Ferroscan software version 5.6. It describes functions for exporting scan data to various file formats like CSV, XML and JPEG. It also includes functions for retrieving scan details, hiding or showing different layers, and clearing depth correction values. The scripting is done using the Lua scripting language and functions are called through a "host" namespace.
This document provides an overview of scripting functions available for the Hilti PROFIS Ferroscan software version 5.6. It describes functions for exporting scan data to various file formats like CSV, XML and JPEG. It also includes functions for retrieving scan details, hiding or showing different layers, and clearing depth correction values. The scripting is done using the Lua scripting language and functions are called through a "host" namespace.
Since Version 5.5 for the Hilti PROFIS Ferroscan PC Software and 3.0 for the Map Software there is limited Scripting 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 at http://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.
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.
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
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.x and 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 few hundrets 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.
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.x and 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 Format Return 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.
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 or archive.examplesDir
Example:
-- ask host for archive settings host.getArchiveDetails()
local actPath = archive.examplesDir -- for default values you may use "or" with a directory -- local actPath = archive.examplesDir or "C:\\Examples"
-- we are looking into this project local actFile = actPath .. "\\" .. "Prj99996\\Image_01.XFF"
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 values local offsetX = 0 local offsetY = 0 local factorX = 1 local factorY = 1
-- ask host for correction values host.getCorrectionValues()
if correctionValues.horizontal.use then offsetX = correctionValues.horizontal.offset factorX = correctionValues.horizontal.factor end if correctionValues.vertical.use then offsetY = correctionValues.vertical.offset factorY = correctionValues.vertical.factor end
function correctHorizontal( value ) return ((value * factorX) + offsetX) end function correctVertical( value ) return ((value * factorY) + offsetY) end
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.
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.
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.
11 of 44
Function: hideVerticalBars()
Description: hide the vertical bars Return value: 0 indicates success, other values an error
Similar to the hideHorizontalBars() Function.
This is essential the same as unchecking the vertical bars via the View Results panel.
The vertical bars are not shown.
Function: openScan( fileName )
Description: open scan with the given filename Return value: 0 indicates success, other values an error Parameter and Type: fileName [ string ]
Opens a new scan file (with extension xff) unconditionally.
Function: performFullAnalysis()
Description: perform a full analysis of the current scan Return value: 0 indicates success, other values an error
Performs a full analysis of the actual scan with the given settings. This should be done before exporting some results. Please note: if you change the diameter index all results will be deleted, so you have to do the Analysis again before exporting the results!
Function: printAll()
Description: print the current scan Return value: 0 indicates success, other values an error
Prints the actual report with the given settings starts printing immediately without confirmation.
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 settings starts printing immediately without confirmation Please 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 ]
13 of 44
Function: setCutOff( depth )
Description: set the cut-off depth ( in [mm]) Return value: 0 indicates success, other values an error Parameter and Type: depth [ integer ]
Sets the cut-off depth in [mm], mainly used with Quickscans. All bars below this depth are ignored that 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.
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 error Parameter and Type: factor [ double ] // multiplication factor offset [ double ] // additional offset in [mm]
Set the correction values for horizontal rebars. Please Note: this value is only used for CSV Export!
14 of 44
Function: setHorzontalDiameterIndex( index )
Description: set the horizontal 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 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:
15 of 44
Function: setInfoComment( aComment )
Description: set the current info comment Return value: 0 indicates success, other values an error Parameter 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 ]
16 of 44
Function: setOverlayIndex( index )
Description: set the overlay index ( = [mm]) Return value: 0 indicates success, other values an error Parameter 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 ]
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 error Parameter and Type: factor [ double ] // multiplication factor offset [ 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.
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.
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.
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 stored inside the project and can be recalled later.
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(),
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 or archive.examplesDir
Example:
-- ask host for archive settings host.getArchiveDetails()
local actPath = 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 values local offsetX = 0 local offsetY = 0 local factorX = 1 local factorY = 1
-- ask host for correction values host.getCorrectionValues()
if correctionValues.horizontal.use then offsetX = correctionValues.horizontal.offset factorX = correctionValues.horizontal.factor end if correctionValues.vertical.use then offsetY = correctionValues.vertical.offset factorY = correctionValues.vertical.factor end
function correctHorizontal( value ) return ((value * factorX) + offsetX) end function correctVertical( value ) return ((value * factorY) + offsetY) end
23 of 44
Function: getProjectInfo()
Description: update the project info and transfer it to Lua Return value: 0 indicates success, other values an error
This delivers information about the actual project info as seen at the Info tab. The function saves the settings in the Lua project slot.
We have two main slots, calc which represents the calculation result and calcLimit which represents 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 bars Return value: 0 indicates success, other values an error
25 of 44
Function: hideMarker()
Description: hides the marker over the image Return value: 0 indicates success, other values an error
Function: hideVerticalBars()
Description: hide the vertical bars Return value: 0 indicates success, other values an error
Function: insertImagescan( fileName, row, col )
Description: insert an imagescan with filename into current project at row and col position Return value: 0 indicates success, other values an error Parameter and Type: fileName [ string ] row [ integer ] col [ integer ]
Before inserting an Imagescan a new Image Map must be created via newImagescanMap.
Description: insert a quickscan with filename into current project at xPos and yPos position in [mm] with direction sDir Return value: 0 indicates success, other values an error Parameter and Type: fileName [ string ] xPos [ double ] yPos [ double ] sDir [ integer ] // 0=East, 1=West, 2=South, 3=Nord
Before inserting a Quickscan a new Quickscan Map must be created via newQuickscanMap.
26 of 44
Function: loadColorScheme( fileName )
Description: load a color scheme from a filename Return value: 0 indicates success, other values an error Parameter 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 ]
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 ]
27 of 44
Function: openProject( fileName )
Description: open project with the given filename Return value: 0 indicates success, other values an error Parameter 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 ]
28 of 44
Function: saveColorScheme( fileName )
Description: save the current color scheme under a new filename Return value: 0 indicates success, other values an error Parameter 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.
29 of 44
Function: setComment( aComment )
Description: set the current comment Return value: 0 indicates success, other values an error Parameter 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 ]
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 error Parameter 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 ]
30 of 44
Function: setOperatorName( aName )
Description: set the current operator name Return value: 0 indicates success, other values an error Parameter 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-start y1 [ integer ] // y-start x2 [ integer ] // x-end y2 [ integer ] // y-end
Function: showGrid()
Description: display the grid over the image for easier orientation Return value: 0 indicates success, other values an error
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
32 of 44
Function: terminate()
Description: terminate the application Return value: 0 indicates success, other values an error
Function: updateColorScheme()
Description: the changed colorscheme in the script is updated and displayed at the host Return value: 0 indicates success, other values an error
Function: updateScene()
Description: the changed scene in the script is updated and displayed at the host Return value: 0 indicates success, other values an error
Function: useCutOffMode()
Description: displays the depth range up to the cut-off value Return value: 0 indicates success, other values an error
This is like the tab selected in the View Settings Pane:
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:
34 of 44
Function: zoomOut()
Description: leave zoom and display the full area Return value: 0 indicates success, other values an error
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 dir host.getArchiveDetails() local actPath = archive.examplesDir -- or "C:\\Users\\Public\\Documents\\Hilti\\Profis\\Ferroscan\\Examples" -- we are looking into this project local project = "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 filenames dirName = actPath .. "\\" .. project, -- if we want to change some info values we set them here -- a nil value lets the original value unchanged info = { projectName = nil, customer = nil, location = nil, operator = nil, comment = nil }, -- same for diameter values diameter = { 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 analysis processing = { performFullAnalysis = true, useImageDimensioning = false, layerOriginal = true, layerGrid = true, layerResults = true, layerMarker = true, resISHorizontal = true, resISVertical = true, resISNonverified = true },
36 of 44 -- we just want to export to Bitmaps exports = { toCSV = false, toCSV_V4 = false, toQSX = false, toXML = false, toHIFF = true, toBMP = true, toJPEG = false, toHTML = false, toX3D = false } }
-- list of files to be processed batchFiles = { "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 corrections if batch.info.comment then batch.info.comment = correct_brackets( batch.info.comment ) end
-- use the build-in command to process these files processBatch()
-- should we terminate after processing? -- host.terminate()
37 of 44 ------------------------------------------- -- how to process a single file with usage of the batch slot function processSingleBatchFile( fName )
if host.openScan(fName) == 1 then -- 1=Imagescan, 2=Blockscan, 3=Quickscan, other=Unknown local sType = host.getScanType()
-- info if batch.info.projectName then host.setInfoProjectName(batch.info.projectName) end
if batch.info.customer then host.setInfoCustomerName(batch.info.customer) end
if batch.info.location then host.setInfoLocationName(batch.info.location) end
if batch.info.operator then host.setInfoOperatorName(batch.info.operator) end
if batch.info.comment then host.setInfoComment(batch.info.comment) end
-- diameter if sType == 3 then if batch.diameter.qsBar then host.setDiameterIndex(batch.diameter.qsBar) end else if batch.diameter.horzBar then host.setHorzontalDiameterIndex(batch.diameter.horzBar) end if batch.diameter.vertBar then host.setVerticalDiameterIndex(batch.diameter.vertBar) end end if batch.diameter.overlay then host.setOverlayIndex(batch.diameter.overlay) end
-- statistic values (Quickscan only) if sType == 3 then if batch.statistic.trigger1 then host.setTrigger1(batch.statistic.trigger1) end if batch.statistic.trigger2 then host.setTrigger2(batch.statistic.trigger2) end if batch.statistic.trigger3 then host.setTrigger3(batch.statistic.trigger3) end if batch.statistic.cutOff then host.setCutOff(batch.statistic.cutOff) end end
38 of 44 -- processing - if we want to export data we have to process anyway... if batch.processing.performFullAnalysis or batch.exports.toCSV or batch.exports.toCSV_Corr or batch.exports.toCSV_V4 or batch.exports.toQSX or batch.exports.toXML or batch.exports.toHIFF or batch.exports.toX3D then host.performFullAnalysis() end
if batch.processing.useImageDimensioning then host.setImageRulerOn() else host.setImageRulerOff() end
if batch.processing.layerOriginal then host.showLayerOriginals() else host.hideLayerOriginals() end
if batch.processing.layerGrid then host.showLayerGrid() else host.hideLayerGrid() end
if batch.processing.layerResults then host.showLayerResults() else host.hideLayerResults() end
if batch.processing.layerMarker then host.showLayerMarker() else host.hideLayerMarker() end
-- view results for Imagescans if sType == 1 or sType == 2 then if batch.processing.resISHorizontal then host.showHorizontalBars() else host.hideHorizontalBars() end if batch.processing.resISVertical then host.showVerticalBars() else host.hideVerticalBars() end if batch.processing.resISNonverified then host.showNonverifiedBars() else host.hideNonverifiedBars() end end
39 of 44 -- exports if batch.exports.toCSV then host.exportToCSV() end if batch.exports.toCSV_Corr then host.exportToCSV_Corrected() end if batch.exports.toCSV_V4 then host.exportToCSV_V4() end if batch.exports.toQSX then host.exportToQSX() end if batch.exports.toXML then host.exportToXML() end if batch.exports.toHIFF then host.exportToHIFF() end
if batch.exports.toBMP then host.exportToBMP() end if batch.exports.toJPEG then host.exportToJPEG() end
if batch.exports.toHTML then host.exportToHTML() end if batch.exports.toX3D then host.exportToX3D() end
end
end
40 of 44 ------------------------------------------- -- how to process all files function processBatch() local oldFileName local dirType = batch.dirType or 0
-- save old file host.getScanDetails() oldFileName = scan.currentFile
if dirType == 1 then -- archive type local numFiles = #batchFiles or 0
if numFiles > 0 then for i, v in ipairs(batchFiles) do local filename
if batch.dirName then filename = batch.dirName .."\\" .. v else filename = v end
processSingleBatchFile( filename ) end end
else -- directory type if batch.dirName then for file in lfs.dir(batch.dirName) do if string.find( file:lower(), ".xff", 1, true ) then local filename = batch.dirName .. "\\" .. file processSingleBatchFile( filename ) end end end
end
-- restore old file if oldFileName then host.openScan(oldFileName) end
end
41 of 44 Scripting the Map Software
------------------------------------------------------------------------------- -- This Demo Script generates an example Imagescan Map from the Examples Folder -- -- Demo written by Herwig Habenbacher on 2011-08-10 -- Use it at your own risk! -------------------------------------------------------------------------------
-- we defines the overall size in rows and columns local rows = 3 local colums = 4
-- a comment can be also set via scripting local cmt = [[ Welcome to the Examples project generated by scripting!
]]
-- ask host for archive settings host.getArchiveDetails() local actPath = archive.examplesDir -- or "C:\\Users\\Public\\Documents\\Hilti\\Profis\\Ferroscan\\Examples" -- we are looking into this project local project = "Prj99995"
host.newImagescanMap( actPath .. "\\" .. project .. "\\" .. "Example_ImageMap_Script_generated.hae", rows, colums) host.setProjectName("A Testproject") host.setCustomerName("A Test Customer") host.setLocationName("A Test Location") host.setOperatorName("An integrated Test Script Programmer") host.setComment(cmt) --host.loadColorScheme("Bridge_Rusty.cls")
-- full map, a line contains a row -- if we want to keep an entry empty, we insert nil as value local aMap = { { "FS000091", "FS000092", "FS000095", "FS000096" }, { "FS000111", nil, "FS000113", "FS000114" }, { "FS000128", "FS000129", "FS000130", "FS000131" } }
-- now we read the real files in for i=1,rows do for k=1,colums do if aMap[i][k] then -- we build the filename from examples path, project directory, -- name and extension host.insertImagescan( actPath .. "\\" .. project .. "\\" .. aMap[i][k] .. ".iff", i, k) end end end
42 of 44 -- we can also prepare our scene view... host.actScene = { -- some zoom settings if wanted zoom = { 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 values display = { cutOff = 100.0, trigger = 30, rangeDepth = 40, rangeThickness = 10, rangeOnly = false, showType = 0 }, -- colour palette palette = { 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 scene host.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()
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 example local dirName = "C:\\Users\\Public\\Documents\\Hilti\\PROFIS_Ferroscan\\Download\\Prj99998"
-- we check for a single file function processSingleFile( fName )
if host.openScan(fName) == 1 then -- 1=Imagescan, 2=Blockscan, 3=Quickscan, other=Unknown local sType = host.getScanType()
-- we only process Quickscans if sType == 3 then -- the diameter index for a 16mm DIN488 rebar is 5 host.setDiameterIndex(5)
-- process the data host.performFullAnalysis()
-- export results host.exportToCSV()
-- print out host.printAll() host.printQSStatistics() end
end end
-- we search in the directory if we can find a scan -- Ferroscan scans have the file extension "xff" for file in lfs.dir(dirName) do if string.find( file:lower(), ".xff", 1, true ) then local filename = dirName .. "\\" .. file processSingleFile( filename ) end end
44 of 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 local dirName = "C:\\Users\\Public\\Documents\\Hilti\\PROFIS_Ferroscan\\Download\\Prj99996"
-- we check for a single file function processSingleFile( fName )
if host.openScan(fName) == 1 then -- 1=Imagescan, 2=Blockscan, 3=Quickscan, other=Unknown local sType = host.getScanType()
-- we only process Imagescans if sType == 1 then -- process the data host.performFullAnalysis()
-- export results host.exportToCSV_Corrected() end
end end
-- we search in the directory if we can find a scan -- Ferroscan scans have the file extension "xff" for file in lfs.dir(dirName) do if string.find( file:lower(), ".xff", 1, true ) then local filename = dirName .. "\\" .. file processSingleFile( filename ) end end
The Compiler, Assembler, Linker, Loader and Process Address Space Tutorial - Hacking The Process of Building Programs Using C Language - Notes and Illustrations
Python Advanced Programming: The Guide to Learn Python Programming. Reference with Exercises and Samples About Dynamical Programming, Multithreading, Multiprocessing, Debugging, Testing and More