Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Grid script: ArtRage Studio and Studio Pro.

  1. #1
    Join Date
    Mar 2006
    Location
    Ambient Design
    Posts
    3,936

    Grid script: ArtRage Studio and Studio Pro.

    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.
    AndyRage's mantra for graphics engine code:
    "Sure - how hard can it be?"

  2. #2
    Join Date
    Jul 2006
    Location
    Sydney
    Posts
    18

    Huh?

    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.

  3. #3
    Join Date
    Oct 2007
    Location
    NC, USA
    Posts
    2,872
    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.
    Nothing is easy to the unwilling.

  4. #4
    Join Date
    Jul 2006
    Location
    Sydney
    Posts
    18
    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"?

  5. #5
    Join Date
    May 2006
    Location
    UK
    Posts
    186
    Grid script:

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

    Code:
    Wait: 0.000s    EvType: Command    CommandID: CID_SelectSpecificLayer    ParamType: uint32    Value: { nCurrentLayer-1 }
    Last edited by Charlie; 07-27-2011 at 11:48 AM.
    Charlie

    ArtRage for Art | EnergyXT2 for Music | Blender for 3D

  6. #6
    Join Date
    Feb 2010
    Location
    Nevada
    Posts
    139
    Quote Originally Posted by Tony Johansen View Post
    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...ad.php?t=35944

    Quote Originally Posted by Tony Johansen View Post
    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.
    Cat Boxes, a web comic

  7. #7
    Join Date
    Mar 2006
    Posts
    3,810
    Quote Originally Posted by Tony Johansen View Post

    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.

  8. #8
    Join Date
    Jul 2006
    Location
    Sydney
    Posts
    18
    Quote Originally Posted by terrygillooly View Post
    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.

  9. #9
    Join Date
    Mar 2006
    Location
    New Zealand
    Posts
    3,215
    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.

  10. #10
    Join Date
    Oct 2007
    Location
    NC, USA
    Posts
    2,872
    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

    Part 2: Link 2
    Nothing is easy to the unwilling.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •