• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

How to set Layer property of a Group?

Scheduled Pinned Locked Moved Developers' Forum
7 Posts 4 Posters 490 Views
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.
  • G Offline
    GrojGuy
    last edited by 29 Sept 2010, 20:22

    I'm really sorry to post such a seemingly-simple question, but I'm at a loss where to discover the answer, after significant searching.

    In Ruby, how does one assign the Layer property of a Group? (there is no Group.layer= method)

    Thanks...

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 29 Sept 2010, 20:40

      Notice that in the API docs, above the list of methods for each class it says "Parent:". And for Group it says:

      @unknownuser said:

      Parent: Drawingelement

      And the Drawingelement class has a layer property.

      Have a look at the Objects Diagram for an overview of the classes' relationships:
      http://code.google.com/apis/sketchup/docs/diagram.html

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

      1 Reply Last reply Reply Quote 0
      • G Offline
        GrojGuy
        last edited by 29 Sept 2010, 21:31

        Thank you. I had seen that, but was thrown off a little the "Introduction" for "Drawingelement" which states...

        @unknownuser said:

        ...These items include edges, contruction points, construction lines, and images...

        No mention of "groups" (which did seem contradictory to the Objects Diagram). But now I see I need to get more familiar with the API Object structure.

        1 Reply Last reply Reply Quote 0
        • D Offline
          Dan Rathbun
          last edited by 30 Sept 2010, 06:21

          What Thomas left unsaid, is that a subclass inherits methods from it's superclass.

          At the Ruby console, type:
          Sketchup::Group.instance_methods.sort
          .. and you'll see that the group class has inherited a layer= method.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • G Offline
            GrojGuy
            last edited by 30 Sept 2010, 20:16

            Ah yes, OK, that would make sense, i.e. class inheretance. But, from your comment I was anticipating seeing "layer=" in the instance methods list returned by that nifty command...

            Sketchup;;Group.instance_methods.sort
            (eval);64; warning; instance_methods; parameter will default to 'true' as of 1.8.1
            ["add_observer", "copy", "createObservers", "definition", "description", "description=", "entities", "explode", "local_bounds", "locked=", "locked?", "make_unique", "move!", "name", "name=", "remove_observer", "to_component", "transform!", "transformation", "transformation="]
            

            So, why is "layer=" it not in the list?

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 30 Sept 2010, 20:45

              There are several methods that apply to certain classes that aren't listed as they are 'subsidiary'.
              These include
              group.layer= instance.layer= group.material= instance.material= group.erase! group.hidden=
              The list is in http://code.google.com/apis/sketchup/docs/ourdoc/drawingelement.html
              for 'drawingelements' - which applies to these kind of things too...
              If in doubt try them... you can but fail...

              TIG

              1 Reply Last reply Reply Quote 0
              • D Offline
                Dan Rathbun
                last edited by 1 Oct 2010, 06:14

                @grojguy said:

                Ah yes, OK, that would make sense, i.e. class inheretance. But, from your comment I was anticipating seeing "layer=" in the instance methods list returned by that nifty command...
                So, why is "layer=" it not in the list?

                Because.. you see the warning for the "show inherited" argument is default false for your version of Ruby, but will (actually was,) changed to true as a default, in all Ruby versions 1.8.1 and higher.

                IF you are still using Sketchup 7.x, then the Ruby DLL distro'd is v1.8.0-initial_release (ie: patch_level p0)

                You can backup the current "Deceased 1.8.0" dll, msvcrt-ruby18.dll by renaming it: msvcrt-ruby180_p0.dll
                then replace it with your choice of a newer version from: Ruby Interpreter DLLs (Win32) (you will need to make a copy of the version you want Sketchup to load named: msvcrt-ruby18.dll.)
                .

                I'm not here much anymore.

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

                Advertisement