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:
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: