I want to automatize the creation of Clipping Boundary in my Images (references externes) using known coordinates. I'm able to do it manually using the native function IMAGECLIP in autocad by drawing a polygon. I've try this code but it doesn't work : import comtypes.client from pyautocad import aDouble # Connexion à l'application AutoCAD active acad = comtypes.client.GetActiveObject("AutoCAD.Application") doc = acad.ActiveDocument modelspace = doc.ModelSpace # Appliquer la boundary de clip à l'image raster def apply_clip_boundary(raster, points): raster.ClippingEnabled = True # Activer le clipping # Debugging: Output the clip points to verify the correct format print("Points to be passed to ClipBoundary:", list(points)) print(raster.ClipBoundary) # Appliquer la ClipBoundary raster.ClipBoundary = points # Assurez-vous que les points sont bien formatés print("Clip boundary applied and enabled.") print(raster.ClipBoundary) # Créer les points 2D initiaux (x, y) points = aDouble( 325100.2407, 7682500.6218, 325100.6019, 7682500.6218, 325100.6019, 7682500.3992, 325100.2407, 7682500.3992 ) # Sélectionner un raster par son nom def get_raster_by_name(name): for item in modelspace: if item.ObjectName == "AcDbRasterImage" and item.Name == name: return item return None # Obtenir le raster et appliquer la boundary raster = get_raster_by_name("Orthophoto") if raster: apply_clip_boundary(raster, points) else: print("Raster not found.") I would like to avoid "SendCommand" method, as much as possible... Continue reading...