Hi @lukeQA94F -San.
I tried to find it, but there seems to be no break function.
I tried to make a sample using the text command, but I don't think it is useful for actual use.
# 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
app.documents.add(core.DocumentTypes.FusionDesignDocumentType)
des: fusion.Design = app.activeProduct
root: fusion.Component = des.rootComponent
ary = [
[0, 0, 0],
[1, 3, 0],
[2, -1, 0],
[3, 0, 0],
[4, 2, 0],
[5, 0, 0],
]
points = [core.Point3D.create(*a) for a in ary]
skt: fusion.Sketch = root.sketches.add(
root.xYConstructionPlane
)
crv: fusion.SketchFittedSpline = create_spline(skt, points)
break_curve_by_points(crv, points[1:-1])
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def break_curve_by_points(
crv: fusion.SketchEntity,
points: list[core.Point3D],
):
app: core.Application = core.Application.get()
sels: core.Selections = app.userInterface.activeSelections
skt: fusion.Sketch = crv.parentSketch
target: fusion.SketchFittedSpline = crv
for pnt in points:
sels.clear()
sels.add(skt)
app.executeTextCommand(u"Commands.Start SketchActivate")
target = break_curve(target, pnt)
app.executeTextCommand(u"Commands.Start SketchStop")
def break_curve(
crv: fusion.SketchEntity,
point: core.Point3D,
):
app: core.Application = core.Application.get()
sels: core.Selections = app.userInterface.activeSelections
eva: core.CurveEvaluator3D = crv.geometry.evaluator
_, prm = eva.getParameterAtPoint(point)
_, vec, _ = eva.getCurvature(prm)
vec.scaleBy(0.01)
sPnt: core.Point3D = point.copy()
sPnt.translateBy(vec)
vec.scaleBy(-1)
ePnt: core.Point3D = point.copy()
ePnt.translateBy(vec)
skt: fusion.Sketch = crv.parentSketch
lines: fusion.SketchLines = skt.sketchCurves.sketchLines
tool: fusion.SketchLine = lines.addByTwoPoints(sPnt, ePnt)
sels.clear()
sels.add(crv)
app.executeTextCommand(u"Commands.Start BreakSketchCmd")
try:
tool.deleteMe()
except:
pass
sels.clear()
return skt.sketchCurves[-1]
def create_spline(
skt: fusion.Sketch,
points: list[core.Point3D],
) -> fusion.SketchFittedSpline:
splines: fusion.SketchFittedSplines = skt.sketchCurves.sketchFittedSplines
return splines.add(
core.ObjectCollection.createWithArray(points)
)
