This script will work on both ArtRage Studio and Studio pro.
It draws a grid of lines on a new layer to use as an overlay to help line up elements of your painting.
Remember to save the script to a Unicode UTF16 file.
Code:
//===========================================================================
//===========================================================================
// ArtRage Script File.
//===========================================================================
//===========================================================================
//===========================================================================
// Version Block - Script version and ArtRage version:
//===========================================================================
<Version>
ArtRage Version: ArtRage 3 Studio
ArtRage Build: 3.5.0
Professional Edition: No
Script Version: 1
</Version>
//===========================================================================
// Header block - Info about the painting/person who generated this script:
//===========================================================================
<Header>
// === Project data
Painting Name: "Untitled"
Painting Width: 1024
Painting Height: 768
Painting DPI: 72
Mask Edge Map Width: 1024
Mask Edge Map Height: 768
// === Author data
Author Name: "Andy Bearsley"
Script Name: "Grid Overlay"
Comment: "Draw a grid overlay on a layer"
Script Type: ""
Script Feature Flags: 0
</Header>
//===========================================================================
// Script data follows:
//===========================================================================
void DrawLine(real rX1, real rY1, real rX2, real rY2, real rPress)
{
<StrokeEvent>
<StrokeHeader>
<EventPt> Loc: (rX1, rY1) Pr: rPress Ti: 1 Ro: 0 Rv: NO Iv: NO </EventPt>
<Recorded> No </Recorded>
</StrokeHeader>
Loc: (rX1, rY1) Pr: rPress Ti: 1 Ro: 0 Rv: NO Iv: NO
Loc: (rX1, rY1) Pr: rPress Ti: 1 Ro: 0 Rv: NO Iv: NO
Loc: (rX2, rY2) Pr: rPress Ti: 1 Ro: 0 Rv: NO Iv: NO
Loc: (rX2, rY2) Pr: rPress Ti: 1 Ro: 0 Rv: NO Iv: NO
</StrokeEvent>
}
<Events>
flag fUseSquareSize = false
flag fFromCentre = true
int nGridX = 10
int nGridY = 10
int nSquareSize = 200
// Get data for squares.
InputBox("Draw grid overlay. Number of grids:\n\rSquares along (2 to 1000): $$nGridX\n\rSquares down (2 to 1000): $$nGridY\n\rOr use squares of size: $$fUseSquareSize\n\rSize of each square (4 to 4000 Pixels): $$nSquareSize\n\rStart at Centre: $$fFromCentre\n\r")
if (nGridX < 2) nGridX = 2
if (nGridY < 2) nGridY = 2
if (nGridX > 1000) nGridX = 1000
if (nGridY > 1000) nGridY = 1000
if (nSquareSize < 4) nSquareSize = 4
if (nSquareSize > 4000) nSquareSize = 4000
// Select the pencil tool from the presets
Wait: 0.000s EvType: Command CommandID: ToolPreset ToolID: 4901 (Pencil) Tool Data: {
┥┓──┘───╝━─────┿────────◀╫┩┿━───┐───────▬◁◯┾━───────
} // End of tool preset binary data.
// Set colour to black
Wait: 0.000s EvType: Command CommandID: SetForeColour ParamType: Pixel Value: { 0x0FF000000 }
// Add the layer for the gridline overlay.
Wait: 0.000s EvType: Command CommandID: Add New Layer
int nCurrentLayer = CurrentLayerIndex()
Wait: 0.000s EvType: Command CommandID: LayerName Idx: (nCurrentLayer) Name: "Grid overlay"
Wait: 0.000s EvType: Command CommandID: CID_SetSpecificLayerOpacity ParamType: LayerProp Value: { nCurrentLayer, 0.5 }
real rPaintingWidth = PaintingWidth()
real rPaintingHeight = PaintingHeight()
// Draw square of a certain size, or a number of squares
if (fUseSquareSize) {
real rXStart = 0
real rYStart = 0
if (fFromCentre) {
rXStart = ((rPaintingWidth / 2) % nSquareSize)
rYStart = ((rPaintingHeight / 2) % nSquareSize)
}
if (rXStart <= 0) rXStart += nSquareSize
if (rYStart <= 0) rYStart += nSquareSize
real x;
real y;
for (x = rXStart; x < rPaintingWidth; x += nSquareSize) {
DrawLine(x, 0, x, rPaintingHeight, 1)
}
for (y = rYStart; y < rPaintingHeight; y += nSquareSize) {
DrawLine(0, y, rPaintingWidth, y, 1)
}
}
else {
int x;
int y;
for (x = 1; x < nGridX; x++) {
real rX = rPaintingWidth * x / nGridX
DrawLine(rX, 0, rX, rPaintingHeight, 1)
}
for (y = 1; y < nGridY; y++) {
real rY = rPaintingHeight * y / nGridY
DrawLine(0, rY, rPaintingWidth, rY, 1)
}
}
You can download the script file here.