Using Vectorize plugin with rs.Command

Hi there! I am trying to script a button that imports in real scale a picture and after that uses the complete path to call Vectorize plugin, the goal is in one clic have the image and vectors:

rs.Command("_-Picture " + file + " x 0", False)
rs.Command("_-Vectorize " + file)

The plugin seems to be delayed by few milliseconds, but I am not able to put after file (complete path) an _Enter because it cancels the process.

Is it possible to wait after the vectorize process finishes in order to send an _Enter command or it should be pressed manually by the user?

I appreciate your answer!

Hi Vincente - try

file = rs.OpenFileName()

file = chr(34) + file + chr(34)

rs.Command("_-Picture " + file + " 0 Enter ", False)

rs.Command("_-Vectorize " + file + " Enter")

-Pascal

Hi Pascal, same problem, I attach the complete code

# coding=utf-8
import rhinoscriptsyntax as rs

"""
VERSION 1 - Version inicial que importa imagen y vector. Hay que darle a intro para que termine de cargar los vectores
"""

def ImportarImagenVector():
    # Si no se ha guardado el archivo de Rhino salimos para evitar errores
    if rs.DocumentPath() is None: 
        rs.MessageBox ("Guarda primero el archivo de Rhino") 
        return
    else:
        # Indicamos la ruta del archivo actual
        rutaImagen=rs.DocumentPath()
        file = rs.OpenFileName("Abrir","Archivos JPG (*.jpg)|*.jpg||",rutaImagen)
        
        if file is None:
            return
        else:
            # Llamamos a cargar una imagen a escala 1:1 y vectorizamos
            rs.Command("_-Picture " + file + " x 0", False)
            rs.Command("_-Vectorize " + file)
            
            # Deseleccionamos todo para evitar errores
            rs.UnselectAllObjects()
ImportarImagenVector()

In my opinion the problem is not the path, because it works, is that it sends _Enter command too early (before vectors appear) and it seems to cancel the process.

I this example I omitted the last _Enter, the original problem was witting this instead the above:

rs.Command("_-Vectorize " + file + " _Enter")

Thanks!