sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Code] New Material methods

    Scheduled Pinned Locked Moved Developers' Forum
    13 Posts 3 Posters 2.9k 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      This update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701 has been out for a week or two with other SKMtools tweaks - it now only makes the method if it doesn't exist - e.g material.name='xxx' is now include in the latest v8...

      TIG

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

        Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701
        Material.class extensions - aliases added for save_thumbnail()==.write_thumbnail() and .delete==.remove. The .name='' and .delete methods now match SUp >=v8 returned values.

        TIG

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          SU8M1 didn't add Material.remove, it added it to Materials.

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

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

            @thomthom said:

            SU8M1 didn't add Material.remove, it added it to Materials.

            But v8 did... [quietly!]

            TIG

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

              Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701
              Material.class extensions - aliases added for save_thumbnail()==.write_thumbnail() and .delete==.remove. The .name='' and .delete methods now match SUp >=v8 returned values.
              'Aliases' slightly recast to leave original new methods unaffected if used...

              TIG

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                @tig said:

                @thomthom said:

                SU8M1 didn't add Material.remove, it added it to Materials.

                But v8 did... [quietly!]

                ? And it was removed? Because it does not exist at all in M1.

                (Sketchup::Material.instance_methods-Object.methods).sort ["add_observer", "alpha", "alpha=", "attribute_dictionaries", "attribute_dictionary", "between?", "color", "color=", "delete_attribute", "deleted?", "display_name", "entityID", "get_attribute", "materialType", "model", "name=", "parent", "remove_observer", "set_attribute", "texture", "texture=", "typename", "use_alpha?", "valid?", "write_thumbnail"]

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

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

                  @thomthom said:

                  @tig said:

                  @thomthom said:

                  SU8M1 didn't add Material.remove, it added it to Materials.

                  But v8 did... [quietly!]

                  ? And it was removed? Because it does not exist at all in M1.

                  (Sketchup::Material.instance_methods-Object.methods).sort ["add_observer", "alpha", "alpha=", "attribute_dictionaries", "attribute_dictionary", "between?", "color", "color=", "delete_attribute", "deleted?", "display_name", "entityID", "get_attribute", "materialType", "model", "name=", "parent", "remove_observer", "set_attribute", "texture", "texture=", "typename", "use_alpha?", "valid?", "write_thumbnail"]

                  BUT it IS listed in the API docs http://code.google.com/apis/sketchup/docs/ourdoc/material.html#remove
                  ANYWAY... when they ever sort out their mess and if you have my SKMtools loading their '.remove' will get used in preference to mine!

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    The release notes and the API docs are incorrect. It was added after this M1 release. I've notified them about the incorrect docs.

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

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      @thomthom said:

                      The release notes and the API docs are incorrect. It was added after this M1 release. I've notified them about the incorrect docs.

                      I also made note, in a post to your "New Material methods! Thank you!" beta forum topic.

                      Also I think the v7.0 M1 build numbers are actually the M0 numbers.

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        As we noted in the other topic Re: New Material Methods!, a method that acts immediately upon the receiver should (by Ruby convention,) use a **!** on the end of the method name.

                        I would think in most cases such a method, if it's a dispose method, just calls the parent collection's element disposal method with self as the argument.

                        It's is kind of weird for code that is executing within the scope of an instance, to be destroying that very instance at the same time. In other words, the disposal call is made within the block of an instance method; and after the call is made, Ruby needs to return to the next statement after the call (still within the instance method,) but if the instance no longer exists, where does Ruby return to?

                        It's kind of the old "chicken and egg" scenario. But apparently Ruby can handle this without choking.

                        There are cases, as ThomThom pointed out, that it's easier to call a disposal method on the instance, rather then have to get a handle on the instances' collection object to call for the disposal.

                        I'm not here much anymore.

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

                          Here's an update http://forums.sketchucation.com/viewtopic.php?p=293701#p293701
                          The MAC jar execution issues have been addressed.

                          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