CAM Walkthrough for the Impatient: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
 
(44 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<languages/>
Here we will show how to get from a simple FreeCAD object to the machine's G-Code
<translate>
== The model ==
Let's start with a simple FreeCAD model: a cube with a rectangular pocket.


<!--T:47-->
[[File:Path-SquarePocketModel.png]]
{{TutorialInfo
|Topic=CAM Workbench
|Level=Beginner/Moderate
|Time=15 minutes
|Author=Chrisb
|FCVersion=0.19
|Files=
}}


== Aim == <!--T:48-->
It is modeled straightforward in the [[PartDesign Workbench|Part Design]] using a Body, a Box and a Pocket based on a Sketch. The sketch is oriented in the XY plane.


<!--T:1-->
== The Tooltable ==
Demonstrating the creation of a [[Image:Workbench_CAM.svg|32px]] [[CAM_Workbench|CAM Workbench]] Job derived from a 3D Model. Then generating dialect-correct G-Code for a target CNC mill.
When we want to mill something we need a tool. The [[Tooltable]] is a collection of such tools.


== The 3D Model == <!--T:2-->


<!--T:3-->
1. The Project begins with a simple FreeCAD model designed in the [[Image:Workbench_PartDesign.svg|32px]] [[PartDesign_Workbench|Part Design]] a cube with a rectangular pocket,


<!--T:4-->
== The Job ==
:[[File:Path-SquarePocketModel.png]]
In the Path workbench we create a [[Image:Path-Job.png|32px]] [[Path_Job|Job]]


<!--T:5-->
In the job creation dialog we select the Body as the Base Model and confirm with OK.
:{{Caption|Above: Created in the [[Image:Workbench_PartDesign.svg|24px]] [[PartDesign_Workbench|Part Design]] including a Body, a Box with a Pocket, based on a Sketch oriented in the {{Button|[[Image:View-top.svg|16px|link=Std_ViewTop]]}} XY plane.}}


<!--T:6-->
=== Job Output ===
2. With the 3D Model completed, switch to the [[Image:Workbench_CAM.svg|32px]] [[CAM_Workbench|CAM Workbench]] via the [[Std_Workbench|Workbench selector]] (drop-down menu)

== The Job == <!--T:49-->

<!--T:7-->
3. Now we create a [[CAM_Job|CAM Job]] by either of the following methods:
* Press the {{KEY|[[Image:CAM_Job.svg|24px|link=CAM Job]] [[CAM_Job|Job]]}} button from the toolbar.
* Using the {{KEY|P}} then {{KEY|J}} keyboard shortcut.
* Using the {{MenuCommand|CAM → Job}} entry from the top menu.

<!--T:10-->
[[File:Path-JobCreationDialog.png]]
[[File:Path-JobCreationDialog.png]]
::{{Caption|Above: [[CAM_Job|CAM Job]] creation dialog}}


<!--T:8-->
The model in the 3D view is now surrounded by a wireframe cube and the job configuration dialog opens. We start with the configuration of the output, which determines the finally generated G-Code file.
4. This opens a Job creation dialog. Within this dialog, click {{Button|OK}} to accept the Body as the Base Model, with no Template.


=== Job Setup === <!--T:9-->
[[File:Path-JobOutput.png]]


<!--T:11-->
We can select a filename or we can use some placeholders, which we do here to create the output file in the same directory as the file with the square pocket. The filename will be the same as the FreeCAD model's name with the extension .gcode.
5. The Job Edit window opens in the Task window, and the model view Window shows the Stock as a wire frame cube surrounding the Base Body. The Setup Tab is selected.
Move the mouse over the input field to see further possibilities of placeholders.


=== Job Output === <!--T:12-->
Select the postprocessor which will translate the internal format into the code used by your machine. In the example we use the linuxcnc postprocessor.


<!--T:13-->
The postprocessor can be configured with additional arguments which are shown as you move the mouse over the field. We use none of them here.
6. The Output tab defines the output file path, name, extension, and the Postprocessor. For advanced users, Post Processor Arguments can be customized (mouse over to show tooltips of common arguments).


<!--T:14-->
=== Job Setup ===
:[[File:Path-JobOutput.png]]
In the Setup subdialog we configure the stock.
:{{Caption|Above: [[CAM_Job|CAM Job]] Edit dialog with the Output tab selected}}
The model we have created in FreeCAD is what we want to have in the end. The stock is the material we start with. Here we use a cubic block of which we can configure the size here.


=== Job Tools === <!--T:15-->
[[File:Path-JobSetup.png]]


<!--T:16-->
=== Job Tools ===
:[[File:Path-JobTools.png]]
In the Tools section we add the previously defined tool. Don't forget in the tooltable to click the "Create Tool Controller" button. If you are not yet sure which tools to use, you can create the tool controllers later.
:{{Caption|Above: [[CAM_Job|CAM Job]] Edit dialog with the Tools tab selected}}


<!--T:17-->
[[File:Path-ToolCreateController.png]]
7. Modify the Default tool by selecting it and clicking the {{Button|Edit}} button. This opens the Tool Controller edit window.


<!--T:18-->
We can delete the default tool and confirm the complete job configuration. The Workplan will be added later when we define the path operations.
:[[File:Path-ToolConfig.gif]]
:{{Caption|Above: [[CAM_Job|CAM Job]] Tool Controller subpanel Edit dialog}}


<!--T:19-->
[[File:Path-JobTools.png]]
8. The name given to the tool and the tool number correspond with the tool number of the machine. In the dialog (see above) it's Tool Nr. 4. The tool controller is configured for horizontal and vertical feed rates of {{incode|2mm/s}} and a spindle speed of {{incode|2000 rpm}}.


<!--T:20-->
The tree should now look like this if we unfold the Job:
9. Select the Tool subpanel of the Tool controller. Set the diameter (and if you wish to use the [[Image:CAM_Simulator.svg|24px|link=CAM_Simulator]] [[CAM_Simulator|CAM Simulation]] tool later: add a cutting edge angle and cutting edge height).


<!--T:21-->
[[File:Path-TreeWithJob.png]]
:[[File:Path-ToolAdd.gif]]
:{{Caption|Above: [[CAM_Job|CAM Job]] Tool controller 'Tool' subpanel dialog}}


<!--T:22-->
== The Tool Controller ==
10. The values are confirmed with {{Button|OK}}
We have already created a tool controller during job creation. Now we want to define feed and speed for the usage of the tool in this job
With a double click on the tool controller we enter the tool configuration. We have to enter the values for the feed rates in mm/s, which are FreeCAD's internally used units. The postprocessor has to transform these values into the correct units used by our machine.


<!--T:23-->
[[File:Path-ToolConfig.gif]]
Note: For easy access, all the tools can be predefined and selected from the [[Image:CAM_ToolLibraryEdit.svg|24px|link=CAM_ToolLibraryEdit]][[CAM_ToolLibraryEdit|Tool manager]].


=== Job Workplan === <!--T:24-->
We enter horizontal and vertical feedrates of 2mm/s and a spindle speed of 2000 rpm.


<!--T:25-->
== The Path Operations ==
The Workplan tab initially is shown as empty. It is then populated by the sequence of Job Operations, Partial CAM Commands, and CAM Dressups. The sequence of these items is ordered here.
We will add two operations for paths. The [[Path Contour|Contour]] operation will create a path around the box and the [[Path Pocket|Pocket]] operation will create a path for the inner pocket.


<!--T:26-->
For now we will keep it simple. We use the [[Image:Path-Profile.svg|32px]] [[Path_Contour|Contour]] button to open the Contour panel and confirm with OK without changing any of the values. We can see the green path around the object.
This tree is shown after the Job's configuration once the CAM Job is unfolded:


<!--T:27-->
We select the bottom of the pocket and use the [[Image:Path-Pocket.svg|32px]] [[Path_Pocket|Pocket]] button to open the Pocket panel.
:[[File:Path-TreeWithJob.png]]
We leave Base Geometry, Depths and Heights as is and open the Operation subpanel


== The Path Operations == <!--T:28-->
[[File:Path-PocketOperation.gif]]


<!--T:29-->
We change the pattern to "Offset" and "Step Over Percent" to 50 and confirm the pocket configuration with OK.
11. Two operations will be added to generate milling paths for this CAM Job. The [[CAM_Profile|Profile]] operation creates a path around the box and the [[CAM_Pocket_Shape|Pocket]] operation creates a path for the inner pocket.


<!--T:30-->
12. For now we will keep it simple. The [[Image:CAM_Profile.svg|32px]] [[CAM_Profile|Profile]] button opens the Contour panel. After confirming with {{Button|OK}} using the default values, see the green path around the object is visible.

<!--T:31-->
13. Selecting the bottom of the pocket and then the [[Image:CAM_Pocket_Shape.svg|32px]] [[CAM_Pocket_Shape|Pocket]] button opens the Pocket Shape window. The default values for Base Geometry, Depths, and Heights are used, and the Operation subpanel is selected, and the Step Over Percent is set at 50.

<!--T:32-->
:[[File:Path-PocketOperation.gif]]
:{{Caption|Above: Pocket Shape dialog with the Operation subpanel selected}}

<!--T:33-->
14. The pattern is changed to "Offset" and the Job Operation is confirmed for the pocket configuration with {{Button|OK}}

<!--T:34-->
The result is a model with two paths:
The result is a model with two paths:


<!--T:35-->
[[File:Path-WalkThroughResult.gif]]
:[[File:Path-WalkThroughResult.gif]]
:{{Caption|Above: resulting with a model with two paths}}

== Verifying Paths == <!--T:36-->

<!--T:37-->
There are two ways to verify the created paths. The G-Code can be inspected, including highlighting the corresponding path segments. The milling process of the CAM Job can also be simulated to demonstrate the idealized tool paths, required for the Tool geometries to mill the Stock.

<!--T:38-->
To inspect the G-Code use the [[Image:CAM_Inspect.svg|32px|link=CAM_Inspect]] [[CAM_Inspect|CAM Inspect]] tool. Selecting the corresponding G-Code lines within the G-Code Inspection window highlights individual path segments.
:[[File:Path-InspectWindow.gif]]
:{{Caption|Above: [[CAM_Inspect|CAM Inspection]] tool opens the G-Code Inspection dialog}}

<!--T:39-->
To start the simulation use the [[Image:CAM_Simulator.svg|32px]] [[CAM_Simulator|CAM Simulator]] tool.

<!--T:40-->
Adjust speed and accuracy and start the simulation with the [[Image:CAM_BPlay.svg|24px]] (Play) button.

<!--T:41-->
:[[File:Path-Simulation.gif]]
:{{Caption|Above: [[CAM Simulator|CAM Simulation]] in progress}}


<!--T:42-->
== Verifying Paths ==
If you want to end the simulation click the {{Button|Cancel}} button, it will remove the stock created for the simulation. If you click {{Button|OK}} this object will be kept in your Job.
There are two ways to verify the paths created. We can inspect the G-Code and highlight the corresponding path segments or we can simulate the milling process.


== Postprocess the Job == <!--T:43-->
To inspect the G-Code we use the [[Image:Path-Inspect.svg]] tool. To highlight segments of the path we have to select the corresponding lines in the G-Code window.


<!--T:44-->
[[File:Path-InspectWindow.gif]]
The final step to generate G-Code for the target mill is to postprocess the Job. This outputs the G-Codes to a file that can be uploaded to the target CNC machine controller. To invoke the Postprocessor:


<!--T:45-->
To start the simulation we use the [[Image:Path-Simulator.svg]] [[Path Simulator]] tool.
* Select the Job object in the [[Tree_view|tree view]]
* Select the [[Image:CAM_Post.svg|32px|link=CAM_Post]] [[CAM_Post|CAM Postprocessing]] tool to postprocess the file. This opens a G-Code window allowing inspection of the final output file before it is saved.


<!--T:46-->
== Export G-Code ==
:[[File:Path-PostOutput.gif]]
Finally we want to postprocess the paths and export the G-Codes to a file which we can upload to our CNC machine.
:{{Caption|Above: G-Code window allowing inspection of the final output file}}
* We select the Job object in the tree
* We use the Path Postprocessing [[Image:Past-Post.svg]] tool to export the file. Before the file is written we can inspect it once more.


[[File:Path-PostOutput.gif]]


</translate>
Depending on the postprocessor used there might be additional parameters which can be set in the Job's configuration to show or suppress the intermediate steps.
{{CAM_Tools_navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}

Latest revision as of 17:40, 1 April 2024

Tutorial
Topic
CAM Workbench
Level
Beginner/Moderate
Time to complete
15 minutes
Authors
Chrisb
FreeCAD version
0.19
Example files
See also
None

Aim

Demonstrating the creation of a CAM Workbench Job derived from a 3D Model. Then generating dialect-correct G-Code for a target CNC mill.

The 3D Model

1. The Project begins with a simple FreeCAD model designed in the Part Design a cube with a rectangular pocket,

Above: Created in the Part Design including a Body, a Box with a Pocket, based on a Sketch oriented in the XY plane.

2. With the 3D Model completed, switch to the CAM Workbench via the Workbench selector (drop-down menu)

The Job

3. Now we create a CAM Job by either of the following methods:

  • Press the Job button from the toolbar.
  • Using the P then J keyboard shortcut.
  • Using the CAM → Job entry from the top menu.

Above: CAM Job creation dialog

4. This opens a Job creation dialog. Within this dialog, click OK to accept the Body as the Base Model, with no Template.

Job Setup

5. The Job Edit window opens in the Task window, and the model view Window shows the Stock as a wire frame cube surrounding the Base Body. The Setup Tab is selected.

Job Output

6. The Output tab defines the output file path, name, extension, and the Postprocessor. For advanced users, Post Processor Arguments can be customized (mouse over to show tooltips of common arguments).

Above: CAM Job Edit dialog with the Output tab selected

Job Tools

Above: CAM Job Edit dialog with the Tools tab selected

7. Modify the Default tool by selecting it and clicking the Edit button. This opens the Tool Controller edit window.

Above: CAM Job Tool Controller subpanel Edit dialog

8. The name given to the tool and the tool number correspond with the tool number of the machine. In the dialog (see above) it's Tool Nr. 4. The tool controller is configured for horizontal and vertical feed rates of 2mm/s and a spindle speed of 2000 rpm.

9. Select the Tool subpanel of the Tool controller. Set the diameter (and if you wish to use the CAM Simulation tool later: add a cutting edge angle and cutting edge height).

Above: CAM Job Tool controller 'Tool' subpanel dialog

10. The values are confirmed with OK

Note: For easy access, all the tools can be predefined and selected from the Tool manager.

Job Workplan

The Workplan tab initially is shown as empty. It is then populated by the sequence of Job Operations, Partial CAM Commands, and CAM Dressups. The sequence of these items is ordered here.

This tree is shown after the Job's configuration once the CAM Job is unfolded:

The Path Operations

11. Two operations will be added to generate milling paths for this CAM Job. The Profile operation creates a path around the box and the Pocket operation creates a path for the inner pocket.

12. For now we will keep it simple. The Profile button opens the Contour panel. After confirming with OK using the default values, see the green path around the object is visible.

13. Selecting the bottom of the pocket and then the Pocket button opens the Pocket Shape window. The default values for Base Geometry, Depths, and Heights are used, and the Operation subpanel is selected, and the Step Over Percent is set at 50.

Above: Pocket Shape dialog with the Operation subpanel selected

14. The pattern is changed to "Offset" and the Job Operation is confirmed for the pocket configuration with OK

The result is a model with two paths:

Above: resulting with a model with two paths

Verifying Paths

There are two ways to verify the created paths. The G-Code can be inspected, including highlighting the corresponding path segments. The milling process of the CAM Job can also be simulated to demonstrate the idealized tool paths, required for the Tool geometries to mill the Stock.

To inspect the G-Code use the CAM Inspect tool. Selecting the corresponding G-Code lines within the G-Code Inspection window highlights individual path segments.

Above: CAM Inspection tool opens the G-Code Inspection dialog

To start the simulation use the CAM Simulator tool.

Adjust speed and accuracy and start the simulation with the (Play) button.

Above: CAM Simulation in progress

If you want to end the simulation click the Cancel button, it will remove the stock created for the simulation. If you click OK this object will be kept in your Job.

Postprocess the Job

The final step to generate G-Code for the target mill is to postprocess the Job. This outputs the G-Codes to a file that can be uploaded to the target CNC machine controller. To invoke the Postprocessor:

  • Select the Job object in the tree view
  • Select the CAM Postprocessing tool to postprocess the file. This opens a G-Code window allowing inspection of the final output file before it is saved.

Above: G-Code window allowing inspection of the final output file