Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
maurizio_manzi
176 Views, 2 Replies

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

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

 

2 REPLIES 2
Message 2 of 3
kandennti
in reply to: maurizio_manzi

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 

Message 3 of 3
maurizio_manzi
in reply to: kandennti

Thank you very much. It works fine

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report