How to set Layer property of a Group?
-
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...
-
Notice that in the API docs, above the list of methods for each class it says "Parent:". And for
Groupit says:@unknownuser said:
Parent: Drawingelement
And the
Drawingelementclass has alayerproperty.Have a look at the Objects Diagram for an overview of the classes' relationships:
http://code.google.com/apis/sketchup/docs/diagram.html -
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.
-
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. -
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? -
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... -
@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.)
.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement