Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Grasshopper/Python - Replace geometry while keeping GUID

$
0
0

Hello everyone,

I am trying to write my own version of “Replace” component, which could be found in LegoPod for Rhino 7. Now I want to have my own python-based component, that would do the same thing, in Rhino 8.

The idea is that I would like to replace geometry in an object, while keeping its GUID and attributes etc.

Here is how far I have got, but it doesn’t work:

import Rhino as rc
import scriptcontext as sc
import rhinoscriptsyntax as rs

sc.doc = rc.RhinoDoc.ActiveDoc
rs.EnableRedraw(False)
objecttable = sc.doc.Objects

if a==1:
    for object_id in IDs:
        objecttable.Replace(object_id,Geo)      

rs. EnableRedraw(True)
sc.doc = ghdoc

Both IDs and Geo are List Access. I would like to be able to connect tree structure of both IDs and Geometry.

Could someone please help?

Best,
P

PS: Greasshopper file for Rhino 8:
Replace in Python.gh (6.4 KB)

17 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles