Is there a way to pull Document User Text from the active file into Grasshopper? Alternatively, is there a way to write from Grasshopper into the active file?
I’m trying to set up a parametric design of a simple display case as a challenge, so that everything is done by Grasshopper parameters. Length, width, height, material, etc. I’d also like to automate all the drafting/annotation, so that all I have to do is specify the parameters, and the job is basically done.
One thing in our workflow is that I’ve used Document User Text for things like project name, project number, item number, etc, so that they only have to be set once across multiple layouts. Our title blocks automatically pull from the user text.
I can pull item user text in with something like Elefront; but is there a way to do it with the overarching Document text?
I know this is a year later but in Rhino 8 WIP you can access the document user text via this method:
Rhino>Content>Text Field Expression>Evaluate Text Field
Right click on the Text Field Expression node and select “Document User Text” and then provide a Key input and retrieve the resulting values from that pairing.
Thanks this was helpful for me! Do you know if there any way to also set document user text either from grasshopper or using macros like how we have SetUserText for objects?
Here’s an updated script that adds a python component to also get should you need it…
Probably better way to write this in code but I don’t claim to be an expert in that… haha
Also you could subscribe to the document properties event change so that these could get refreshed dynamically if needed.
I added a feature to the get:
if you provide an asterik as the Key value it will return all Document User Text Values, otherwise it will return values for the keys you provide to the input.
Rhino 8 does this automatically using the Rhino tab in grasshopper.
Using the write block as 3dm component. The user data on the block definition will be written as document data. And on import that document data will be brought back in as user data on the definition.
Do you have a sample model that shows what the goal is? I can put something together tomorrow to show how it works.
Oh wow didn’t think of this approach to setting document text. Thanks for this, helps me understand blocks, 3dm files and what document text exactly is a bit more clearly!
What I needed was essentially a macro/grasshopper script that sets document text without needing to open the Document Text Panel (exactly how the command SetUserText works for objects). I am currently making some aliases using macros and grasshopper player to create some complex form-based commands. In order to make these aliases suited for various contexts, I am using the document text to check for certain key-value pairs, and then make the alias behave a bit differently based on the context of what the user wants to do. @michaelvollrath 's python script helps me achieve this by setting the Document Text algorithmically without having to open the panel each time the user starts a new rhino file.