I am currently looking for a quick way to transform Rhino geometry from Grasshopper without referencing and baking.
OpenNest’s Transform GUID is basically what I need, but unfortunately they did not expose the delete orignal boolean, so you always keep the original.
Does anyone know a quick way of transforming GUID and deleting the original Geometry?
My pseudo code attempt in Python (ps: I don’t really know Python):
"""Provides a scripting component.
Inputs:
x: List of GUIDs
y: List of Transforms
z: Bool delete original
u: Trigger transform
Output:
a: The a output variable"""
__author__ = "seltz"
__version__ = "2022.03.09"
import rhinoscriptsyntax as rs
import Rhino as rc
import scriptcontext as sc
import System.Guid
sc.doc = rc.RhinoDoc.ActiveDoc
if u:
for i in x:
rhobj = x(i)
xform = y(i)
delete = z
sc.doc.Objects.Transform(rhobj, xform, delete)
sc.doc.Views.Redraw()
Set any number of “floor objects”, set any number of geometries placed above the floor, transform the objects so they sit directly on the floor objects:
If you get GUID from referenced geometry, the geometry parameter will be expired if any transforms are made. If so, you probably put a Data Dam between geometry and GUID (iirc)
I’m pretty sure we’re getting caught in a feedback loop, where the added/manipulated Rhino object geometry parameter will retrigger the GHPython component during computation. You can internalise the guid list to avoid this:
If the Python component is the terminal component, you can put the transform code in AfterSolveInstance (with SDK mode enabled) Otherwise you need to revise the logic flow.
Interestingly, if I make it into a Grasshopper Player command it works with no error messages (they are probably just hidden).
That’s kind of what I wanted anyways. Now if only there was a better boolean input for Grasshopper Player. Why can’t we set a default for a boolean, so you only have to press Enter like you do for Rhino commands?? Or just add a component that is only a confirmation.
I tried with just having the the u input set to always true, so you don’t have to have a stupid boolean just to ask “do you really want to do the thing you started the command for”, but then it transforms twice.
Hi all!
I tried with c#, and I’ve seen one of the problem is when you are using multiple IDs , committing a change on the first object would already retrigger the c# while it is still working on the second…
A solution: load your IDs and transformations as tree, so the c# is executed only once for each button press.
Please provide same-structure and same-length trees on “id” and “T” parameters. (maybe use longest list before?)
Also, this is ignored by undo function, so beware!