Index

Using a script file

For quick and automatic processing, IBModeler also gives the option of executing a series of commands after reading them from a text file (.txt).

After loading a mold file, we can start the execution of these commands by going to Options->Run Script (Shortcut R ). The application will ask for the location of the script file. After selecting the script file, all the commands written in it will be executed one after another without giving any prompts (except when an error occurs and the execution stops).

Most of the important operations related to processing of the images, applying them to the mold and creating the model out of the mold can be done through the script commands. Using a script file is the most convenient method of processing and should be used as far as possible for automatic and speedy processing and for executing repetitive commands.

Here is a list of the script commands along with their short descriptions. Links have been provided as reference for detailed description of the tasks these commands perform. The data types for the parameters have been described at the bottom of this page. Code for a sample script file is also provided as a reference.

COMMANDS PARAMETERS
LOADIMAGE
Loads a jpg or bitmap image for processing.
Applicable if no image is loaded.

Reference: Mold options

filepath imagePath The complete path of the image file. Filenames can have .jpg, .jpeg, .bmp or .dib extensions.
SETBACKGROUNDSCREEN
Sets all the regions with a red, green or blue color as the background.
Applicable if an image is currently loaded.

Reference: Set background screen dialog

SCREENTYPE screenType, Specifies whether the background screen is red, green or blue
unsigned char minColorOffset, The minimum difference that should always be present between the the screen color and the other two colors (Range: 10 to 255)
unsigned char maxDiffPercent The allowed difference between the other two colors as a percentage of difference between the screen color and the rest two colors (Range: 1 to 99)
SETBACKGROUNDCOLOR
Sets all the regions with a particular color or with different shades of a color as the background.
Applicable if an image is currently loaded.

Reference: Set background color dialog

unsigned char bgColorR, Red component of the selected color (Range: 0 to 255)
unsigned char bgColorG, Green component of the selected color (Range: 0 to 255)
unsigned char bgColorB, Blue component of the selected color (Range: 0 to 255)
COLORSELECTIONTYPE clrSelType, The type of operation
unsigned int varianceValue Should be supplied only if clrSelType is SAT or LUM. All colors with SAT or LUM values between the varianaceVal and the SAT or LUM value of the selected color will be set as background (Range: 0 to 240)
SETCAMERAPARAMS
Used to callibrate the camera. The specified values helps to identify the captured range at different distances from the camera.

Reference: Define camera parameters dialog

float vt1, First measured vertical coverage
float vt1Distance, Distance at which the first vertical coverage was measured
float vt2, Second measured vertical coverage
float vt2Distance, Distance at which the second vertical coverage was measured
float ht1, First measured horizontal coverage
float ht1Distance, Distance at which the first horizontal coverage was measured
float ht2, Second measured horizontal coverage
float ht2Distance Distance at which the second horizontal coverage was measured
Note: The allowed range for all the above values is 0.0001 to 50000
SETCAMERAPARAMS_INFINITY
Used to callibrate the camera. If the model is at sufficient distance from the camera, this option can be used to specify a fixed horizontal and vertical range that the camera can capture.

Reference: Define camera parameters dialog

float height, Vertical coverage (Range: 1 to 50000)
float width Horizontal coverage (Range: 1 to 50000)
APPLYIMAGE_SNAPS
Applies the loaded image to the mold file.
Applicable if an image is currently loaded.

Reference: Camera orientation dialog

float cameraLocationX, X Coordinate of the camera position
float cameraLocationY, Y Coordinate of the camera position
float cameraLocationZ, Z Coordinate of the camera position
float pointingToX, X Coordinate of the point to which the camera is pointing
float pointingToY, Y Coordinate of the point to which the camera is pointing
float pointingToZ Z Coordinate of the point to which the camera is pointing
Note: The allowed range for all the above values is -50000 to 50000
SAVEIMAGE
Saves changes to the loaded image file.
Applicable if an image is currently loaded.

Reference: Mold options

None
SAVEIMAGEAS
Saves the loaded image to a new location.
Applicable if an image is currently loaded.

Reference: Mold options

filepath imagepath The complete path of the new location. Filenames should have a .bmp extension.
CLOSEIMAGE
Closes the image file.
Applicable if an image is currently loaded.

Reference: Mold options

None
CREATEMODEL
Creates the model from the mold file.
Applicable if no image is loaded.

Reference: Creating the model from the mold

unsigned char modelColorR, Red component of the model color (Range: 0 to 255)
unsigned char modelColorG, Blue component of the model color (Range: 0 to 255)
unsigned char modelColorB, Green component of the model color (Range: 0 to 255)
filepath outputFilePath The complete path where the model file will be created. Filenames should have a .mdl extension.
CREATEMODELPART
Creates a part of the model from the mold file, depending on the range of points specified for the three axes.
Applicable if no image is loaded.

Reference: Creating the model from the mold

unsigned char modelColorR, Red component of the model color (Range: 0 to 255)
unsigned char modelColorG, Blue component of the model color (Range: 0 to 255)
unsigned char modelColorB, Green component of the model color (Range: 0 to 255)
unsigned int minxindex, Start index of the points along X axis (Range: 1 to 1000)
unsigned int maxxindex, Last index of the points along X axis (Range: 1 to 1000, Should be greater than minxindex by at least 2)
unsigned int minyindex, Start index of the points along Y axis (Range: 1 to 1000)
unsigned int maxyindex, Last index of the points along Y axis (Range: 1 to 1000, Should be greater than minyindex by at least 2)
unsigned int minzindex, Start index of the points along Z axis (Range: 1 to 1000)
unsigned int maxzindex, Last index of the points along Z axis (Range: 1 to 1000, Should be greater than minzindex by at least 2)
filepath outputFilePath The complete path where the model file will be created. Filenames should have a .mdl extension.
ADDFRONTBACKTEXTURE
Adds textures to an already existing model file. Two image files need to be specified for textures. One for the front of the model and one for the back.
Applicable if no image is loaded.

Reference: Add textures dialog

filepath frontImageFilePath, The path to the jpg or bitmap file to be used as the front texture
unsigned int frontTexCameraLocationX, X coordinate of the location of the camera when the front texture image was taken
unsigned int frontTexCameraLocationY, Y coordinate of the location of the camera when the front texture image was taken
unsigned int frontTexCameraLocationZ, Z coordinate of the location of the camera when the front texture image was taken
unsigned int frontTexCameraDirectionX, X coordinate of the direction in which the camera was pointing when the front texture image was taken
unsigned int frontTexCameraDirectionY, Y coordinate of the direction in which the camera was pointing when the front texture image was taken
unsigned int frontTexCameraDirectionZ, Z coordinate of the direction in which the camera was pointing when the front texture image was taken
filepath backImageFilePath, The path to the jpg or bitmap file to be used as the back texture
unsigned int cameraLocationX, X coordinate of the location of the camera when the back texture image was taken
unsigned int cameraLocationY, Y coordinate of the location of the camera when the back texture image was taken
unsigned int cameraLocationZ, Z coordinate of the location of the camera when the back texture image was taken
unsigned int backTexCameraDirectionX, X coordinate of the direction in which the camera was pointing when the back texture image was taken
unsigned int backTexCameraDirectionY, Y coordinate of the direction in which the camera was pointing when the back texture image was taken
unsigned int backTexCameraDirectionZ, Z coordinate of the direction in which the camera was pointing when the back texture image was taken
filepath modelFilePath, The path to the model file on which the texture has to be applied
//
Use this at the start of the line to add a comment.
None

float Decimal values eg: 12.98, -0.92, 123.356.
Rules:
  • Values can contain the nine digits, one minus sign and one '.' for decimal.
  • Exponential notations like 0.12E10 are not supported.
  • Minus sign should always be at the beginning and there should not be any space between the digits and minus sign.
  • If its a decimal value, then there should be at least one digit after the decimal point.
filepath A string value containing the full path of the file eg: "C:\my images\image1.bmp".
Rules:
  • The filepath should always be within double quotes.
  • It should not contain the characters [" | * ? < > ].
unsigned int A positive integer value eg: 0, 10, 200
unsigned char A positive integer value between 0 and 255
SCREENTYPE Can have one of the following three values depending on the color of the background screen:
RED
GREEN
BLUE
COLORSELECTIONTYPE Specifies how the colors have to be chosen for marking them as background. Can have one of the following values :
SAT: All colors with luminosity and hue values same as chosen color and having saturation values between the saturation value of the chosen color and varianceValue.
LUM: All colors with saturation and hue values same as chosen color and having luminosity values between the luminosity value of the chosen color and varianceValue.
CUR_AND_BRIGHTER: All colors whose luminosity values are greater than or equal to the chosen color.
CUR_AND_DARKER All colors whose luminosity values are less than or equal to the chosen color.
SINGLE_COLOR Mark only the chosen color as background.

Script example:
Here is a sample listing of a script file for reference:
//Load the image file
LOADIMAGE "C:\test images\image1.bmp"
//Set a green screen as background
SETBACKGROUNDSCREEN  GREEN, 50, 20
//Callibrate the camera
SETCAMERAPARAMS_INFINITY 20, 20
//Apply the image to the mold file
APPLYIMAGE_SNAPS 0,0, 50.1, 0, 0, 0
//Save the image
SAVEIMAGE
//Save the image to a new location 
SAVEIMAGEAS "C:\test images\processed images\image1.bmp"
//Close the image file
CLOSEIMAGE 
//Create the model from the mold
CREATEMODELPART 255, 0, 0, 1,50,1,50,1,50, "c:\models\mymodel.mdl"