sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Current Year DC Attribute

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    5 Posts 3 Posters 194 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      hocha
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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
        

        TIG

        1 Reply Last reply Reply Quote 0
        • GaieusG Offline
          Gaieus
          last edited by

          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...

          Gai...

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            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...

            TIG

            1 Reply Last reply Reply Quote 0
            • H Offline
              hocha
              last edited by

              Worked like a charm. Thanks, TIG!

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement