Here's some code that demonstrates doing the equivalent of the point-to-point move. To demonstrate a couple of approaches, for the first point I have an entity selected that represents a point get the X-Y-Z position of the point in space. For the second point, I have a hard-coded coordinate but they could both be calculated somehow or both be from a user selection. In the end, I have two Point3D objects which represent the X-Y-Z coordinates of the from and to points.
It then creates a matrix and defines the translation portion of the matrix using the vector that defined from point 1 to point 2. Finally, it uses this matrix to create a move feature to move the selected body.
# Get a body by having the user select one.
body: adsk.fusion.BRepBody = ui.selectEntity('Select a body.', 'Bodies').entity
# Have an entity selected that represents a point.
# This can be a Vertex, Sketch Point, or Construction Point.
pointEnt = ui.selectEntity('Select a point entity', 'ConstructionPoints, SketchPoints, Vertices').entity
# Get the XYZ position of the point in model space.
pnt1: adsk.core.Point3D = None
if pointEnt.objectType == adsk.fusion.SketchPoint.classType():
skPoint: adsk.fusion.SketchPoint = pointEnt
pnt1 = skPoint.worldGeometry
else:
pnt1 = pointEnt.geometry
# The second point is defined using a known coordinate.
pnt2 = adsk.core.Point3D.create(5, 0, 0)
# Create a matrix that defines the translation from point 1 to point 2.
trans: adsk.core.Matrix3D = adsk.core.Matrix3D.create()
trans.translation = pnt1.vectorTo(pnt2)
# Create a move feature using the matrix.
moveFeatures = des.rootComponent.features.moveFeatures
inputEnts = adsk.core.ObjectCollection.create()
inputEnts.add(body)
moveInput = moveFeatures.createInput(inputEnts, trans)
moveFeature = moveFeatures.add(moveInput)
---------------------------------------------------------------
Brian EkinsInventor and Fusion 360 API Expert
Website/Blog:
https://EkinsSolutions.com