How to edit the values of the MachineAvoidGroups automatically inserted by Fusion

How to edit the values of the MachineAvoidGroups automatically inserted by Fusion

maurizio_manzi
Advocate Advocate
342 Views
2 Replies
Message 1 of 3

How to edit the values of the MachineAvoidGroups automatically inserted by Fusion

maurizio_manzi
Advocate
Advocate

Hello,
in this example:
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-a0cfe144-1a0f-4109-9125-8fbd3176ceed 
are only the munually groups in use:

# Get the MachineAvoidGroups object from the CadFaceGroups cad object. This object manages the list of mutually exclusive groups.
        _machineAvoidGroups = surfaceGroupsParam.getMachineAvoidGroups() 

 Neither in the example nor in the API documentation could I find how to change the mode for the groups automatically inserted by Fusion.

Best regards
Maurizio

343 Views
2 Replies
Replies (2)
Message 2 of 3

Josh3GG88
Enthusiast
Enthusiast

this works good for me:

 
def FlatMillFaces(tool: int, machine, faces, sheet: adsk.cam.Setup):
    if len(faces) > 0:
        edgelist = []
        for items in faces:
            items: adsk.fusion.BRepFace
            for loop in items.loops:
                if loop.isOuter:
                    for e in loop.edges:
                        edgelist.append(e)
        tool = Utility.ToolGetter(machine, tool)
        sheets = sheet.parentSetup
        flatInput: adsk.cam.OperationInput = sheets.operations.createInput("flat")
        flatInput.tool = tool
        preset = tool.presets.itemsByName("Default preset")
        flatInput.toolPreset = preset[0]
        flatInput.displayName = f'PocketMill {tool.parameters.itemByName("tool_description").value.value}'
        #flatInput.parameters.itemByName("tool_coolant").value.value = "disabled"
        flatInput.parameters.itemByName("useRestMachining").value.value = False
        flatInput.parameters.itemByName("restMaterialSource").value.value = "job"
        flatInput.parameters.itemByName("topHeight_mode").value.value = "from stock top"
        flatInput.parameters.itemByName("topHeight_offset").expression = "0 in"
        #flatInput.parameters.itemByName("topHeight_checkStockTop").value.value = True


        flatOp: adsk.cam.Operation = sheets.operations.add(flatInput)
        flatOp.parameters.itemByName("boundaryMode").value.value = "none"
        flatOp.parameters.itemByName("direction").value.value = "both ways"
        flatOp.parameters.itemByName("transitionType").value.value = "curve"
        surfaceGroupsParam: adsk.cam.CadMachineAvoidGroupsParameterValue = flatOp.parameters.itemByName('checkSurfaceSelectionSets').value        
        machineAvoidGroups = surfaceGroupsParam.getMachineAvoidGroups()
        ModelGroup = machineAvoidGroups.defaultGroup(1)
        ModelGroup.machineMode = adsk.cam.MachiningMode.Avoid_MachiningMode
        machineAvoidGroup: adsk.cam.MachineAvoidDirectSelection = machineAvoidGroups.createNewMachineAvoidDirectSelectionGroup()
        machineAvoidGroup.machineMode = adsk.cam.MachiningMode.Machine_MachiningMode
        machineAvoidGroup.inputGeometry = faces
        surfaceGroupsParam.applyMachineAvoidGroups(machineAvoidGroups)
Message 3 of 3

maurizio_manzi
Advocate
Advocate

Hello,

ModelGroup = machineAvoidGroups.defaultGroup(1)
        ModelGroup.machineMode = adsk.cam.MachiningMode.Avoid_MachiningMode

don't works.
The mode remain even at machining.
It change not to avoid.
Best regards
Maurizio

0 Likes