In an effort to cross manage my Rhino and GH menagerie, I’d like to be able to take the name of the GH doc I’m working with and paste it on the Rhino screen along with a baked image of whatever I’ve generated - or maybe there’s an easier way to do something like this? Any suggestions?
in python script component
print ghdoc.Path print ghdoc.Name
Thank you Ivelin!
This will print in Rhino console
I was initially confused with the title “Referencing the ghdoc from within the ghdoc”
import clr clr.AddReferenceToFileAndPath(ghdoc.Path)
That leads to
RhinoDotNetCrash.txt being created on the desktop and this error message:
I’m confused how this is supposed to be used. Within the Python component?
"""Provides a scripting component. Inputs: x: The x script variable y: The y script variable Output: a: The a output variable""" __author__ = "zooid" __version__ = "2019.06.18" import rhinoscriptsyntax as rs import Rhino Rhino.RhinoApp.WriteLine(ghdoc.Path)
If that is not enough, I’m gonna need a little more info what are you doing.
Thanks, also useful. I’d be curious to know how others cross-reference their Rhino and GH files. I know I’m always doing things on the fly and then have to reinvent the wheel several times a week. There’s also a limit to how descriptive titles can be after a while.
I think I got it.
You mean if a GH file is taking geometry from a Rhino file.
You can name them similar or you can open the GH file first and there you can put a script to open the associated Rhino document.
Now you’ve got my curiosity piqued. What would you consider the best (most brainless) way to associate a GH and Rhino doc?
I would go for the strategy which Ivelin mentioned (same name on the GH and Rhino doc), with one addition: Use (or allow for) a “delimiter” in the GH name so that you can have one or more GH definitions for each Rhino file. Like so
… so that different gh files can open/operate on the same Rhino file. (Sometimes that’s very useful if you have some generic base geometry in a Rhino file which is further processed in GH into vairants etc.).
I also got my own curiosity on overdrive
This is what I got:
so double click the GH file to start rhino and grasshopper, then when the gh document is opened click on this button to get the correct rhino document
Could you post the code?
GH.document.path.gh (5.3 KB)
Yep, GH seems to crash, I wonder if we can get around all that somehow?
Hi Rolf. Your suggestion presupposes a certain degree of self-awareness on the user: me! Often I’m sleepwalking and create a GH file and a Rhino doc which work together but are not necessarily linked by name. Fortunately at least, they usually reside in the same directories. I’m looking for some tenuous thread between them.
Another thing that I do is put each gh file in its own folder along with the rhino file. No way to make mistakes, I think .
That’s what I also do, or try to do, place in the same folder. Problem is that I often try out variants of a definition while preserving a previous version and… the folder ends up being filled with different gh files. Numbering the copies is one strategy, but when trying out different concepts, I tend to add the different concept to the original gh file name, and after a while, a week or more, I end up having loads of GH files not knowing which named concept variant is the best…
Check this thread:
This command line works:
@Echo off cd "C:\Program Files\Rhino 6\System\" start Rhino.exe /runscript="_-Open F:\\path\\to\\files\\myRH_file.3dm _-GrasshopperOpen F:\\path\\to\\files\\myGH_file.gh
- create txt file
- rename it as .bat or .cmd
- open with text editor
- paste the code above
- change the paths and file names
- double click the cmd/bat file
I know this is opening a whole can of worms, which a little discipline could help overcome, but if your geometry is internalized in a GH doc then it “should” be possible to reference its GUID to the Rhino doc where it lives, although of course, I have no idea how. .