• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

[Code] material.name= v1.2

Scheduled Pinned Locked Moved Developers' Forum
8 Posts 4 Posters 2.1k Views 4 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.
  • T Offline
    TIG Moderator
    last edited by TIG 24 Jun 2009, 13:35

    material-name=.rb adds a new Method to Sketchup's Material Class-
    material.name="new_name"
    it makes a cloned new-material from the original-material
    and gives it the 'new_name',
    if the name 'new_name' exists then it's made unique with a #N suffix,
    it gives the new-material to any entities that had the original-material,
    the original-material is deleted from the model and material-browser:
    if the current-material in the browser was the original-material then
    the current-material in the browser becomes the new_material...
    Edit:
    v1.1 Temp folder fixed for Mac users.
    v1.2 Attribute Dictionaries copied over.
    v1.3 Error with attrdict==nil fixed.
    material-name=.rb

    TIG

    1 Reply Last reply Reply Quote 0
    • R Offline
      RickW
      last edited by 24 Jun 2009, 14:19

      Sounds like a candidate for SKX

      RickW
      [www.smustard.com](http://www.smustard.com)

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 24 Jun 2009, 14:22

        Yup.
        Though recently I've begun to ponder about forwards compatibility. What if Google later implements the methods we add or fixes? http://forums.sketchucation.com/viewtopic.php?f=315&t=20113

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • A Offline
          AdamB
          last edited by 24 Jun 2009, 19:43

          Yeah, its a tricky one because you can check with respond_to? if it already exists but the semantics of the new method might be completely different.

          I think extending the SU classes is a theological gray area / no-no.. as opposed to specialization through class derivation.

          But I've done it a few times over the years. Most recently when I really want to be able to treat Selection just like a Model, so I added a bunch of methods that simply kick the message to Selection to self.model. It just made the rest of my code so much cleaner not having to constantly check what its dealing with.

          Adam

          Developer of LightUp Click for website

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 24 Jun 2009, 19:56

            @adamb said:

            Yeah, its a tricky one because you can check with respond_to? if it already exists but the semantics of the new method might be completely different.

            I think extending the SU classes is a theological gray area / no-no.. as opposed to specialization through class derivation.

            Yea, it'd be nice to hear from Scott or any of the other Google-heads on this. He seemed positive to the Skx project, but I don't think anyone has mentioned this topic.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 26 Jun 2009, 09:06

              Here's v1.1 http://forums.sketchucation.com/viewtopic.php?p=167219#p167219
              The Temp folder is now fixed to suit Mac users too...

              TIG

              1 Reply Last reply Reply Quote 0
              • T Offline
                TIG Moderator
                last edited by 19 Aug 2009, 19:27

                Here's v1.2 http://forums.sketchucation.com/viewtopic.php?p=167219#p167219
                Any Attribute Dictionaries now copied to renamed material...

                TIG

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 21 Aug 2009, 08:33

                  Here's v1.3 - with error on attrdicts==nil fixed...
                  http://forums.sketchucation.com/viewtopic.php?p=167219#p167219

                  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