A modern-day CNC works by someone beginning with a design in a Computer Aided Design (CAD) software package. When the design is complete it is transferred to a Computer Aided Machining (CAM) software package. At this point the operator chooses exactly what will be cut, what speeds and depths will be used while cutting and in what order will everything be done.
When this is complete the CAM software will generate a G-Code file. This G-Code file contains a list of commands and coordinates which specify everything the CNC machine needs to know in order to produce the movements which will create the design.
The G-Code file is loaded into a CNC Controller software package. This CNC Controller speaks directly through the computer to the CNC electronics. It is the controllers job to decode the G-Code file and turn the desired movements into electrical signals which will drive the CNC electronics.
The CNC Controller is also responsible for knowing the CNC machines limits as defined by the operator. It will make sure that at all times all movement is within the specified limits. This is a major part in the CNC process, it keeps the operator safe and the machine safe from destroying itself.
When the electrical signals reach the CNC electronics it is delivered to a breakout board. This breakout board protects the computer by isolating the signals before sending them off to the drive electronics. The drive electronics are responsible for driving the actuators which move the CNC machine around. These actuators may be stepper or servo motors, depending on the machine.
The drives then move the motors as commanded by the received signals. This process will happen many thousand times per second as it will take many millions of small electrical signals to complete every movement required to produce the designed part.