So I was planning for more than a year to implement a fusion 360 script to help automate a new manufacturing process I am working with. There are hundreds of toolpath operations that need to be created for a single part, so making them manually is impractical, but it is highly amenable to automation.
I have been advancing the project, but completely run aground when I discovered the CAM api has apparently not changes since 2016! It still has only very rudimentary functionality, and cannot be used to create toolpaths like the user can, for instance. Why not expose this?
The plugin I am trying to write first slices an object into layers that can be manufactured through 3d milling, then slices the surface of the model at the layer tops, then needs to input these surfaces into the cam toolpaths. There are sometimes quite thin layers, so there end up being hundreds of toolpaths for a complex or highly detailed part, with as many toolchanges. Totally impracticaly to do it manually.
Solved! Go to Solution.
Solved by GeorgeRoberts. Go to Solution.
Is there a macro using API in HSMWorks?
I could not find it by searching the forum.
PowerMill (Autodesk) implements very powerful macros.
It is an impression that has been actively worked since the Delcam era.
cool thanks for the tip, I will look into powermill. When I say macro I mean a keyboard macro, like a second program that sends keyboard and mouse signals repetitively. Very cumbersome.
This is a demonstration of simply creating a drilling tool path on a board.
The CAD data is imported and the macro is executed.
・ Recognize hole shapes from 3D data
・ Select and create tools and processes according to the hole diameter
・ Execution of tool path creation batch
After that, a simulation was performed.
This is only drilling, but it should be possible to automate even milling.
In my opinion, PowerMill users are more likely to work on macros.
There are also many specialists on the forum.
Unfortunately, Fusion360's CAM cannot do this.
ok, thanks. I don't know if macros will cut it, it sounds like it might lack the power of a proper programming language, but I will try it. I tried to find documentation, but could not find any good documentation like they have for fusion. That's a real problem, unfortunately. Gotta be documented.
This is being worked on by @Customgeo Roberts. Maybe he can update
Inventor HSM and Fusion 360 CAM trainer and postprocessor builder in the Netherlands and Belgium.
Hello,
Thanks for tagging me @ArjanDijk! He is correct, we are currently working on improving the CAM API. Some of the things we are currently working on are:
- Create operations from templates
- Get/set parameters
- Get/set geometry
- Post process
Hopefully we can finish this soon and then look into other areas of the CAM API. If you have any thoughts / feedback, feel free to contact me: george.roberts@autodesk.com
George Roberts
Manufacturing Product managerEDIT: https://forums.autodesk.com/t5/fusion-360-api-and-scripts/further-coverage-of-cam-api/m-p/9532970
Looks like they are working on something.
Agreed. My family business developed a 100% automated CAM system for hole drilling and 2D machining for another CAD environment. We are swapping to Inventor and had dreams of leveraging and existing CAM that runs inside the CAD environment so we didn’t have to reinvent a hundred thousand lines of code but at this rate I may be backed into that very corner. I think even “Phase 2” isn’t going to have any level of “light out” CAM programming as I would need control over stock, setups, and MCS along with the things mentioned in “Phase 2”. I think I’ll be waiting for phase 3 or 4.
Good morning,
In the latest release of Fusion, you can do much more with the API:
Here is a very simple sample to give you an idea of how you can access this:
import adsk.core, adsk.fusion, adsk.cam, traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
prod = app.activeProduct
# cast the CAM product (need to be in the CAM workspace. Although you could explicitly set it on the CAMProduct)
cam = adsk.cam.CAM.cast(prod)
# get the first setup
setup = cam.setups.item(0)
#Insert template into the selected setup. In reality, you would probably put these templates in some sort of resource folder
setup.createFromTemplate("D:\\Face.f3dhsm-template")
operations = setup.allOperations
for operation in operations:
# get a collection of parameters
parameters = operation.parameters
# use itemByName to access the stepover parameter
stepOver = parameters.itemByName("stepover")
# if that parameter exists, set the expression to 2mm
if stepOver:
stepOver.expression = "2mm"
# add a note to tell the user the stepover has been adjusted
operation.notes = "Automatically changed stepover"
# generate toolpaths
cam.generateAllToolpaths(True)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
As you can see, we are still actively working on the API and hope to have more functionality in near-term releases, but just these few tasks massively expands the reach of the previous CAM API. If anyone would like to have a discussion about their API requirements, please contact me any time: george.roberts@autodesk.com
George Roberts
Manufacturing Product managerThank you for a good job.
Since operation.parameters is an ObjectCollection, you will not notice unless you use breakpoints when debugging.
I think it is better to add such code or code that dumps operation.parameters to Help as a sample program.
I feel that your hard work on the API of CAM is the reason why it has not been transmitted to add-in developers.
Thanks for the feedback, that makes sense. I'll create some sample programs and see about getting them added to sample files
George Roberts
Manufacturing Product managerWe are pretty excited about the new CAM API rollout.
Two questions:
1. Will this trickle into InventorCAM?
2. I see that there is access to parameters for setup objects. Under ...parameters.itemByName("") I could see the possibility of having access to get/set nearly all parameters for setups and operations. For my company we would definitely need to be able to set the WCS and stock programmatically. Will this functionality be available?
Can't find what you're looking for? Ask the community or share your knowledge.