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: 

Create a axis perpendicular at point

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
oyvindTMNSU
232 Views, 5 Replies

Create a axis perpendicular at point

When I create a construction axis “perpendicular at point” in the UI, I only need to click a face, and the software create a axis perpendicular to the selected face AT THE EXACT POINT ON THE FACE WHERE I SELECTED IT WITH THE CURSOR. 

when I try to use the API to create this feature with help of user inputs, the API says that the feature need a face AND a pint as arguments. 

how can I get the functionality that the UI gives, meaning selecting the face and the point in one click? 
is it even possible?

 

also, it’s it possible to get the coordinates of where the mouse cursor is when hoovering over a face and it gets blue ( ready to be selected)? Or even when hoovering over a face that is already selected?

 

@BrianEkins @prainsberry 

5 REPLIES 5
Message 2 of 6

Hi @oyvindTMNSU 
You can able to get the point with the selection object

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-c6307268-d1b4-4cbe-92e7-ed43c24562f2

Here is the little snippet which replicates the functionality of create axis perpendiculat at point I have used the userInterface select entity method to do it. you can also use selection Input command as well.

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        doc = app.activeDocument
        design : adsk.fusion.Design = doc.products.itemByProductType('DesignProductType')

        ## Create axis perpendicular to point
        selction = ui.selectEntity("Select a face", "PlanarFaces")

        if selction and selction.entity.objectType == adsk.fusion.BRepFace.classType():
            face :adsk.fusion.BRepFace = selction.entity
            point = selction.point

            construcntionAxisInput = design.rootComponent.constructionAxes.createInput()

            construcntionAxisInput.setByPerpendicularAtPoint(face, point)

            axis = design.rootComponent.constructionAxes.add(construcntionAxisInput)
    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 


Boopathi Sivakumar
Senior Technology Consultant

Message 3 of 6
oyvindTMNSU
in reply to: oyvindTMNSU

Thank you very much! I will try that.

 

Another question, how can I get the effect that the hole feature gives when selecting a point? That the center point of the circle shows up and its possible to snap to it?
See video.
@boopathi.sivakumar 

 

Message 4 of 6

Hi @oyvindTMNSU 

Its a combination of preview handler and custom graphics 

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-c7d4d41e-cb39-11e7-ac26-005056c00008

here is a sample example 


Boopathi Sivakumar
Senior Technology Consultant

Message 5 of 6
oyvindTMNSU
in reply to: oyvindTMNSU

is it possible to display custom graphics when hovering over an entity? For example when hovering over a face it will be blue, on that que a want to display a custom graphics. a line normal to the face the user hover over. Following the position of the cursor until its clicked and then the line become permanent (permanent during preview).

@boopathi.sivakumar 

Message 6 of 6
oyvindTMNSU
in reply to: oyvindTMNSU

 

 

 

 

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