Grasshopper

algorithmic modeling for Rhino

If a user specifies a template file, the author info for any new document they create is replaced with the author info from whoever authored the template, rather than derived from their own author info in preferences. Tried to write a script in the template to resolve but can't modify GrasshopperDocument.Author.Name. Thoughts about a workaround?

Views: 719

Replies to This Discussion

Hey Andrew you can modify Grasshopper.CentralSettings.AuthorName instead.

My approach to stuff like this is to include a user modifiable Python script component within the standard template that can be used to read certain data from the document while allowing users to write other data, such as author name and definition description. It looks something like this:


import Grasshopper as gh
import Grasshopper.CentralSettings as settings

if run: #query function and return values

#data referenced from document
version = gh.Versioning.Version
fileName = ghdoc.Name
filePath = ghdoc.Path
dateCreated = ghenv.Component.OnPingDocument().Properties.Date


#data written to document
settings.AuthorName = createdBy
ghenv.Component.OnPingDocument().Properties.Description = description


I'd definitely be interested in hearing about other approaches, or if this one is limiting in a way that I'm not realizing.

B

If I'm understanding correctly, the problem here is that Grasshopper.CentralSettings.AuthorName is already set correctly - but when the user opens the template file, it still registers as having been authored by the person who made the template. Does your solution get around that some way I'm not understanding?

I see. No it's not a persistent solution. The user opens the template which always says my name or something generic like "Woods Bagot" and then they have to enter their own name into a designated panel. The panel data is an input into the above Python script which overwrites the author field for that particular file from that point on.

However, this doesn't solve what I think you're getting at, which is that the template file would always come in overwritten with the local users name, as opposed to something that has to be done individually per document.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service