Skip to content

Commit

Permalink
Merge pull request #23 from AndyEveritt/reorganise
Browse files Browse the repository at this point in the history
Reorganise
  • Loading branch information
AndyEveritt authored Jun 19, 2020
2 parents f1c6e2f + 844ff7c commit 945ae70
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 136 deletions.
4 changes: 2 additions & 2 deletions ASMBL.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import adsk.fusion
import traceback

from .fusion_api import Handlers
from .fusion_api.Handlers import handlers
from .src.fusion_api import Handlers
from .src.fusion_api.Handlers import handlers


def create_tab(workspace, tab_name):
Expand Down
225 changes: 116 additions & 109 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
This code is designed to create a gcode file suitable for Additive & Subtractive Manufacturing By Layer (ASMBL).

There are 2 main ways this repo can be used.
* As a standalone program that takes 2 input files
* An additive`.gcode` file from Simplify3D using the `ASMBL.factory` file to get the appropriate settings.
* A subtractive `.gcode` file from Fusion360.
* These files require specific setup for this program to work
* As a **Fusion 360 add-in** where the **ENTIRE** workflow from designing the part to getting the merged gcode is in Fusion 360
* This means no handling dirty STL files!!!

- As a standalone program that takes 2 input files
- An additive`.gcode` file from Simplify3D using the `ASMBL.factory` file to get the appropriate settings.
- A subtractive `.gcode` file from Fusion360.
- These files require specific setup for this program to work
- As a **Fusion 360 add-in** where the **ENTIRE** workflow from designing the part to getting the merged gcode is in Fusion 360
- This means no handling dirty STL files!!!

The Fusion 360 add-in is the recommended option however the slicer is new and not widely adopted yet. Therefore, support for Simplify3D is present. The 2 slicers create mostly compatible gcode files. Until further notice, support for both programs will exist.

Expand Down Expand Up @@ -38,7 +39,7 @@ For the standalone program, download the latest release for the `ASMBL.exe`, an
- [Fusion360](#fusion360-1)
- [External Slicer](#external-slicer)
- [CAM setup](#cam-setup)
- [**Key Understanding Point**](#key-understanding-point)
- [Retraction & Non-Planar Understanding Point](#retraction--non-planar-understanding-point)
- [Tool Config](#tool-config)
- [Operation Setup](#operation-setup)
- [Post Processing](#post-processing)
Expand Down Expand Up @@ -66,17 +67,17 @@ Unzip the repo in your desired folder location or clone the repo:
git clone https://github.com/AndyEveritt/ASMBL.git
```

* Open Fusion360
* Click the add-in tool
* Click the green plus to add an existing add-in
- Open Fusion360
- Click the add-in tool
- Click the green plus to add an existing add-in

<img src="docs/installation/images/fusion_add_existing.png" width=480>

* Navigate to the ASMBL repo location and select the folder
- Navigate to the ASMBL repo location and select the folder

<img src="docs/installation/images/fusion_select_location.png" width=480>

* Select the ASMBL add-in from the list, click `Run on Startup`, then `Run`
- Select the ASMBL add-in from the list, click `Run on Startup`, then `Run`

<img src="docs/installation/images/fusion_run.png" width=240>

Expand All @@ -85,17 +86,19 @@ git clone https://github.com/AndyEveritt/ASMBL.git
To make orienting the coordinate axis between modeling, additive, and subtractive workspaces; it is highly recommended to change the `Default modeling orientation` in Fusion360.

This can be done by:
* Going to user preferences
* Changing the `Default modeling orientation` to `Z up`

- Going to user preferences
- Changing the `Default modeling orientation` to `Z up`

<img src="docs/installation/images/fusion_z_up.png" width=480>

## Setting up the code for standalone use (Simplify3D)

Download the following files from the releases page:
* `ASMBL.exe`
* `config.json`
* `ASMBL.factory`

- `ASMBL.exe`
- `config.json`
- `ASMBL.factory`

Ensure the config and exe are in the same folder for the program to run.

Expand All @@ -113,49 +116,50 @@ A details on materials that have been tested can be found [here](docs/usage/mate

<br>

## Additive Setup
## Additive Setup

The additive gcode can be setup in various ways.
* Using Fusion360 for the complete workflow (recommended)
* Using Simplify3D (or PrusaSlicer if you want to make a profile) to generate the FFF gcode and Fusion to generate the CAM gcode.

- Using Fusion360 for the complete workflow (recommended)
- Using Simplify3D (or PrusaSlicer if you want to make a profile) to generate the FFF gcode and Fusion to generate the CAM gcode.

> **<font color="red">DO NOT TURN OFF THE RAFT</font> UNLESS YOU KNOW WHAT YOU ARE DOING...IT IS VERY EASY TO CUT INTO THE BED AND BREAK THE TOOL**
### Fusion360

First you need to create an offset of your model, this will control how much cut-in you have.

* Open you Fusion 360 file, or `.step` in Fusion 360.
* Turn on `Capture Design History` if it is not already on.
* This can be found in the `Design` workspace.
- Open you Fusion 360 file, or `.step` in Fusion 360.
- Turn on `Capture Design History` if it is not already on.
- This can be found in the `Design` workspace.

<img src="docs/usage/images/fusion_design_history.png" width=240>

* Make a duplicate of the model body(s).
* Select the body from the Browser menu on the left and `Ctrl+C`, `Ctrl+V`
* Make sure both bodies perfectly overlaid.
* Both bodies should be outside a component if one exists. (Weird graphics happen otherwise).
- Make a duplicate of the model body(s).
- Select the body from the Browser menu on the left and `Ctrl+C`, `Ctrl+V`
- Make sure both bodies perfectly overlaid.
- Both bodies should be outside a component if one exists. (Weird graphics happen otherwise).

<img src="docs/usage/images/fusion_component_body.png" width=240>

* Offset all the faces on the new body that you wish to machine.
* Hide the original body to make selecting faces easier.
* An offset amount of ~0.2-0.3 mm works well in my testing.
* You do not want to offset any face you will not be able to machine, **ie the base**
* For top surfacing to work properly, you need to offset a sufficient amount for the additive slicer to add an additional layer. This can normally be achieved by offsetting the same amount as your print layer height.
* *You do not want to offset more than 1 print layer in the vertical direction or the cutting order will not work.*
* Once you are done, hide the offset body and show the original body.
- Offset all the faces on the new body that you wish to machine.
- Hide the original body to make selecting faces easier.
- An offset amount of ~0.2-0.3 mm works well in my testing.
- You do not want to offset any face you will not be able to machine, **ie the base**
- For top surfacing to work properly, you need to offset a sufficient amount for the additive slicer to add an additional layer. This can normally be achieved by offsetting the same amount as your print layer height.
- _You do not want to offset more than 1 print layer in the vertical direction or the cutting order will not work._
- Once you are done, hide the offset body and show the original body.

<img src="docs/usage/images/fusion_fff_offset.png" width=480>

* You should have 2 of each body in your part, the exactly modelled part, and the offset part.
* Enter the `Additive` Tab in the `Manufacturing` workspace in Fusion360.
* Create a new setup
* Click `Select` Machine
* Import the `E3D - Tool Changer.machine` profile from the `settings` folder of this repo
* Click `Select` next to `Print Settings`
* Import the `ASMBL.printsetting` profile from the `settings` folder of this repo
* Under `Model` select the offset body created earlier
- You should have 2 of each body in your part, the exactly modelled part, and the offset part.
- Enter the `Additive` Tab in the `Manufacturing` workspace in Fusion360.
- Create a new setup
- Click `Select` Machine
- Import the `E3D - Tool Changer.machine` profile from the `settings` folder of this repo
- Click `Select` next to `Print Settings`
- Import the `ASMBL.printsetting` profile from the `settings` folder of this repo
- Under `Model` select the offset body created earlier

Workspace:

Expand All @@ -169,7 +173,7 @@ Setup:

<img src="docs/usage/images/fusion_fff_setup.png" width=480>

* Optionally rename the setup to `Additive`
- Optionally rename the setup to `Additive`

### Standalone (Simplify3D, Other Slicers)

Expand All @@ -181,78 +185,72 @@ Guide on how to create a properly configured gcode file can be generated can be

### Stock setup

* Create a new Setup by clicking `Setup` > `New Setup`
* Select `From solid` for the Stock mode
* Click on the part body to select it
* Select the offset body if created earlier
* Under the `Model` option in the `Setup` tab, select the original part body.
- Create a new Setup by clicking `Setup` > `New Setup`
- Select `From solid` for the Stock mode
- Click on the part body to select it
- Select the offset body if created earlier
- Under the `Model` option in the `Setup` tab, select the original part body.

The origin changes depending on if you are using Fusion360 or an external slicer for the additive gcode.

#### Fusion360

* Under `Work Coordinate System` select:
* Orientation: `Model orientation`
* Origin: `Model origin`
* The origin should now align with the previously configured FFF setup
- Under `Work Coordinate System` select:
- Orientation: `Model orientation`
- Origin: `Model origin`
- The origin should now align with the previously configured FFF setup

<img src="docs/usage/images/fusion_cam_setup.png" width=480>

#### External Slicer

* Move the origin to the bottom middle of the part
* Orient the Z axis to be vertically upwards
- Move the origin to the bottom middle of the part
- Orient the Z axis to be vertically upwards

<br>

### CAM setup

The CAMing proceedures for ASMBL can be configured with the following processes:

Process | Usage
------- | -----
3D Contour | Used for vertical & close to vertical side walls (including chamfers & filets).
2D Adaptive | Used for top surfacing
2D Contour | Used for vertical side walls of parts
Other 3D operations | Can be used for non planar operations **if you know what you are doing** (it is easy to break stuff, be careful)
| Process | Usage |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
| 3D Contour | Used for vertical & close to vertical side walls (including chamfers & filets). |
| 2D Adaptive | Used for top surfacing |
| 2D Contour | Used for vertical side walls of parts |
| Other 3D operations | Can be used for non planar operations **if you know what you are doing** (it is easy to break stuff, be careful) |

See [Operation Setup](#operation-setup) for more details.

<br>
<br>
<br>

#### **Key Understanding Point**

This program separates each of the CAM operations into segments separated by motion type (cutting, lead-in, plunge, etc.).
#### Retraction & Non-Planar Understanding Point

> **This is key to understanding how to CAM a model effectively. Below are guidelines but they may not work for every situation.
> Use this overview to understand what to look for when setting up the CAM operations.**
This program separates each of the CAM operations into segments separated by motion type (cutting, lead-in, plunge, etc.).

Each of the `cutting` segments are then classified as either planar or non-planar.

* Planar segments are where the cutting happens on the XY plane.
* Non-planar segments also cut in the Z axis.
- Planar segments are where the cutting happens on the XY plane.
- Non-planar segments also cut in the Z axis.

The height of each segment is determined:

* For planar segments, it is the minimum height the cutter is active.
* For non-planar segments, it is the maximum height the cutter is active.
- For planar segments, it is the minimum height the cutter is active.
- For non-planar segments, it is the maximum height the cutter is active.

Consequetive cutting segments are then grouped if they have the same height as the previous segment. Consequetive segments are also groupsd if they are non planar.
Consequetive cutting segments are then grouped if they have the same height as the previous segment. Consequetive segments are also grouped if they are non planar.

For each group, any prior `lead-in` segments and post `lead-out` segments are found and added to the group respectively. A `CamGcodeLayer` is created containing every segment between the first and last segment in the group for all motion types.
For each group, any prior `lead-in` or `plunge` segments and post `lead-out` segments are found and added to the group start or end respectively. A `CamGcodeLayer` is created containing every segment between the first and last segment in the group for all motion types.

Retracts are automatically added between each `CamGcodeLayer` to ensure the tool does not collide with the part.
Therefore, if there are multiple consequetive cutting segments at the same height (top surfacing etc.), the Fusion retracts will be used;
otherwise, this program will automatically replace any retracts/transitions Fusion creates.

> **Always inspect the gcode with travel moves turned on after it has been generated. This program reorders a significant proportion of the gcode, and replaces Fusion360's default retracts & travel moves.**
>
>
> It can happen that a single missing/wrong line in the toolpath causes the tool to pass through the model, this is unlikely if sticking with planar operations but a possibility when using non-planar
<br>
<br>
<br>

#### Tool Config

You can import our tool config by opening the `Tool Library` then right clicking on either the Document, `Cloud`, or `Local` then `Import Tool Library`. The library to import is located in this repo in `settings`/`ASMBL.tools`
Expand All @@ -277,32 +275,37 @@ Full setup details for operations can be found here: [CAM Operation Setup](docs/

### Fusion Add-in

* Regenerate the additive setup
* Regenerate the subtractive setup
* This offsets the CAM operation Z height equal to the raft height.
* Click on the `ASMBL` tab along the top navigation bar
* Click `Post Process`
* If all the toolpaths have not been previously generated or are out of date, you can tick the box to re generate all toolpaths
* This currently has a bug if the additive toolpath isn't the last to generate where the progress bar will not complete. If this happens just close the progress bar are rerun the post process command
* The default settings are auto filled.
* Layer overlap is an important setting
* An overlap > 0 will use the side of the cutter instead of the tip, this can give a better finish to walls. If there are no overhangs, recommended to use `2`.
* However this can cause issues if machining overhangs, in which case set the overlap to 0
* Layer Dropdown can also affect finish
* This will lower the z height of all the CAM operations by this value, it can be used to make the cutter tip locate in the middle of a layer instead of between 2 layers which can give a better finish; but if you want Z accuracy, leave it at 0.
* Click `OK`
* The output gcode will be saved in `~/ASMBL/output/`
* If the file name already exists, it will be overwritten without warning.
* The generated file will automatically open in your default `.gcode` editor.
* **Always preview the gcode fully to check it for mistakes** This is Beta software, there will be bugs.
- Regenerate the additive setup
- Regenerate the subtractive setup
- This offsets the CAM operation Z height equal to the raft height.
- Click on the `ASMBL` tab along the top navigation bar
- Click `Post Process`
- If all the toolpaths have not been previously generated or are out of date, you can tick the box to re generate all toolpaths
- This currently has a bug if the additive toolpath isn't the last to generate where the progress bar will not complete. If this happens just close the progress bar are rerun the post process command
- The default settings are auto filled.
- Layer overlap is an important setting
- An overlap > 0 will use the side of the cutter instead of the tip, this can give a better finish to walls. If there are no overhangs, recommended to use `2`.
- However this can cause issues if machining overhangs, in which case set the overlap to 0
- Layer Dropdown can also affect finish
- This will lower the z height of all the CAM operations by this value, it can be used to make the cutter tip locate in the middle of a layer instead of between 2 layers which can give a better finish; but if you want Z accuracy, leave it at 0.
- Click `OK`
- The output gcode will be saved in `~/ASMBL/output/`
- If the file name already exists, it will be overwritten without warning.
- The generated file will automatically open in your default `.gcode` editor.
- **Always preview the gcode fully to check it for mistakes** This is Beta software, there will be bugs.

### Standalone

* Generate and Simulate the full Setup to ensure in looks sensible
* Click `Actions` > `Post Process`
* Select the `asmbl_cam.cps` config from the `post_processors` folder in this repo
* Set the `Output folder` to the desired project location
* Click `Post`
- Generate and Simulate the full Setup to ensure in looks sensible
- In the `Manufacturing` workspace, `Milling` tab; click `Actions` > `Post Process`
- Select the `asmbl_cam.cps` config from the `post_processors` folder in this repo
- You may need to change the `Configuration Folder`
- Set the `Output folder` to the desired project location
- Click `Post`

Fusion will try to open the generated gcode file in VSCode by default, if you don't have it installed it will prompt you to download it. This is entirely up to you.

> Planned to be streamlined into a single button in a future update
#### Config

Expand Down Expand Up @@ -337,17 +340,21 @@ Update the `config.json` so that the following settings are correct for your pro

The program takes the following arguments:

Arg (long) | Arg (short) | Default | Usage
---------- | ----------- | ------- | -----
`--config` | `-C` | `config.json` | Path to the configuration JSON file
| Arg (long) | Arg (short) | Default | Usage |
| ---------- | ----------- | ------------- | ----------------------------------- |
| `--config` | `-C` | `config.json` | Path to the configuration JSON file |

By default the program expects the `config.json` to be in the same directory as the main file.

## Run Standalone

To run the program, ensure the `config.json` is configured correctly, then run the `ASMBL.exe`

The latest `.exe` can be found here https://github.com/AndyEveritt/ASMBL/releases

The program will output the file with a name according the the config settings in the `output` folder. (An output folder will be created in the same directory as the `.exe` if one does not exist)

>**Always preview the generated gcode in Simplify3D before attempting to print it**
> **Always preview the generated gcode in Simplify3D before attempting to print it**
Set the coloring to `Active Toolhead` and enable `Travel moves` to ensure the part is using the correct tools at the correct times.

Expand All @@ -367,10 +374,10 @@ Process tbd, open to contributions.

# Authors and Acknowledgment

Author | Contribution
------ | -----------
@AndyEveritt | Code
Greg Holloway | Printer
| Author | Contribution |
| ------------- | ------------ |
| @AndyEveritt | Code |
| Greg Holloway | Printer |

# License

Expand Down
Loading

0 comments on commit 945ae70

Please sign in to comment.