Hi @maurizio_manzi -San.
How about something like this?
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
root: fusion.Component = des.rootComponent
# sketch
skt: fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
# points
stPnt: fusion.SketchPoint = skt.sketchPoints.add(
core.Point3D.create(1,2,3),
)
edPnt: fusion.SketchPoint = skt.sketchPoints.add(
core.Point3D.create(4,5,6),
)
# line
sktLine: fusion.SketchLine = skt.sketchCurves.sketchLines.addByTwoPoints(
stPnt,
edPnt,
)
# plane
planeIpt: fusion.ConstructionPlaneInput = root.constructionPlanes.createInput()
planeIpt.setByDistanceOnPath(
sktLine,
core.ValueInput.createByReal(1),
)
plane: fusion.ConstructionPlane = root.constructionPlanes.add(
planeIpt,
)
ui.messageBox("Done")
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))