There are three different objects that represent a point; construction point, sketch point, and a vertex on a surface or solid model.
The ConstructionPoint object has a "geometry" property that returns a Point3D object which is a wrapper for the coordinates of a point.
The BRepVertex object also has a "geometry" property that returns a Point3D object.
The SketchPoint object also has a "geometry" property but in this case the coordinate returned is not what you want. A sketch point is defined in sketch space, not model space, and the coordinate returned by the "geometry" property is in sketch space. However, the SketchPoint object has a worldGeometry property which returns a Point3D object in world space.
Below is some code that demonstrates repositioning a selected occurrence to a selected point.
def moveOccurrenceToPoint():
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Have the occurrence selected.
occSel = ui.selectEntity('Select an occurrence', 'Occurrences')
occ = adsk.fusion.Occurrence.cast(occSel.entity)
if not occ:
ui.messageBox('An occurrence must be selected.')
# Have the point selected.
pointSel = ui.selectEntity('Select a point', 'Vertices, SketchPoints, ConstructionPoints')
pnt = pointSel.entity
if not pnt:
ui.messageBox('A point must be selected.')
# Get the point geometry.
coord = adsk.core.Point3D.cast(None)
if type(pnt) is adsk.fusion.ConstructionPoint or type(pnt) is adsk.fusion.BRepVertex:
coord = pnt.geometry
elif type(pnt) is adsk.fusion.SketchPoint:
coord = pnt.worldGeometry
# Reposition the occurrence.
occMatrix = occ.transform
occMatrix.translation = coord.asVector()
occ.transform = occMatrix
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))