Issues with Python Script for Baking Objects in Grasshopper

Hello everyone,

I’m working on a Python script in Grasshopper that reads coin data from a JSON file, sets values on sliders, and bakes the results into the Rhino environment. However, I’m running into issues where the script only prints certain values and doesn’t seem to execute the commands after the baking step correctly. The objects are baked correctly, but are not moved after baking.

"# -- coding: utf-8 --
import rhinoscriptsyntax as rs
import Rhino
import json
import System

gh = Rhino.RhinoApp.GetPlugInObject(“Grasshopper”)

rs.EnableRedraw(True)

import rhinoscriptsyntax as rs
import json
with open(r’E:\УАСГ\Python Rhino\Български монети.json’, ‘r’) as cjs: # ‘r’ = read only
coin_data = json.load(cjs)

coin_values =

for coin in coin_data:
coin_values.append(coin[“value”])
a = coin_values

j=1
for i in coin_values:

gh.SetSliderValue("8fe7de89-bb04-496c-8ce0-58554413301c",i)


gh.RunSolver("coinsscript.gh")
transVect = (25*j,0,0)
baked = gh.BakeDataInObject("619dc5c3-b705-4922-bce3-47f3c1a7fc16")
moved_object = rs.MoveObject(baked, transVect)
j = j+1

"
Български монети.json (700 Bytes)
coinsscript.gh (13.3 KB)

Is this Rhino 7 or Rhino 8?

Rhino 8 Content Cache tracks the objects. So normally I would output the objects and let the content Cache manage the bake.

Rhino 7, but I could try on Rhino 8 on the other computer. Will look it up thanks

This is what needs to be added in 8 to keep track of the objects between pushing the Grasshopper geometry into Rhino. Oterwise the definitinon was exactly the same.