PDA

View Full Version : Grid script: ArtRage Studio and Studio Pro.



AndyRage
07-14-2011, 10:41 AM
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.



//================================================== =========================
//================================================== =========================
// 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 (http://www2.ambientdesign.com/files/grid.arscript).

Tony Johansen
07-26-2011, 08:05 PM
I need a grid overlay and so need to use your script but like a lot of people I have no idea what to do with the script. Once downloaded what does one do with it and how?

Please assume that I have never used a script in my life.

Someonesane
07-27-2011, 01:30 AM
Here's the steps, in outline form, from pg19 of the AR manual (Help > ArtRage Help):

1 - With ArtRage open, select File > Play Script.

2 - In the browsing window, locate and select the .arscript file you wish to play, and open it.

3 - A few things may happen at this point:

1st case - If the script is a video-like script, you'll probably be prompted by the Play Script panel at this point. Choose to Accelerate Playback if you'd like to skip any pauses in the video, and choose the size at which the playback will run.

2nd case - If the script was edited, or hand written (this is the case with this particular script) the Play Script panel will not be seen. Instead, the script creator has included a panel prompt that will ask you for input as to how to proceed. Fill in any needed information, and continue the script by clicking Okay on the panel.

• NOTE: I'd recommend ALWAYS saving any work, before running a script.
3rd case - It's possible the user edited the script so that you do not receive any prompts, in which case the script will simply start to play.

Tony Johansen
07-27-2011, 05:13 AM
Your copy of the ArtRage manual is very different to mine. Script info is on page 121 on mine and it is as uninformative as the manual info here.

There is no info on how to save the script or where. So I have it in Safari I choose Save As - it defaults to saving it in Documents. It appears to be a web archive whatever that means. Going to File Play Scrip in ArtRage opens a finder window with a "scripts" Folder with nothing in it and no indication where that folder is located so I cannot save to it. I navigate to the documents folder and the script is grayed out so it cannot be selected or "played".

My ArtRage manual and your info both assume that I know what a script is, where it should be located and what playing it means. I have never used any kind of script in my life. It kind of reminds me of the sort of stuff one comes across in the Linux world. It is frustrating for someone who likes clear instructions that do not leave out basic steps.

It seems crazy that ArtRage does not have grid overlays built it. Even point and shoot cameras have grids and for good reason. It is kind of basic for such things as getting a horizontal horizon etc.

How does one go about saving the script in such a way that it can be "played"?

Charlie
07-27-2011, 09:29 AM
Grid script:

Add this line to end of the script so that the focus returns to the original layer and not the grid..


Wait: 0.000s EvType: Command CommandID: CID_SelectSpecificLayer ParamType: uint32 Value: { nCurrentLayer-1 }

terrygillooly
07-27-2011, 09:56 AM
There is no info on how to save the script or where. So I have it in Safari I choose Save As - it defaults to saving it in Documents. It appears to be a web archive whatever that means. Going to File Play Scrip in ArtRage opens a finder window with a "scripts" Folder with nothing in it and no indication where that folder is located so I cannot save to it. I navigate to the documents folder and the script is grayed out so it cannot be selected or "played".

Hi Tony,

A "script" is a set of instructions for ArtRage to follow. It is written in readable format as a text file (specifically, a text file in UTF-16 format), and has the suffix .arscript . It can be located anywhere on your computer. I suggest the Scripts folder under Tools: User Content.

A "web archive" is probably a web page that has been saved in HTML format, along with its associated images and possibly other media. It will not work as an ArtRage script.

There are some instructions on saving scripts here: http://www2.ambientdesign.com/forums/showthread.php?t=35944


It seems crazy that ArtRage does not have grid overlays built it. Even point and shoot cameras have grids and for good reason. It is kind of basic for such things as getting a horizontal horizon etc.

Well, you know, there's a grid stencil and also CTRL-SHIFT for making constrained-angled straight lines.

DaveRage
07-27-2011, 11:41 AM
How does one go about saving the script in such a way that it can be "played"?

First, make sure you have installed the latest version of ArtRage Studio or Studio Pro ( 3.5.1 )

Click the link at the bottom of the original post in this thread: 'You can download the script file here'. Your browser will ask you what to do with the file. Choose to save it somewhere handy.

When the download is complete, you can go to File -> Play Script and browse to the file you downloaded, then open it.

You can also view ArtRage's default user scripts folder by going to Tools -> User Content -> Open Scripts Folder. You can play scripts from anywhere, but you can also drop the script file into this folder in order to store them all in the default location.

Regarding the manual, the 'ArtRage Script Files' section gives more information on script files than just playback, including what they are, how to record them, playing them at different sizes and so on, but the information above should help with downloading and playing this particular script.

The code you see in the original post in supplied for informational purposes for people who are programming advanced scripts, you don't need to pay any attention to it as the .arscript file is provided via the link at the bottom of the post. I hope that helps clarify things.

Tony Johansen
07-28-2011, 07:29 AM
Well, you know, there's a grid stencil and also CTRL-SHIFT for making constrained-angled straight lines.

No I did not know this. Typing "grid" into the manual search bar brings up several pages. Top hit is the word being mentioned in the credits and other minor mentions of the word on other pages. No index which is problematic. So I looked for grids under the Stencils section in the contents page. No mention of grids there. Neither are they mentioned in the text talking about stencils, although I was able to find rulers discussed there.

Since a stencil is not the sort of thing that comes to mind in regard to grids and rulers I don't know how Ambient Design expects people to find such things when looking for them unless they are told about it. Reading the manual is not very helpful that is for sure and asking on the forum here takes too much time to be a good solution for a current problem.

I do appreciate the clear instructions that I have received this time. Thank you all.

MattRage
07-28-2011, 10:05 AM
There isn't a grid feature in ArtRage, which is why there's no mention of them in the manual and why we do not explain how to create them.

The manual covers the features of the application as a reference for users who want to know how something they see in the application works. The forums provide support for users who are interested in knowing how features that exist in the application can be applied to various tasks they may wish to undertake, in this case how to use ArtRage to create grids.

Someonesane
07-28-2011, 10:56 AM
Here's a video tutorial on how to record and play script files (.arscript). It doesn't cover how to hand code them in a text editor, because that'd be far to complicated to cover effectively (imo).

Part 1: Link 1 (http://youtu.be/Q1dDBTyFgZA)

Part 2: Link 2 (http://youtu.be/NkFditR_2gM)

PaperTree
07-28-2011, 11:33 PM
Hay Somonesane, I have just finished looking at your tutorials, they are absolutely brilliant and so easy for someone like me to understand! Thanks ever so much!!

I didn't know about scripts, but it looks like an exciting concept. I may use them to remind myself how I painted a particular technique, watching a script is a far quicker memory jogger than reading a manual. I shall enjoy looking through the forum (and manual) for more info and inspiration on scripts (among other things). Whoop-d-doo!

leechie
08-09-2011, 03:55 AM
Hello All,
Had much fun trying to load grid script in the forum :

{script code was here, edited for clarity - DaveRage}

Save as unicode (UTF16) still no luck


eventually I just saved the file extention .arscript and hey presto it worked!!!!!!!!!

DaveRage
08-09-2011, 02:11 PM
For anyone else who's unsure how to get the file: If you click the link at the bottom of the first post 'You can download the script file here (http://www2.ambientdesign.com/files/grid.arscript)' you can download the .arscript file directly.

The code is supplied for informational purposes, you can ignore that and just download the file from the link to get the full script. All ArtRage script files should have an .arscript extension.

screenpainter
08-28-2011, 10:24 PM
Thank you Andy. This is a way cool feature to add for us. I have often wanted this. I think I asked for it once. Now having it possible is just amazing to me.

DennyCayman
04-24-2012, 12:22 AM
Hi
I have just start using Artrage and have been reading through the forum so that I can get up to speed. I appreciate all your efforts here.

DennyCayman

fauxvangogh
02-14-2013, 05:22 AM
Hello All,
Had much fun trying to load grid script in the forum :

{script code was here, edited for clarity - DaveRage}

Save as unicode (UTF16) still no luck


eventually I just saved the file extention .arscript and hey presto it worked!!!!!!!!!


I also copied the script gibberish from the webpaged the download link directs you to. There is no option to "download". I saved it in My Documents>ArtRage Paintings>Scripts as a .arscript file in Unicode (from Notepad). When I click on File>Play Script from within ArtRage, nothing happens. Are there a few intermediate steps left out of the process?

Thank you!

screenpainter
02-14-2013, 09:22 AM
you should be able to just save the file as it is... as an .arscript file.
then from within ArtRage. choose play script, find the file and select it.
it is over my head how it works, but it does.

PS.
clicking on the here (http://www2.ambientdesign.com/files/grid.arscript) link will probably open up the visual image of the code of the script.
just right click on that image and select save as and you will see the
file suffix is .arscript.
Save the file grid.arscript to your documents or somewhere you can easily find it.
then from within ArtRage choose play script, find the file and select it.
it will ask you how many rows and columns you want. voila!

PS. PS. Hey Andy got a splashy new icon for the ArtRage 4 release premier. cool. Now will the others follow his lead? or stay in their gray world? ;) hmmm. ?

quixotic
12-23-2016, 05:05 PM
This finally worked for me. However, I first had to remove the .txt extension from grid.arscript.txt file (which is what the link winds up being when I saved it initially)

JMMK
12-23-2016, 07:03 PM
Do you know about this option in ArtRage?91758

Enug
12-24-2016, 01:12 AM
I know the original post is five years old (before my time here) but until reading it today I never understood how to save a script .txt file and then run the script. So I thank quixotic for opening up this post again. Useful to know. :cool::cool:

quixotic
12-24-2016, 05:00 PM
I know the original post is five years old (before my time here) but until reading it today I never understood how to save a script .txt file and then run the script. So I thank quixotic for opening up this post again. Useful to know. :cool::cool:

You're welcome. On another side note, the function that JMMK pointed out above is only valid for versions 4.5 and later (I only have version 4, so I had to incorporate the script).

quixotic
12-24-2016, 05:41 PM
I found out that this script is interfering with colors to a great degree. Please see this thread: https://forums.artrage.com/showthread.php?52106-Color-way-off&p=513315&posted=1#post513315

Any ideas as to how I can overcome this issue?

And another question: Can I somehow remove the grid at a later point in the drawing?

JMMK
12-24-2016, 06:46 PM
Maybe this will help: Put it on a separate layer and click on the layer locks (Right corner from the layer thumbnail) click all, and paint on new layer(s)
Later you can remove the layer after unlocking it, or make it invisible.

Enug
12-25-2016, 01:06 AM
Running the script results in two layers - the script overlay layer and a layer below - paint on this lower layer (paint will not appear 'washed out') and delete the script layer when it's no longer needed or as suggested above close the layer. No need to lock layers.

quixotic
12-25-2016, 06:31 AM
Thanks everyone. I also found out that version 4.5 (with a built-in grid function) is a free upgrade from version 4 (which I already have). So I think I'll go that route.