The simplest DIY CNC machine. Is it possible to make a CNC machine with your own hands? The principle of operation of the coordinate system

The note: The adaptive version of the site is activated, which automatically adapts to the small size of your browser and hides some details of the site for ease of reading. Enjoy watching!

Hello dear guests and regular readers of the blog about website creation - Site on! In one of the previous articles in this section, I promised to tell you how you can create your own CNC links in just a couple of minutes. Despite the fact that the article may seem voluminous to you, and for some, complicated, I hope that when you read it to the end, you will agree that there is really nothing supernatural in creating a CNC.

CNC– this is a distorted English abbreviation (search engines friendly url). It denotes link addresses that are search engine friendly. I also wrote about CNC in an article about. In the Russian version, SEF URL is written as CNC - human-readable url. What does all of this mean? This means that the addresses of your links will have conscious text, and not technical garbage; for an example, you can follow the link above.

What are the benefits of SEF URLs?

Secondly, SEO. Such links are welcomed by search engines; a couple of years ago they could have given you a significant advantage over your competitors. Today, such links are taken for granted; now you rarely see sites with non-CNC links, but they still exist.

Third, this is prestige. When I go to sites where, instead of a clear and beautiful address, the links contain all sorts of garbage, or even classified information, I ask myself the question: “It seems like a decent site, but why didn’t the developers make a CNC? Was it really that difficult? Maybe they just don’t care about such things or just lack knowledge and skills?” In general, such sites are a big mystery to me.

Fourthly, safety. Sites with CNC links do not contain in their address technical information transmitted by the GET () method, which can easily be used to hack the site.

And lastly: CNC – as a means of navigation. If the link is clear to the user, then he can navigate through sections of the site by simply editing your URL. For example:

Http://site/useful/2-sublime-text-2

Http://site/useful/ Options +SymLinksIfOwnerMatch

RewriteEngine On

We have the following .htaccess file:

mod_rewrite terms and conditions

All rules are written using the command RewriteRule, followed by a space and written sample your CNC using regular expressions, then put another space and indicate the line into which we want to convert this template, where $1,$2,...$n are our variables. You can find out more about it at the link above, as well as later in this article. Let's look at an example:

RewriteRule ^useful/(*) /index.php?category=useful&article=$1

Where ^useful/(*)– this is the expected url template,

A /index.php?category=useful&article=$1– this is what we convert it into if the incoming URL matches the template.

Wherein $1 equal to what is written in parentheses, that is $1 = * If the parentheses appeared 2 times, then we would have the variable $1 and $2, if the parentheses appeared 3 times, then the variables $1, $2, $3 and so on. In this case, the variables are created in the same order as the parentheses appear.

It's clear? - Well done. Unclear? - Move on, we’ll come back to this. I would also like to draw your attention to the fact that in order to better understand the article, you should already have basic knowledge of PHP, as well as working with the GET and POST methods. Let's continue.

In order for our handler, that is, mod_rewrite did not work every time unnecessarily, we are in RewriteRule We indicate the template that incoming URLs must match. If the URL doesn't match the pattern, then mod_rewrite simply won't work and won't convert the incoming SEF URL into a URL we can work with.

That is, at this stage it is important for you to understand the very essence: parameters are not passed in CNC links, and without parameters we cannot do anything in PHP with this link, so using mod_rewrite we convert CNC link without parameters V not CNC link with parameters. What are the parameters? In the example above we have 2 parameters:

/index.php?category=useful&article=$1

Parameter category and parameter article.

Again, I would like to draw your attention to the fact that you should already know about the parameters; I only briefly reminded you.

In templates we can use symbols And character classes. The dot symbol represents absolutely any symbol.

  • . – any single character
  • is a character class. Indicates the presence of one of the listed characters, case sensitive.
  • – character class. Indicates the presence of one of the symbols between a before z, that is, the entire English alphabet.
  • - the same thing, only without taking into account the case, that is, the entire alphabet, including both large and small letters.
  • You can also use numbers:
  • Naturally, everything can be combined:
  • [^rewfad]– a character class, but with a ^ sign inside square brackets indicating that the pattern must NOT contain these characters.
  • site|cite– denotes an alternative: site or cite are suitable.

Quantifiers or quantifiers

All previous examples denoted one character (one unit), but what if we want to show that there can be not one, but as many characters from this interval as desired. To do this we must use quantifiers:

  • ? - 0 or 1 character from the previous text (character class, symbol, etc.)
  • * — 0 or any number of characters from the previous text (n>0)
  • + — 1 or any number of characters from the previous text (n>1)
  • (n)— exactly n characters, where n is a specific number.

For example:

  • {4} - must be exactly 4 characters from the previous text.
  • {4,5} — 4 or 5 characters
  • {,6} — from zero to 6 characters
  • {4,} — from 4 to infinity characters

An example is our already famous line:

RewriteRule ^useful/(*)

In which we applied the quantifier (quantifier) ​​asterisk (*) after the character class. This means that in our URL after useful/ There may be symbols from a to z in any number and, naturally, in any sequence, or they may not exist at all. We don’t take the domain into account, it is meant by itself.

Shielding

Also, when creating a template, do not forget about . If you want to enclose, for example, a dot character in a character class, then you need to escape it, since without escaping a dot (service character) means absolutely any character:

The same applies to square brackets, they denote a character class, so if your url may contain square brackets, they need to be escaped:

Start and end of line constraint (markers)

To indicate the beginning or end of a line, regardless of the domain, the following symbols are used:

  • ^ - start of URL
  • $ - end of URL

That is, in our first example, we indicated that our template starts exactly from the beginning of the URL, and not from anywhere (from the middle, from the end):

RewriteRule ^useful/()

Draw your attention Don't be confused by the fact that the ^ sign inside square brackets means negation!

Feedbacks in mod_rewrite

$n– this is our “variable” in parentheses, we have already talked about them. Works for RewriteRule.

%n- the same thing, only in RewriteCond. We haven’t looked at RewriteCond yet, it’s ahead of us.

So if RewriteRule are our URL translation rules, then RewriteCond– this is a condition, an analogue of . RewriteCond is needed in situations where you need to perform a URL transformation (RewriteRule) only when some condition is met.

The server has its own variables that we can use in our RewriteCond conditions:

HTTP headers:
HTTP_USER_AGENT
HTTP_REFERER
HTTP_COOKIE
HTTP_FORWARDED
HTTP_HOST
HTTP_PROXY_CONNECTION
HTTP_ACCEPT REMOTE_ADDR

Connection and request:

REMOTE_HOST
REMOTE_USER
REMOTE_IDENT
REQUEST_METHOD
SCRIPT_FILENAME
PATH_INFO
QUERY_STRING
AUTH_TYPE

Inside the server rooms:

DOCUMENT_ROOT
SERVER_ADMIN
SERVER_NAME
SERVER_ADDR
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE

System:

TIME_YEAR
TIME_MON
TIME_DAY
TIME_HOUR
TIME_MIN
TIME_SEC
TIME_WDAY
TIME

Special:

API_VERSION
THE_REQUEST
REQUEST_URI
REQUEST_FILENAME
IS_SUBREQ

The syntax for using server variables is:

%(variable)

Let's create our first condition:

RewriteCond %(HTTP_USER_AGENT) ^Mozilla.* RewriteRule …

If the visitor came from the Mozilla Firefox browser, then we execute the following rule. As you can see, unlike PHP, we do not use curly braces to frame our rule, which will be executed if the condition is TRUE.

RewriteCond allows you to use comparison operators:< (меньше), >(greater than), = (equal). There are also special meanings, for example:

  • -d (is it a directory)
  • -f (is it a file)
  • -s (whether the file is a non-zero size)
  • ! – denial.

Flags

  • nocase|NC– you can write either nocase or NC, this is the same thing, it means case-insensitive. That is, we can no longer write:
RewriteRule ^useful/

Instead write this:

RewriteRule ^useful/

  • ornext|OR– if this or the following condition is TRUE, then we execute RewriteRule. Example:
  • RewriteCond %(REMOTE_HOST) ^host1.* RewriteCond %(REMOTE_HOST) ^host2.* RewriteCond %(REMOTE_HOST) ^host3.* RewriteRule …
  • Last|L- the last rule. If the rule is applied, then the rules located below in the code will not work.
  • next|N– some analogue of continue. If the rule is applied, it forces all the rules to be played from the very beginning, but with the already converted string.
  • redirect|R– redirect. The default is 302. You can specify a different redirect code, for example:
  • forbidden|F– The URL becomes prohibited.
  • gone|G– sends a 410 server response.
  • chain|C-connection. If a rule does not fire, then the rules associated with it will not automatically work either.
  • type|T– MIME type. Forced setting of file type. You can pass off one file extension as another :) For example, we have files with the extension .zip, but in fact they are pictures, so to give these files as pictures (.png, .gif, etc.), you can use this flag .
  • skip|S– skip the next rule, you can specify several at once, for example:
  • env|E=VAR:VAL– set the environment variable.
  • cookie|CO– send cookies.
  • If you need to set several flags at the same time, put them separated by commas, for example:

    As you might have guessed, mod_rewrite can be used not only for CNC, but also for many other interesting purposes, for example, cloaking- This is a black hat SEO method, when one page is given to visitors at the same address, and a completely different one to search robots. Well, at the end of the article, I will show you a live example of using everything written above and how it all works interacting with our PHP.

    Live example of using mod_rewrite

    So, this is what my .htaccess file looks like:

    Options +SymLinksIfOwnerMatch RewriteEngine On
    RewriteCond %(HTTP_HOST) ^www\.(.*)$ RewriteRule ^(.*)$ http://%1/$1
    RewriteCond %(HTTP_HOST) ^[^www\.].*$ RewriteRule ^/?(+)/?$ /index.php?article=$1 [L]

    What's going on in this horror? To begin with, I check whether the old-school person has typed my address with www; if he has, then I redirect him to the same address, only without www. I will write why exactly this is needed in one of the following articles; in short, for SEO. After redirecting from www to non-www, our .htaccess file was read again, so everything starts again: we check if we received a URL with www, this time - no. Next (second RewriteCond) we check if our URL is indeed without www, then we make transformations, namely: we enter the entire URL (without the domain name) in the article parameter.

    At this point, the work of .htaccess is completed and PHP comes into the picture. The following code is located in index.php:

    If (!empty($_GET["article "]))( // check the article parameter for emptyness switch($_GET["article "])( case "value1": $page = "path to php file1 of our page";break; case "value2": $page = "path to php file2 of our page";break; case "value3": $page = "path to php file3 of our page";break; ... ) include $page; // connect the required file, depending on the received article parameter }

    I wrote in detail about how it works in the article at the link provided. That's it, ladies and gentlemen! Finally, our article has come to its logical conclusion, and now you can practice the knowledge you have acquired. I say goodbye to you before the release of a new article, and finally I want to give you an interesting quote:

    “Despite tons of examples and documentation, mod_rewrite is Voodoo. Damn cool Voodoo, but still Voodoo."

    The world of the Internet is developing rapidly and conquering new heights. Millions of sites, services and services are happy to welcome another user to their pages. A huge number of addresses have been created that are generated automatically. And it’s not always convenient to read and remember them. In addition, a meaningless set of characters ranks poorly in search engines. As a result, it became necessary to introduce the implementation of the code in such a way that it could appear in a more convenient and pleasing form to the user's eye.

    Therefore, in the world of web development, the term CNC links appeared. What this is and how to implement it will be discussed in the article.

    What are CNC links

    In general, CNC is a slang word meaning a human-readable URL. URL - borrowing from the English URL, a uniform resource locator. Human-readable, in turn, means a set of characters in the address bar that is convenient and easy to understand. For example, the generated page address might look like this: http://example.com/index.php?page=name. It doesn’t look very clear and doesn’t show the structure of the site. There are signs that do not carry a semantic load and it is unclear what the page and name mean.

    The following URL might look like this: http://example.com/products/new/boat. It is clear here that we are talking about products, and new ones at that, and specifically about a boat. This is a human-readable URL. It is much better indexed by search engines and is shown in search results above the rest. And a person who visits the site will be able to understand that he has entered exactly the right section.

    However, CNC links have some limitations. For example, Russian characters cannot be used in the address. They are replaced with a numeric value and a percent sign. Therefore, domestic developers use transliteration of Russian words into Latin. For example, so - oborudovanie or produkcia. Also, an automatically generated CNC link can increase the overall length of the line.

    To implement transliteration and conversion to human-readable URLs, special tools are used. They are available, as a rule, in content management systems - CMS. CNC links are created automatically, based on the name of the product, article or blog, as well as the section in which it is posted. As a result, when creating a new record or adding a product, a human-readable URL is formed, which is well perceived by both people and machines.

    How to make CNC links in popular CMS

    CMS is a content management system that, in a convenient and simple interface, allows you to create a full-fledged website in a short time. The functionality is expanded due to the presence of a large number of ready-made templates, modules and plugins. This allows a person who is far from the programming languages ​​PHP, JavaScript, HTML and related ones to quickly create his own website or blog.

    Almost all content management systems have an excellent set of tools in the form of plugins for creating CNC. It is worth taking a closer look at the most common of them.

    • WordPress is the most popular content management system, according to statistics. It is installed on most famous blogs and websites. It is famous for its ease of learning and installation.
    • Joomla is less popular, but is still actively used among developers. It has good functionality, a selection of components, plugins and modules.
    • OpenCart is a separate project for creating online stores. Internally it resembles any CMS, but is “tailored” to solve a narrow range of tasks.

    CNC Links in WordPress - Easy to Implement

    WordPress is probably the simplest content management system out there. It can greatly simplify the creation of a website or blog from scratch in a short time.

    Setting up CNC in WordPress is simple and basically involves downloading and installing the Cyr-To-Lat plugin. It is used to convert Cyrillic strings to Latin.

    First you need to find it and download it. It is better to do this from the official WordPress website. This way you can avoid the possibility of malicious or adware code getting into the plugin.

    • After downloading the archive, you need to unpack it.
    • Then you need to move this folder to the wp-content -> plugins section. This is usually done using any available FTP manager.
    • Now you need to log into the WordPress admin panel by entering your username and password.
    • In the “Plugins” section you need to find Cyr-To-Lat and activate it. The plugin is now installed on the system and enabled.
    • To do this, go to “Options”, and there go to “Permanent Links”.
    • In the general settings there are several templates that you can use to build the appearance of the link. It is recommended to use the “Custom” type, which allows you to configure everything as needed. The simplest design for such a template is /%category%/%postname%/. This means that the category will be displayed in the address bar, followed by the title of the post.
    • And then Cyr-To-Lat converts all this into Latin. As a result, you will get a beautiful and understandable CNC link in WordPress.

    In addition to Cyr-To-Lat, you can also use analogues that are available on the official website. For example, these are WP Translitera, ACF: Rus-To-Lat, Rus-To-Lat Advanced. Installing these plugins is similar, so it makes no sense to dwell on them separately.

    CNC in Joomla, several options for creating

    Joomla is a slightly more complex content management system. Just like WordPress, it has the ability to create websites and blogs in a short time. It has extensive functionality and flexibility. Next, you need to describe how to make CNC links in this CMS.

    Joomla initially has built-in functionality for creating human-readable URLs. CNC links in Joomla 3 can be enabled on the general settings page in the “SEO Settings” section. The item “Enable SEF (CNC)” should be set to “Yes”. This way the links will be converted into a more understandable form.

    Here you can additionally set up URL redirection by creating a CNC link in htaccess. This file acts as a configuration storage for the Apache web server. In it, you can use regular expressions and the RewriteRule directive to change the conversion of the link to the desired URL. The main difference between this approach is flexibility. You can give links to almost any type.

    The “Add suffix to URL” item adds the document extension to the end of the line. For example, html. This extension is of little interest to the average website visitor, so the option can be left in the “No” position.

    Aliases in Unicode - this item transliterates the name of the material into Latin. This is necessary so that instead of Russian letters or other symbols something awkward and unreadable is not displayed.

    Alternative components for Joomla

    You can also implement a CNC link generator in Joomla using various components. For example, one of the popular ones is JoomSEF. It is distributed free of charge and it is better to download it from the official Joomla website.

    Its functionality, in addition to converting URLs into CNC, includes a set for generating metadata, search engines, keywords, as well as managing duplicate pages. It is worth noting the available support for UTF-8 encoding and customization of the 404 page at your discretion.

    There are three installation methods available in Joomla 3: downloading directly from your computer, from the site directory, and by sending a link to it.

    For the first option, you will have to download the file. Then select “Extensions” from the CMS administrative panel menu and go to “Extensions Manager”. Using the “Select file” button, you need to show the system the prepared archive and install it.

    The second option is rarely used. But the third is the most convenient of them, since it does not require downloading. You just need to copy the link to JoomSEF and specify it in the “Install from URL” field on the tab of the same name. The system itself will check for its presence and install it if all parameters match.

    It is worth noting that for the add-on to work fully, the “Enable SEF”, “URL Redirection” and “Add suffix to URL” items in the SEO settings must be set to “Yes”.

    The installed component will immediately be integrated into the system in active mode and begin its work. Namely, it converts all existing links into a more aesthetic appearance.

    JoomSEF has a large number of settings and options. With their help, you can very subtly bring all the site links to almost any necessary form.

    JBZoo and a human-readable URL

    The JBZoo component is a universal and powerful tool for creating online stores, catalogs, blogs and simply business card sites based on the Joomla content management system.

    To install JBZoo in Joomla, it must already have the Zoo add-on.

    Sometimes the standard SEF settings don't reach their components enough to perform the conversion. Therefore, it is recommended to use the sh404SEF component to create CNC links in JBZoo. This product is free and is a good tool for building links in JBZoo. settings, functions, support for various social networks and services.

    Installation is done by copying the link to the archive, or by directly uploading a previously downloaded file to the server.

    OpenCart and CNC setup

    OpenCart is a platform that is not tied to any content management system. That is, it functions separately. Its main focus is the convenient creation of online stores of varying degrees of complexity. Although the product itself is free, many add-ons are distributed on a commercial basis. The latest stable version is 2.0.

    You can start setting up the CNC in the first way by editing the htaccess configuration file of the Apache web server.

    • To do this, you need to go to the site folder via FTP or the file manager available in the administrative memory.
    • The root directory should contain the .htaccess.txt file. Since it has no effect on a system with a txt extension, the first thing to do is rename it to .htaccess. Now the web server will read its directives and execute them.
    • Now you need to go to the site settings and on the “Server” tab enable the use of CNC.
    • All changes must be saved.
    • Now all links should change.

    Sometimes, due to some reasons, many addresses still do not change and remain unclear. To implement this task, you can use the SeoPro component. True, before installing it you will first have to implement OCMOD Multiline Fix. To do this, you need to manually change the code of one file. It is located at admin/controller/extension/modification.php. To edit it, it is recommended to use the Notepad++ utility to avoid problems with encodings.

    You only need to add one line of code to the block after the $limit variable. It looks like this:

    • $quote = $operation->getElementsByTagName("search")->item(0)->getAttribute("quote");
    • if (!$limit) (
    • $limit = -1;

    and after it add:

    • if ($quote == "true") (
    • $search = preg_quote($search);

    Then you need to actually install the SeoPro module itself. The downloaded archive must be unpacked on the server. Then run a couple of database queries using phpmyadmin:

    • ALTER TABLE `oc_product_to_category` ADD `main_category` tinyint(1) NOT NULL DEFAULT "0"; ALTER TABLE `oc_product_to_category` ADD INDEX `main_category` (`main_category`);

    Now we need to edit the main index.php file. The line you are interested in is:

    • $controller->addPreAction(new Action("common/seo_url"));

    which is replaced by:

    • if (!$seo_type = $config->get("config_seo_url_type")) (
    • $seo_type = "seo_url";
    • $controller->addPreAction(new Action("common/" . $seo_type));

    Next, there is a set of procedures related to settings inside the admin panel. In the menu you need to find “Modules”, go to “Modifiers” and click on updates. While here, you need to go to the “Modules” list and install SeoPro in it. Then, by clicking the “Edit” button, go into it and save. After all the manipulations, everything should work; if not, then you need to try reinstalling the module again. Or seek help from specialized forums.

    Implementation of CNC functionality in PHP language

    Most sites on the Internet are written in PHP. It is quite powerful, convenient and easy to learn. Its work is invisible to the user, since the PHP code is processed on the server side and a ready-made HTML page that is understandable to the browser is sent to the browser.

    You can show the implementation of CNC links in PHP using a small code example. However, to bring address lines in real multi-page projects to a human-readable form, you will have to tinker.

    Any website starts its work with the index.php file. It also generates hits to other pages of the site. But first you need to change the htaccess configuration file a little. In it you need to specify or uncomment several directives, as shown in the photo.

    The first line allows you to resolve the URL using the server. The second one sets the base address. The next two lines check for the presence of the file and folder. The latter transfers control to index.php if lines 3 and 4 are implemented without errors.

    To store the correspondence between the page id and its converted value, a table is needed. Therefore it must be created. In particular, you can create a simple one to understand the process. It will contain two fields: SEF and page_id. SEF stores the name and is of type varchar. And page_id are page numbers of type int.

    Now it remains to correct the index.php file itself. This is just an example and in practice for a specific project everything may be slightly different: $result = $_SERVER["REQUEST_URI"]. In this line, the requested URL is transferred to the $result variable.

    • if (preg_match ("/([^a-zA-Z0-9\.\/\-\_\#])/", $result)) ( header("HTTP/1.0 404 Not Found"); echo " Invalid characters in URL"; exit; )

    This block checks for the presence of symbols, numbers and some signs. If there is something other than those listed, then a 404 page is displayed.

    • $array_url = preg_split("/(\/|\..*$)/", $result,-1, PREG_SPLIT_NO_EMPTY);

    An array $array_url is declared here, into which, using the preg_split function, elements that do not have anything extra in the CNC are placed.

    • if (!$array_url) ( $ID_page = 1; )else( $sef_value = $array_url;

    Here the request is processed in the case when the request was made not to a specific page, but to a domain. Therefore, you need to respond with id = 1. Also at this point there is a query to the project database, which finds out whether it has a value from the $sef_value variable in the SEF field. If nothing is found, send the user a 404 page. At the end, the resulting address code is processed and the corresponding materials or elements are returned.

    Pros and cons of using CNC

    The advantages of using human-readable URLs can be listed as follows:

    • the link visually looks more aesthetically pleasing than a set of incomprehensible symbols, especially on unfamiliar sites;
    • remembering the address is much easier;
    • the entire path and structure of the site becomes clear;
    • GET parameters transmitted in the usual way use variables in the address line, which is not the case in the CNC, which means that security is not violated;
    • improving site navigation;
    • SEO optimization improves significantly and search robots index such a site better.

    There are far fewer disadvantages. And the most significant of them is setting. It is not always possible to bring page addresses to a human-understandable form using standard or third-party solutions. Sometimes you have to delve into the code and edit it yourself, which requires knowledge and time. The second drawback is not so significant and concerns sites with high traffic. Due to the formation of links on the fly, the load on the site increases. But since the cost of network equipment is steadily decreasing, few people consider such costs for server resources. In general, the advantages far outweigh the disadvantages, so although human-readable URLs are difficult to implement, they are worth using.

    Conclusion

    The article discusses which links are CNC and which are not. The simplest and fastest solutions to the problem were described in detail. As well as several of the most affordable options for complex approaches. In any case, using a CMS when developing a website significantly reduces labor and time costs when optimizing page addresses. Therefore, a combination of CMS and CNC should be used as the most effective alternative to manual development.

    And so, as part of this instructional article, I want you, together with the author of the project, a 21-year-old mechanic and designer, to make your own. The narration will be conducted in the first person, but know that, to my great regret, I am not sharing my experience, but only freely retelling the author of this project.

    There will be quite a lot of drawings in this article., the notes to them are made in English, but I am sure that a real techie will understand everything without further ado. For ease of understanding, I will break the story into “steps”.

    Preface from the author

    Already at the age of 12, I dreamed of building a machine that would be capable of creating various things. A machine that will give me the ability to make any household item. Two years later I came across the phrase CNC or to be more precise, the phrase "CNC milling machine". After I found out that there are people who can make such a machine on their own for their own needs, in their own garage, I realized that I could do it too. I must do it! For three months I tried to collect suitable parts, but did not budge. So my obsession gradually faded.

    In August 2013, the idea of ​​​​building a CNC milling machine captured me again. I had just graduated from a bachelor's degree in industrial design at university, so I was quite confident in my abilities. Now I clearly understood the difference between me today and me five years ago. I learned how to work with metal, mastered techniques for working with manual metalworking machines, but most importantly, I learned how to use development tools. I hope this tutorial inspires you to build your own CNC machine!

    Step 1: Design and CAD model

    It all starts with thoughtful design. I made several sketches to get a better feel for the size and shape of the future machine. After that I created a CAD model using SolidWorks. After I modeled all the parts and components of the machine, I prepared technical drawings. I used these drawings to make parts on manual metalworking machines: and.

    Frankly speaking, I love good, convenient tools. That is why I tried to make the maintenance and adjustment operations of the machine as simple as possible. I placed the bearings in special blocks in order to be able to quickly replace them. The guides are accessible for maintenance, so my car will always be clean when the work is completed.




    Files for downloading “Step 1”

    dimensions

    Step 2: Bed

    The bed provides the machine with the necessary rigidity. A movable portal, stepper motors, a Z axis and a spindle, and later a working surface will be installed on it. To create the supporting frame I used two 40x80mm Maytec aluminum profiles and two 10mm thick aluminum end plates. I connected all the elements together using aluminum corners. To strengthen the structure inside the main frame, I made an additional square frame from profiles of a smaller section.

    In order to avoid dust getting on the guides in the future, I installed protective aluminum corners. The angle is mounted using T-nuts, which are installed in one of the profile grooves.

    Both end plates have bearing blocks for mounting the drive screw.



    Support frame assembly



    Corners for protecting guides

    Files for downloading “Step 2”

    Drawings of the main elements of the frame

    Step 3: Portal

    The movable portal is the executive element of your machine; it moves along the X axis and carries the milling spindle and Z axis support. The higher the portal, the thicker the workpiece that you can process. However, a high portal is less resistant to the loads that arise during processing. The high side posts of the portal act as levers relative to the linear rolling bearings.

    The main task that I planned to solve on my CNC milling machine was the processing of aluminum parts. Since the maximum thickness of the aluminum blanks that suit me is 60 mm, I decided to make the portal clearance (the distance from the working surface to the upper cross beam) equal to 125 mm. I converted all my measurements into a model and technical drawings in SolidWorks. Due to the complexity of the parts, I processed them on an industrial CNC machining center; this additionally allowed me to process chamfers, which would be very difficult to do on a manual metal milling machine.





    Files for downloading “Step 3”

    Step 4: Z Axis Caliper

    For the Z axis design, I used a front panel that attaches to the Y axis motion bearings, two plates to reinforce the assembly, a plate to mount the stepper motor, and a panel to mount the milling spindle. On the front panel I installed two profile guides along which the spindle will move along the Z axis. Please note that the Z axis screw does not have a counter support at the bottom.





    Downloads “Step 4”

    Step 5: Guides

    Guides provide the ability to move in all directions, ensuring smooth and precise movements. Any play in one direction can cause inaccuracy in the processing of your products. I chose the most expensive option - profiled hardened steel rails. This will allow the structure to withstand high loads and provide the positioning accuracy I need. To ensure the guides were parallel, I used a special indicator while installing them. The maximum deviation relative to each other was no more than 0.01 mm.



    Step 6: Screws and Pulleys

    Screws convert rotary motion from stepper motors into linear motion. When designing your machine, you can choose several options for this unit: a screw-nut pair or a ball screw pair (ball screw). The screw-nut, as a rule, is subjected to more frictional forces during operation, and is also less accurate relative to the ball screw. If you need increased accuracy, then you definitely need to opt for a ball screw. But you should know that ball screws are quite expensive.

    The goal of this project is to create a desktop CNC machine. It was possible to buy a ready-made machine, but its price and dimensions did not suit me, and I decided to build a CNC machine with the following requirements:
    - use of simple tools (only a drill press, band saw and hand tools are needed)
    - low cost (I was focusing on low cost, but still bought elements for about $600, you can save a lot by buying elements in relevant stores)
    - small footprint (30"x25")
    - normal working space (10" along the X axis, 14" along the Y axis, 4" along the Z axis)
    - high cutting speed (60" per minute)
    - small number of elements (less than 30 unique)
    - available elements (all elements can be purchased in one hardware store and three online stores)
    - possibility of successful processing of plywood

    Other people's machines

    Here are a few photos of other machines collected from this article

    Photo 1 – Chris and a friend assembled the machine, cutting out parts from 0.5" acrylic using laser cutting. But anyone who has worked with acrylic knows that laser cutting is good, but acrylic does not tolerate drilling well, and this project has a lot of holes They did a good job, more information can be found on Chris's blog I especially enjoyed making a 3D object using 2D cuts.

    Photo 2 - Sam McCaskill made a really nice tabletop CNC machine. I was impressed that he did not simplify his work and cut all the elements by hand. I'm impressed with this project.

    Photo 3 - Angry Monk's used laser-cut DMF parts and toothed-belt motors converted into propeller motors.

    Photo 4 - Bret Golab's assembled the machine and configured it to work with Linux CNC (I also tried to do this, but could not due to the complexity). If you are interested in his settings, you can contact him. He did a great job!

    I'm afraid I don't have enough experience and knowledge to explain the basics of CNC, but the CNCZone.com forum has an extensive section dedicated to homemade machines, which has helped me a lot.

    Cutter: Dremel or Dremel Type Tool

    Axes parameters:

    X axis
    Travel Distance: 14"

    Speed: 60"/min
    Acceleration: 1"/s2
    Resolution: 1/2000"
    Pulses per inch: 2001

    Y axis
    Travel Distance: 10"
    Drive: Toothed belt drive
    Speed: 60"/min
    Acceleration: 1"/s2
    Resolution: 1/2000"
    Pulses per inch: 2001

    Z axis (up-down)
    Travel Distance: 4"
    Drive: Screw
    Acceleration: .2"/s2
    Speed: 12"/min
    Resolution: 1/8000"
    Pulses per inch: 8000

    Required Tools

    I aimed to use popular tools that can be purchased at a regular DIY store.

    Power tools:
    - band saw or jigsaw
    - drilling machine (drills 1/4", 5/16", 7/16", 5/8", 7/8", 8mm (about 5/16"), also called Q
    - Printer
    - Dremel or similar tool (for installation into a finished machine).

    Hand tool:
    - rubber hammer (for putting elements in place)
    - hexagons (5/64", 1/16")
    - screwdriver
    - glue stick or spray glue
    - adjustable wrench (or socket wrench with ratchet and 7/16" socket)

    Necessary materials

    The attached PDF file (CNC-Part-Summary.pdf) provides all costs and information about each item. Only generalized information is provided here.

    Sheets --- $20
    -A piece of 48" x 48" 1/2" MDF (any sheet material 1/2" thick will do. I plan to use UHMW in the next version of the machine, but now it is too expensive)
    -Piece of 5"x5" 3/4" MDF (this piece is used as a spacer, so you can take a piece of any 3/4" material

    Motors and Controllers --- $255
    -You could write a whole article about the choice of controllers and motors. In short, you need a controller capable of driving three motors and motors with torque of around 100 oz/in. I bought the motors and a ready-made controller and everything worked well.

    Hardware --- $275
    -I bought these items in three stores. I bought simple elements at a hardware store, I bought specialized drivers at McMaster Carr (http://www.mcmaster.com), and I bought bearings, which I need a lot of, from an online seller, paying $40 for 100 pieces (it turns out to be quite profitable , many bearings remain for other projects).

    Software ---(Free)
    -You need a program to draw your design (I use CorelDraw) and I'm currently using a trial version of Mach3, but I have plans to move to LinuxCNC (an open source machine controller using Linux)

    Head unit --- (optional)
    -I installed Dremel on my machine, but if you are interested in 3D printing (eg RepRap) you can install your own device.

    Printing templates

    I had some experience with a jigsaw, so I decided to glue down the templates. You need to print PDF files with templates placed on a sheet, glue the sheet onto the material and cut out the parts.

    File name and material:
    All: CNC-Cut-Summary.pdf
    0.5" MDF (35 8.5"x11" template sheets): CNC-0.5MDF-CutLayout-(Rev3).pdf
    0.75" MDF: CNC-0.75MDF-CutLayout-(Rev2).pdf
    0.75" aluminum tube: CNC-0.75Alum-CutLayout-(Rev3).pdf
    0.5" MDF (1 48"x48" Pattern Sheet): CNC-(One 48x48 Page) 05-MDF-CutPattern.pdf

    Note: I am attaching the CorelDraw drawings in the original format (CNC-CorelDrawFormat-CutPatterns (Rev2) ZIP) for those who would like to change something.

    Note: There are two file options for MDF 0.5". You can download a file with 35 pages 8.5"x11" (CNC-0.5MDF-CutLayout-(Rev3), PDF), or a file (CNC-(One 48x48 Page) 05- MDF-CutPattern.pdf) with one sheet of 48"x48" for printing on a wide format printer.

    Step by step:
    1. Download three PDF template files.
    2. Open each file in Adobe Reader
    3. Open the print window
    4. (IMPORTANT) disable Page Scaling.
    5. Check that the file has not been accidentally scaled. The first time I didn't do this, I printed everything at 90% scale, as described below.

    Gluing and cutting out elements

    Glue the printed templates onto the MDF and onto the aluminum pipe. Next, simply cut out the part along the contour.

    As mentioned above, I accidentally printed the templates at 90% scale and didn't notice until I started cutting. Unfortunately, I didn't realize this until this stage. I was left with 90% scale templates and after moving across the country I had access to a full size CNC machine. I couldn't resist and cut out the elements using this machine, but I couldn't drill them from the back side. That is why all the elements in the photographs are without pieces of the template.

    Drilling

    I didn't count exactly how many, but this project uses a lot of holes. The holes that are drilled at the ends are especially important, but take your time on them and you will rarely need to use a rubber hammer.

    Places with holes in the overlay on top of each other are an attempt to make grooves. Perhaps you have a CNC machine that can do this better.

    If you have made it this far, then congratulations! Looking at a bunch of elements, it is quite difficult to imagine how to assemble the machine, so I tried to make detailed instructions, similar to the instructions for LEGO. (Attached PDF CNC-Assembly-Instructions.pdf). The step-by-step photos of the assembly look quite interesting.

    Ready!

    The machine is ready! I hope you got it up and running. I hope that the article does not miss important details and points. Here's a video showing the machine cutting out a pattern on pink foam board.

    I decided to write this note because I’m tired of answering the same thing 100,500 times on Q&A.

    Many novice web programmers sooner or later are faced with the task of introducing human-readable links (HUR) into their website. Before the implementation of CNC, all links looked like /myscript.php or even /myfolder/myfolder2/myscript3.php, which is difficult to remember and even worse for SEO. After the implementation of CNC, the links take the form /statiya-o-php or even in Cyrillic /article-o-php.

    Speaking of SEO. Human-readable links were REALLY invented not for easy memorization, but mainly to increase the indexability of the site, because the coincidence of the search query and part of the URL gives a good advantage in the search rankings.

    The evolution of a novice PHP programmer can be expressed in the following sequence of steps:

    1. Placing plain-PHP code in separate files and accessing these files through links like /myfolder/myscript.php
    2. Understanding that all scripts have a significant part in common (for example, creating a connection to the database, reading the configuration, starting a session, etc.) and, as a consequence, creating a common starting “entry” point, some script that accepts ALL requests, and then chooses which one connect internal script. Usually this script is named index.php and lies at the root, as a result of which all requests (aka URLs) look like this: /index.php?com=myaction&com2=mysubaction
    3. The need to implement a router and the transition to human-readable links.

    I note that between points 2 and 3, most programmers make an obvious mistake. I won't be wrong if I call this the value of about 95% of programmers. Even most well-known frameworks contain this error. And it consists in the following.

    Instead of implementing a fundamentally new way of processing links, the concept of “patches and redirects” based on .htaccess is mistakenly made, which consists of creating many redirect rules using mod_rewrite. These lines compare the URL with some regular expression and, if there is a match, push the values ​​extracted from the URL into GET variables, subsequently calling the same index.php.

    #Incorrect CNC method RewriteEngine On RewriteRule ^\/users\/(.+)$ index.php?module=users&id=$1 #....A lot more similar rules...

    This concept has many disadvantages. One of them is the difficulty of creating rules, a large percentage of human errors when adding rules that are difficult to detect, but they lead to a 500 server error.

    Another drawback is that it is often edited based on the server config, which in itself is nonsense. And if in Apache the config can be “patched” using .htaccess, then in the popular nginx there is no such option, everything is located in a common configuration file in the system zone.

    And one more drawback, probably the most important, is that with this approach it is impossible to dynamically configure the router, that is, “on the fly,” algorithmically change and expand the rules for selecting the desired script.

    The method proposed below eliminates all these disadvantages. It is already used in a large number of modern frameworks.

    The bottom line is that the initial request is always stored in the $_SERVER[‘REQUEST_URI’] variable, that is, it can be read inside index.php and parsed as a string using PHP with all error handling, dynamic redirects, etc.

    In this case, you can create only one static rule in the configuration file, which will redirect all requests to non-existent files or folders to index.php.

    RewriteEngine On RewriteCond %(REQUEST_FILENAME) !-f #If the file does not exist RewriteCond %(REQUEST_FILENAME) !-d #And if the folder does not exist RewriteRule ^.*$ index.php

    Moreover, this rule can be placed both in .htaccess and in the main Apache configuration file.

    For nginx, the corresponding rule will look like this:

    Location / ( if (!-e $request_filename) ( rewrite ^/(.*)$ /index.php last; ) )

    It's simple.

    Now let's look at a piece of PHP code in index.php, which analyzes links and decides which script to run.

    /part1/part2/part3

    The first thing that comes to mind is to break it up using explode(‘/’, $uri) and make a complex router based on switch/case that analyzes each piece of the request. Do not do that! This is complicated and ends up making the code look horribly incomprehensible and non-configurable!

    I suggest a more concise way. It’s better not to describe it in words, but to immediately show the code.

    "page404.php", // Page 404"/" => "mainpage.php", // Main page "/news" => "newspage.php", // News - page without parameters "/stories(/+)?" => "storypage.php", // With a numeric parameter // More rules); // Router code class uSitemap ( public $title = ""; public $params = null; public $classname = ""; public $data = null; public $request_uri = ""; public $url_info = array(); public $ found = false; function __construct() ( $this->mapClassName(); ) function mapClassName() ( $this->classname = ""; $this->title = ""; $this->params = null; $ map = &$GLOBALS["sitemap"]; $this->request_uri = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); $this->url_info = parse_url($this->request_uri); $uri = urldecode( $this->url_info["path"]); $data = false; foreach ($map as $term => $dd) ( $match = array(); $i = preg_match("@^".$term. "$@Uu", $uri, $match); if ($i > 0) ( // Get class name and main title part $m = explode(",", $dd); $data = array("classname " => isset($m)?strtolower(trim($m)):"", "title" => isset($m)?trim($m):"", "params" => $match,) ; break; ) ) if ($data === false) ( // 404 if (isset($map["_404"])) ( // Default 404 page $dd = $map["_404"]; $m = explode(",", $dd); $this->classname = strtolower(trim($m)); $this->title = trim($m); $this->params = array(); ) $this->found = false; ) else ( // Found! $this->classname = $data["classname"]; $this->title = $data["title"]; $this->params = $data["params"]; $ this->found = true; ) return $this->classname; ) ) $sm = new uSitemap(); $routed_file = $sm->classname; // Get the name of the file to connect via require() require("app/".$routed_file); // Connect the file // P.S. Inside the included file you can use request parameters // which are stored in the $sm->params property

    Even though the code is quite long, it is logically simple. I don't want to explain it, I consider any PHP code to be self-explanatory if it is written correctly. Learn to read code.