CAM-setup: How to set XY orientation same as the XY orientation of a component origin?

CAM-setup: How to set XY orientation same as the XY orientation of a component origin?

maurizio_manzi
Advocate Advocate
222 Views
2 Replies
Message 1 of 3

CAM-setup: How to set XY orientation same as the XY orientation of a component origin?

maurizio_manzi
Advocate
Advocate

Hello,
I create a setup over python script and set "wcs_orientation_mode" to "axesXY". This works fine.
Now I have to set "wcs_orientation_axisX" and "wcs_orientation_axisY" in the same direction as the XY axis in the origin of a component. Anyone have an idea?
Best regards
Maurizio

0 Likes
Accepted solutions (1)
223 Views
2 Replies
Replies (2)
Message 2 of 3

boopathi.sivakumar
Autodesk
Autodesk
Accepted solution

Hi @maurizio_manzi 

You can follow this sample 
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-13e1321f-cfa6-48d7-a75a-fa74d88549d1https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-13e1321f-cfa6-48d7-a75a-fa74d88549d1
Its slightly differnt that it uses the compoenet origin for the coordinate system method 

but in a simple here is something how it would work if I have one component and the one cam setup and it modify the cam setup to use the components X and Y origin

    doc = app.activeDocument
    cam : adsk.cam.CAM = doc.products.itemByProductType('CAMProductType')
    design : adsk.fusion.Design = doc.products.itemByProductType('DesignProductType')

    rootComp = design.rootComponent
    occ = rootComp.occurrences.item(0) ## using the first occurrence
    component = occ.component


    setup = cam.setups.item(0) ## modifying the first setup
    setup.parameters.itemByName('wcs_orientation_mode').expression = "'axesXY'"


    xOrigin :adsk.cam.CadObjectParameterValue = setup.parameters.itemByName('wcs_orientation_axisX').value
    xOrigin.value = [component.xConstructionAxis.createForAssemblyContext(occ)] ## using the xConstructionAxis of the component

    yOrigin :adsk.cam.CadObjectParameterValue = setup.parameters.itemByName('wcs_orientation_axisY').value
    yOrigin.value = [component.yConstructionAxis.createForAssemblyContext(occ)] ## using the yConstructionAxis of the component

 


Boopathi Sivakumar
Senior Technology Consultant

Message 3 of 3

maurizio_manzi
Advocate
Advocate

Thank you very much.
Best regards
Maurizio

0 Likes