I have created an image (.jpg) which I would liike to draw on the screen using Python, not through the Picture command. There’s more to the project which requires this part to be done in Python using RhinoScriptSyntax. In particular, the end result is printed to an Epilog laser cutter where the image is engraved on the surface of a sheet of acrylic and the border cuts out each of the 18 individual pieces.
So far I have the following code with the variable “image” drawn using Image and ImageDraw from PIL
import Rhino as rh
import rhinoscriptsyntax as rs
import scriptcontext as sc
from PIL import Image, ImageDraw
image = Image.new("RGB", (width, height), white)
draw = ImageDraw.Draw(image)
# Code to draw the square image into the variable "image"
# This code work fine and allows me to save the image in a file as a JPG.
...
hatched_layer_index = sc.doc.Layers.Find (“Layer 01”, True)
current_layer_index = sc.doc.ActiveDoc.Layers.CurrentLayerIndex
# The border is Layer 0 which is cut through the entire sheet whereas
# the image is engraved on the surface (Layer 1).
# How do I draw the contents of "image" using rhinoscript (rs) into Layer 1?
sc.doc.ActiveDoc.Layers.SetCurrentLayerIndex (current_layer_index, True);
rs.Redraw ()
Does the jpeg need to be some kind of native Rhino object for the laser cutter to do its thing from Layer 1, or does the jpeg literally only need to be displayed on screen, and that could be in any application?
Does the jpeg need to be some kind of native Rhino object for the laser cutter to do its thing from Layer 1, or does the jpeg literally only need to be displayed on screen, and that could be in any application?
Ignoring the save as a JPG, it is this “image” that I want to draw on the Rhino 6 screen into a particular Layer so as to distinguish it from the Layer that cuts out the square acrylic coaster.
Thanks. I’m not going to be able to try anything in Rhino 6. But if all else fails with the IronPython APIs, I would do the operations manually, and note down the Rhino Commands in the window just under the pull down menus, then try a script that inputs those strings into rs.command