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?
Solved! Go to Solution.
Solved by boopathi.sivakumar. Go to Solution.
Solved by boopathi.sivakumar. Go to Solution.
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()))
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
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
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).
Can't find what you're looking for? Ask the community or share your knowledge.