1. New to Christmas lighting? Get started with the AusChristmasLighting 101 Manual:
    auschristmaslighting.com/wiki/AusChristmasLighting-101

Nutcracker: How to make your own target files

Discussion in 'xLights (Nutcracker)' started by smeighan, Apr 21, 2012.

  1. smeighan

    smeighan Dedicated Elf

    Joined:
    Jan 19, 2012
    Messages:
    1,064
    Likes Received:
    9
    Location:
    4217 Greenfinch Dr CO 80126
    I have been getting requests for more targets than i have coded so far.


    Most are requesting the horizontal matrix.


    I will build a target generator for that, but i wanted to let all of you know that you can make your own target files.


    horizontal matrix, LEDs wrapped around your bush, leds on the side of your house, stack matrix quads on top of each other. You can do it.


    Here is the basic concept for Nutcracker targets. Whatever you have has to be divided into vertical strands. Each strand has pixels. Those pixels will always start with Pixel #1 at the top. For each pixel include the x,y,z location in world coordinates.


    Well, thats it.


    Here is what a target file looks like. It should be a space delimited ASCII file. Comments begin with a hash mark. Blank lines are ignored.




    # ../targets/2/AA.dat
    # Col 1: Your TARGET_MODEL_NAME
    # Col 2: Strand number.
    # Col 3: Nutcracker Pixel#
    # Col 4: X location in world coordinates
    # Col 5: Y location in world coordinates
    # Col 6: Z location in world coordinates
    # Col 7: User string <= This is your string#. Start at 1 and go to how many you have
    # Col 8: User pixel <= This is the physical pixel # on your string
    # Col 9: Username. This is a uneeded field and can be left blank
    # Col 10: Targetname (again). This is an unneeded field and can be left blank


    AA 1 1 0.000 0.728 131.254 0 1 50 f AA
    AA 1 2 0.000 1.455 128.343 0 1 49 f AA
    AA 1 3 0.000 2.183 125.433 0 1 48 f AA
    AA 1 4 0.000 2.910 122.522 0 1 47 f AA
    AA 1 5 0.000 3.638 119.612 0 1 46 f AA
    AA 1 6 0.000 4.366 116.702 0 1 45 f AA
    AA 1 7 0.000 5.093 113.791 0 1 44 f AA
    AA 1 8 0.000 5.821 110.881 0 1 43 f AA
    AA 1 9 0.000 6.548 107.970 0 1 42 f AA
    AA 1 10 0.000 7.276 105.060 0 1 41 f AA




    AA 2 1 0.142 0.714 131.254 0 1 51 f AA
    AA 2 2 0.284 1.427 128.343 0 1 52 f AA
    AA 2 3 0.426 2.141 125.433 0 1 53 f AA
    AA 2 4 0.568 2.855 122.522 0 1 54 f AA
    AA 2 5 0.710 3.568 119.612 0 1 55 f AA
    AA 2 6 0.852 4.282 116.702 0 1 56 f AA
    AA 2 7 0.994 4.995 113.791 0 1 57 f AA
    AA 2 8 1.136 5.709 110.881 0 1 58 f AA
    AA 2 9 1.278 6.423 107.970 0 1 59 f AA
    AA 2 10 1.419 7.136 105.060 0 1 60 f AA




    So let me show you how to make one in pseudo code:


    A user here has 12 flat strings, 30 pixels each. He wants to string them horizontally and make a horizontal matrix.


    He probably wants scrolling text to work and create a nice sign board.


    We need the above file to be created.




    # In x,y,z world coordinates, we can consider this a 2D object. In Nutcracker space the z axis is up and down, the x axis is left and right, the y axis is front and back
    # we will start at the bottom of his first string and consider that (0,0,0).
    # Y axis will always be 0 since this is a 2d object. Let us assume 3" spacing between his pixels and 3" spacing between the rows of strings. My aha moment was
    # when i realized these dimensions do NOT have to match your display, they only have to be keep referential intact for my calculations. Let me simply this
    # by saying always use 3" or 8cm for the spacing between your objects and all my effects will work.


    for (s=1;s<=12;s++) # Lets go through all of his strings
    for (p=1;p<=30;p++) # and for each of his strings look at all of his pixels.
    {
    y=0.0; # we have a 2d shape, the matrix will be a flat plane
    x=p*3; # in a horizontal matrix, pixels are going horizontally
    z=s*3; # and strings stack on top of each other.


    strand =p; # i need the verticals to be strands. 30 pixels laid out horizontally. We will therefore have 30 strands
    pixel = 13-s; The very top string needs to be labeled as pixel #1, the very last (bottom string) needs to be labels as pixel 12
    print "HMATRIX ",strand,pixel,x,y,z,s,p;
    }





    The code in red will produce a target file for a horizontal matrix.,


    This will work with all effects in the Nutcracker.


    As you can see , making the target files is pretty simple. It gets a little more complex if the object is in 3d.


    Make a target file and email it to me, i will add it into your library of targets. I will make a screen where you can upload your own targets. The only other little cleanup is each target has to be entered into the mysql database.
     

Share This Page