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!
Advertisement