Hi @ebunn3 .
The normal direction of a surface can be obtained by using the SurfaceEvaluator object.
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-31dad9b2-ee1d-4216-8100-09ea44f9967a
This sample creates a sketch line in the normal direction when you click on the surface of the body.
# Fusion360API Python script
import traceback
import adsk.fusion
import adsk.core
def run(context):
ui = adsk.core.UserInterface.cast(None)
try:
app: adsk.fusion.Application = adsk.core.Application.get()
ui = app.userInterface
des: adsk.fusion.Design = app.activeProduct
root: adsk.fusion.Component = des.rootComponent
msg: str = 'Click Face /ESC - Cancel'
selFiltter: str = 'Faces'
skt: adsk.fusion.Sketch = None
while True:
# select face
sel: adsk.core.Selection = selectEnt(msg, selFiltter)
if not sel:
break
face: adsk.fusion.BRepFace = sel.entity
click: adsk.core.Point3D = sel.point
# get SurfaceEvaluator
eva: adsk.core.SurfaceEvaluator = face.evaluator
# get Normal
normal: adsk.core.Vector3D
_, normal = eva.getNormalAtPoint(click)
normal.normalize()
# target point
target: adsk.core.Point3D = click.copy()
target.translateBy(normal)
# sketch
if not skt:
skt = root.sketches.add(root.xYConstructionPlane)
skt.name = 'Normal'
# create Normal Line
skt.sketchCurves.sketchLines.addByTwoPoints(click, target)
if skt:
skt.deleteMe()
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def selectEnt(
msg: str,
filtterStr: str) -> adsk.core.Selection:
try:
app = adsk.core.Application.get()
ui = app.userInterface
sel = ui.selectEntity(msg, filtterStr)
return sel
except:
return None
Here we have used the getNormalAtPoint method.
Note that "BRepFace.evaluator" and "BRepFace.geometr.evaluator" are not strictly the same.