Monday, 9 March 2015

LaserCutter Vector Cutting Basic Tutorial

Introduction

In order for the Laser Cutter to cut through materials, it needs a vector line to follow with the laser. Vector lines are created on the computer using various applications such as:
  • Adobe Illustrator
  • CorelDraw
  • InkScape
A vector line in its simplist form is two points on the screen, which have a line connecting them. Images made in these applications might only consist of points and lines. These lines might have a colour and thickness. If these lines enclose an area, the area can be filled with a colour or gradient.

This is in contrast to the images you will be used to which are 'pixel' based. Pixel based images are made up of a large grid of dots, each with a colour value.

Overview

In this tutorial we will take a pixel based image and convert it to a vector image using Adobe Illustrator CS5. We will then edit this to enable the laser cutter to follow the lines we would like to cut. This involves editing the line thickness, deleting all the 'filled in areas' and lines we do not want the laser cutter to cut.

Finally we'll stick it in CorelDraw and laser cut it.

Finding an Image

To make your life easier, it is best to start with images that have only a few colours, and which are flat. i.e. no gradients or noise.

For demonstration purposes I have not made my life easier, I have picked this image:
Although this image has gradients, we can fix it in Photoshop to make it a flatter image

Fine-tuning the image before using Illustrator

I will open the image in Photoshop. To make the image have less colours (I count the gradient as many colours) we can do a few things:
  1.  If it is just one shaded colour, you can use threshold
    1. Click on the threshold button in the Adjustments panel on the leftIt's in the bottom row of icons in the middle
    2. It will add an adjustment layer in photoshop and take you to editing it. This panel should now look like this
    3. And your image should now be black and white:
    4.  Underneath the graph there is a slider, if you slide it around you should be able to get a good black and white image:
    5. Heres where I moved the slider to:
    6. If you are happy with it, you can save as a JPEG image and move onto the next Chapter "Converting Pixel Image into Vector Image"
  2. If these last few steps didn't bode well, then we will try a different 'filter'
    1. We will use the 'Cutout' filter, accessed in the menu 'Filters > Artistic > Cutout...
    2.  You will see these sliders:
    3. Move them about until you have however many colours you need. Your image should look flat (no gradients) like this:
    4. Save your file as a JPEG image and close Photoshop.

Converting Pixel image into Vector Image

Now we can open our image in Illustrator and convert it:
  1. Open Illustrator
  2. Open your file
    1. Go to the menu "File > Open" and find your file
  3.  It will place your image on a sheet of paper. Click on the image and you will see the top bar change and a "Live Trace" button will appear
  4. Click "Live Trace" and your image should change to Black and White and the top bar will change once more:
  5. You can change the "Threshold" and "Min Area" numbers to change how it converts your image
    1. You will find that the flatter your image is, the better the results will be
  6. To just get the outlines of the image, we need to click the "Tracing Options Dialogue" which is the small button at the top, next to the "Custom" dropdown box. The dialogue box should look like this:
    1.  Uncheck the Fills box
    2. Check the Strokes box
    3. Check the Ignore white box
  7.  When you click OK, your image should look like this:
  8. When you are happy, click the "Expand" button at the top:
  9. You will now be able to see the points and lines Illustrator has created. It naturally strokes the line with a thickness of 1pt. We want make the thickness 0.01pt as this is what the lasercutter likes.
    1. Change the 'Stroke' number in the top bar to 0.01pt (it's not in the dropdown box, you have to manually type it in)
  10. Now we must Save
    1. Go to File > Save as
    2.  Save it as an Illustrator Document (.ai)
    3. Click save
    4. On the dialogue box with more options on:
    5. Uncheck "Use Compression"

Laser Cutting


Now we are ready to use CorelDraw to layout our artwork and send to the laser cutter
    1. Login to the lasercutter computer
      1. Username: .\lasercutter
      2. Password: lasercutter
    2.  Load up CorelDraw X4 (icon is at the bottom next to start menu)
    3.  CorelDraw makes you a new document which is 40cm by 30cm
    4. Import your image
      1. go to File > Import
      2. find your image and click import
      3. Click OK if it asks you any questions
    5. Its easier if you group you artwork lines together.
      1. right click on your artwork and select Group
    6. Position your artwork so it will line up with the material you put in the lasercutter
    7. Now you're ready
    8. Before we send the whole thing, we need to do test cuts.
    9. Make a small square using the square tool.
    10. In the bottom right corner, double click the black box and change the stroke to "Hairline"
    11. Click OK
    12. go to File > Print
    13. Check the box which says "selection"
    14. Click on Properties
    15. Go to the Advanced tab and find a preset which most resembles your material.
    16. Click it and click "Load"
    17. Now it should have updated the setting on the previous tab. Go back to this one
    18. Make sure the Vector check is marked
    19. Have a look at the speed and power settings in the vector section (bottom right)
    20. Click OK
    21. This takes you back the print window. Click "Print" (make sure the lasercutter is on and connected)
    22. Open the lasercutter and put in your material.
    23. Click Focus button and use up and down arrows until measuring tool brushes the surface of the material
    24. Click the Job button and you should see your file as JOB1:graphic1.cdr
    25. Switch on Extractor fan (big green button)
    26. Press GO!
    27. When machine beeps it's finished.
    28. Check whether it was a good cut
    29. If not, readjust settings (12.) and retry.
    30. When it is a good cut, select your work and go through the last steps to send it.
Cheers

Saturday, 21 February 2015

drupal views link to another view

I have a view which shows a list of a content type. When the content is clicked I want to show another view of that content.

The reason is I want to make use of the css layout I've already made with a views slideshow, and I would like to duplicate it with another view of just one item.

I have found this question, which is answered linking to these places about arguments.

I worked it out in the end. Although I did have trouble to begin with because I got all the settings correct and it still didn't work. But on creating a new view with the same settings it worked. It might have been due to the url having several 'layers' to it.

Basically:
  1. Sort out your page
  2. add 'contextual filter'
    1. I did a taxonimy term.
  3. test out in preview panel.

Thursday, 12 February 2015

Blender render farm - built in Network renderer

Well, I tested this last year, but I can't believe it, I can't find any mention of me doing it. It either means I forgot to write it up, or didn't write it up in this blog! Oh well, here's a new writeup:

The only files I have to go from are two files named:
master.blend
slave.blend

Basically, these files have presets in them, so whichever machine opens them either becomes the master or the slave.

Here's a document I found which has 'slave.blend' mentioned in it, looks very promising.

  1. First thing is to load blender, and load the Network Renderer plugin. Go to:
    1. File > User Preferences > Render > Network render > tick:
  2. Up the top, next to File, Edit menus, there is a dropdown usually on "Scene". Select "Network Render":
  3. On the far right you should see the Network Render settings:
  4. Click Master on the machine you want to control jobs. Make sure it's a machine which is always on, perhaps with storage space which can be shared to other machines (not worked out where rendered files are stored)
    1. Click Start Service
  5. You can now view the jobs and clients connected to the master by browsing to the webpage:
    1. http://ipAddressOfMaster:8000:
      1. I had trouble with this, but found it was because I was on the master machine and so had to type:
        1. http://localhost:8000/
      2. There is also a newer jquery interface: /html/newui#interface:
  6.  Now start another machine as a slave
  7. On the final machine, load up a nice file and click "Send Job":
  8. The systems so good, the end files end up where-ever you said for the output (at the bottom of the client list). You can even download renders from previous jobs!!

Now that I got it all working, the plan was to save a master.blend file and a slave.blend file and have them load up when the machines are started, from command line. Here it goes:

 To run the master:
/Applications/Blender\ 2.73a/blender.app/Contents/MacOS/blender -b /Users/Shared/master.blend --addons netrender -a -noaudio -nojoystick

The slave:
/Applications/Blender\ 2.73a/blender.app/Contents/MacOS/blender -b /Users/Shared/slave.blend --addons netrender -a -noaudio -nojoystick 

Seems to work very nicely. One thing to note is that the IP address of the master has to be saved in the slave.blend file. I don't know how to add this through the command line.

The next thing is to get the slave.blend command to launch at system startup, and run as root.

Found this question and answer in stackoverflow 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>uk.ac.chesterfield.dci.blender.client</string> <!-- org.mongodb.mongodb perhaps? -->

    <key>KeepAlive</key>
    <true/>
  
    <key>RunAtLoad</key>
    <true/>
  
    <key>ProcessType</key>
    <string>Background</string>

    <key>UserName</key>
    <string>root</string>

    <key>ProgramArguments</key>
    <array>
            <string>/Applications/Blender 2.73a/blender.app/Contents/MacOS/blender</string>
            <string>-b</string>
            <string>/Users/Shared/slave.blend</string>
            <string>--addons</string>
            <string>netrender</string>
            <string>-a</string>
            <string>-noaudio</string>
            <string>-nojoystick</string>
    </array>
</dict>
</plist>

Sunday, 8 February 2015

jquery pullout slide animation

This is my first lesson in jquery.

Basically what I want is a slider which is mostly hidden on the left, and when you hover over it pulls out to reveal all.

After going on W3CSchools for 30 mins I botch'd up this code:

$(document).ready(function(){$("#square").hover(function(){ $("#square").animate({ left: '+=100px' }); }, function(){ $("#square").animate({ left: '-=100px' }); }); });

Saturday, 7 February 2015

Drupal views slideshow image as css style background

Thought I'd document this as I will probably do this in future developments.

I wanted a views slideshow, with the images appearing full screen with text ontop. It appears simple at first but actually required more digging.

Backstretch does not work with views slideshow, as it applies the image background to elements not within the slideshow.

I found a slightly helpful article which suggested a fix, but later found the forum from where more helpful information was taken.

to sum it up, you need views to output the url of the image for the field, and then use a views template override to get this url and 'render' it inside a html element as the background-image style.

To do this:

  1. Get views to output the url of the image
    1. in the views view, add a Relationship
      1. this needs to be a 'File Usage: file'
    2. next add a field '(file) File Path
      1. in this field, tick the box titled:
        1. Display download path instead of file storage URI
  2. Now to render this URL inside a HTML element you need a template override
    1. In views veiw, go to 'Other' > 'Theme' > 'Information'
      1. find the template override for the field
      2. create a new file with that exact name and place it in your theme
    2. inside this file paste this:
      1. <div class="mainImage" style="background-image:url('&lt;?php print $output;?&gt;');">&lt;!--<img src="&lt;?php print $output;?&gt;"style="visibility:hidden; "></img>--&gt;</div>
    3. Done
You can now style this .mainImage div as:
.mainImage {
position: fixed;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
z-index: -2000;
background: no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

sorted.

It now changes with the views slideshow.

Wednesday, 28 January 2015

Drupal Slideshow with text overlay

I have a content type which I has a main picture and some intro text and a title. I would like to 'slideshow' this full screen, with the text of each one over the top of the image, and the title at the top of the page. With thumbnails of all down the side, clickable.

I've seen this post which describes doing it with Views Slideshow, as demo'd here. I shall give it a go presently.

it involves adding a folder into the server. Look at the error when you try and enable the module.

After the install all appeared very nice and worked almost swimmingly.

Drupal restore from backup

well, I've been drupal'ed. Time to restore. thought I'd export content type and content. Here's how:

http://drupal.stackexchange.com/questions/39417/export-content-types-using-features

http://drupal.stackexchange.com/questions/20498/export-content-in-features-using-uuid-features

couldn't do the second of these tutorials as it was written in 2012 and I think things have changed.




Here's what I did to restore:


  1. Downloaded the database (for backup)
  2. downloaded all files (for backup)
  3. downloaded the new drupal
  4. uploaded all new drupal files (replacing old files)
  5. done
It was a while ago I did this so I'm not entirely sure but try this first next time.

Navigating to a viagra link came up with 'no such page'.

Sorted