Current Year DC Attribute
-
Hi All -
Does anyone know of a way to reference the current year in the DC attributes? As in, right now I want to reference 2011, the current year, DC attribute formulas, but come January 1, 2012, the reference should automatically update to 2012. I know how to do this in Excel, but could not figure it out in Sketchup. Anyone know how to do this?
Adam
-
To add extra functions to a DC you can use this
# save as 'add_funcs.rb' in Plugins require 'sketchup' # Open SketchUp's Dynamic Component Functions (V1) class. class DCFunctionsV1 protected # provide access to a Ruby method # Usage in DC =date def date(a) return Time.now.to_s end end -
Displaying the date won't work on a SU install where this plugin is not installed though, will it?
I.e. if Adam wants to share such components, should also share the plugin...
-
Exactly... there is no built-in 'date' function BUT you can make a .rb file to add any 'missing' function you want...

BUT then others also need that file in Plugins... -
Worked like a charm. Thanks, TIG!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement