Hello Xing Lei,
In order to place the pinned projection in the suggested location defined by other projections (and indicated by the gray flag), please use the following code:
import Metashape
chunk = Metashape.app.document.chunk #active chunk
for marker in chunk.markers:
for camera in chunk.cameras:
if camera in marker.projections.keys():
continue #skipping cameras that already do have projections
if not camera.transform:
continue #skipping Not Aligned cameras
x, y = camera.project(marker.position)
if (0 <= x < camera.sensor.width) and (0 <= y < camera.sensor.height):
marker.projections[camera] = Metashape.Marker.Projection(Metashape.Vector([x,y]), True)