"Application.executeTextCommand" can be used to create it to some extent. I've created a sample.
#Fusion360API python script
#Description-create PointAlongPath sample
import adsk.core, adsk.fusion, traceback
_app = adsk.core.Application.cast(None)
_ui = adsk.core.UserInterface.cast(None)
def run(context):
try:
global _app, _ui
_app = adsk.core.Application.get()
_ui = _app.userInterface
# new doc
_app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
des :adsk.fusion.Design = _app.activeProduct
des.designType = adsk.fusion.DesignTypes.ParametricDesignType
root :adsk.fusion.Component = des.rootComponent
# create sketch
crv = initSktCircle(root)
# create pipe
initPointAlongPath(crv, 0.5)
# create sketch
crv = initSktSpline(root)
# create pipe
initPointAlongPath(crv, 0.3)
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def initSktSpline(comp :adsk.fusion.Component):
skt :adsk.fusion.Sketch = comp.sketches.add(comp.xYConstructionPlane)
poss = [[-1,2,5], [2,1,0], [0,-4,2], [-2,5,-2]]
pnt3D = adsk.core.Point3D
objs = adsk.core.ObjectCollection.create()
[objs.add(pnt3D.create(x,y,z)) for (x,y,z) in poss]
crvs :adsk.fusion.SketchCurves = skt.sketchCurves
crv = crvs.sketchFittedSplines.add(objs)
return crv
def initSktCircle(comp :adsk.fusion.Component):
skt :adsk.fusion.Sketch = comp.sketches.add(comp.xYConstructionPlane)
pnt3D = adsk.core.Point3D
crvs :adsk.fusion.SketchCurves = skt.sketchCurves
crv = crvs.sketchCircles.addByCenterRadius(pnt3D.create(-5.0,-5,0), 4.0)
return crv
def initPointAlongPath(path, ratio):
txtCmds = [
u'Commands.Start WorkPointAlongPathCommand', # show dialog
u'Commands.SetDouble WORKGEOM_POP_ALONG {}'.format(ratio), # input distance
u'NuCommands.CommitCmd' # execute command
]
sels = _ui.activeSelections
sels.clear()
sels.add(path)
for cmd in txtCmds:
_app.executeTextCommand(cmd)
sels.clear()
Here's how to use TextCommands and how to find the ID.
https://forums.autodesk.com/t5/fusion-360-api-and-scripts/use-textcommands/td-p/9645688
後、ブログ紹介してくれてありがとう。