Reading/Writing Tool and Operation parameters of a selected operation

Reading/Writing Tool and Operation parameters of a selected operation

zero_divide
Participant Participant
749 Views
3 Replies
Message 1 of 4

Reading/Writing Tool and Operation parameters of a selected operation

zero_divide
Participant
Participant

Hello, I am the developer of HSMAdvisor - the speed and feed calculator for machinists. My users bombard me with requests for an F360 plugin that would allow them to calculate cutting parameters right from within the CAM module without copy-pasting between the 2 programs.

 

The functionality I need is:

1) Get the currently selected operation (HIGHLY DESIRED)

2) Read the Tool information (geometry, material, coating, etc.) (REQUIRED)

3) Read and Set Operation Information (DOC, WOC, Stepover, etc.) (REQUIRED)

4) Read the current workpiece material. (optional)

 

Here is the kind of information my app is dealing with:

HSMAdvisor2.PNG

 

Is the current level of F360 API access sufficient to implement this functionality?

So far, I can only see it perhaps doable with a horrible workaround like parsing setup sheets that Fusion generates.

 

Thank you!

Accepted solutions (1)
750 Views
3 Replies
Replies (3)
Message 2 of 4

kandennti
Mentor
Mentor
Accepted solution

Hi @zero_divide .

 

It's a great product!

 

As far as I know, it can do some things.
If you pre-select the toolpath and run the following script, it will display simple information.

# Fusion360API Python script
import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface

        sels :adsk.core.Selections = ui.activeSelections
        if sels.count < 1:
            ui.messageBox('Select the ToolPath')
            return

        ope :adsk.cam.Operation = adsk.cam.Operation.cast(sels.item(0).entity)
        if not ope:
            ui.messageBox('Select the ToolPath')
            return

        prmNames = [
            'strategy',
            'tool_diameter',
            'tool_number',
            'tool_spindleSpeed',
            'tool_surfaceSpeed',
        ]

        prmInfos = []
        for prmName in prmNames:
            prm :adsk.cam.CAMParameter = ope.parameters.itemByName(prmName)
            if not prm:
                continue

            prmInfos.append(
                f'{prmName} :: {prm.expression}'
            )

        ui.messageBox('\n'.join(prmInfos))

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

1.png

I believe that numbers, letters, and Bool can be retrieved and set.

 

However, I don't know how to know what the final number will be if it is made up of expressions.

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/how-to-get-the-final-value-of-camparameter... 

 

I think it is currently difficult to create a product like HSMAdvisor.

 

 

0 Likes
Message 3 of 4

zero_divide
Participant
Participant

Thank you for the info.

Yeah trying to parse those equations is going to be very difficult....

 

But that's just a part of the job. Then I have to write them in a way that will not screw up related fields....

0 Likes
Message 4 of 4

Roost-Concepts
Contributor
Contributor

Bump! It would be amazing to see HSMAdvisor integrated into Fusion 360.

 

0 Likes