How to set my X,Y,Z coordinates as Tool-Orientation-Origin over the API ?

maurizio_manzi
Advocate Advocate
389 Views
2 Replies
Message 1 of 3

How to set my X,Y,Z coordinates as Tool-Orientation-Origin over the API ?

maurizio_manzi
Advocate
Advocate

Hello,

How can I change the Origin-mode to "selected point" and how can I select my X,Y,Z coordinates as Tool Orientation Origin, over the API ?

 

 

21-04-_2023_13-54-27.png

 

Best regards

Maurizio

 

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

kandennti
Mentor
Mentor
Accepted solution

Hi @maurizio_manzi .

 

I don't think it can be set with XYZ coordinate values. It is the same as when you operate manually.
I made a sample that switches to "selected point".
Instead of the origin of the coordinate values, you can assume that a sketch point has been pre-created to be the origin.

・・・

        # get operation
        ope: cam.Operation = setup.operations[0]

        # tool orientation On
        prm: cam.ParameterValue = ope.parameters.itemByName('overrideToolView')
        if not prm: return

        if not prm.value.value:
             prm.value.value = True

        # change mode - "selected point"
        prm = ope.parameters.itemByName('view_origin_mode')
        if not prm: return

        if prm.value.value != 'point':
             prm.value.value = 'point'

        # get new origin point
        rootOcc: fusion.Occurrence = camObj.designRootOccurrence
        rootComp: fusion.Component = rootOcc.component
        targetPoint: fusion.SketchPoint = rootComp.sketches[-1].sketchPoints[-1]

        # set new origin
        prm = ope.parameters.itemByName('view_origin_point')
        if not prm: return

        prm.value.value = [targetPoint]
・・・


You may find this document helpful.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-A08218F6-3885-4677-9CAD-7234BCEE85CC 


Also, here is a sample script that may be useful.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-6C0B7B3E-A7FC-45FE-BF64-D1BC4EC09A2D 

0 Likes
Message 3 of 3

maurizio_manzi
Advocate
Advocate

Thank you very much. It works fine

0 Likes