Group by Layer
-
Bloody autocorrect.
-
@rich o brien said:
Just locking his poor spelling before he edits
You write a thousand eloquent posts, do they call you box the eloquent...
You shag one sheep! -
-
@rich o brien said:
If you right click the tag/layer in tag/layer panel and choose...
...then group that selection
That's pretty cool, I was using selection toys.
However, too many right-clicks, I think I would rather keep things unorganized.
-
I'm pretty sure TIG wrote a snippet for this at one point. I'll try find it
-
You're too cool! Thanks!
-
Or set this...
...then click the chevron to expose details...
...then install and test if TIG's description suggests it may do what you need.
-
I knew he posted a snippet once...
https://sketchucation.com/forums/viewtopic.php?p=427644#p427644
...fails in 2022 though. Maybe he'll see this thread and chime in.
-
I think the objective of that one is to have edges and faces sent to layer0. That is aimed at fixing most errors caused by having raw geometry in that layer.
In my case I really don't want to loose the layer of raw geometry unless it becomes grouped by layer first and the group is given that same layer.
So, what I want to do is exactly what you showed on your image: go through each layer, select objects and group them; if possible change the group from Layer0 into the selected layer; and then I can send all raw geometry into Layer0 as it has already been grouped and the group is in the correct layer.
I'm going to read better what each of those Layer plugins does.
@Box, just replace each of the "layer" above by "tag" and you get the point.
@Rich, I was replying to your previous post. I will see what you posted now.
-
@rich o brien said:
I knew he posted a snippet once...
https://sketchucation.com/forums/viewtopic.php?p=427644#p427644
...fails in 2022 though. Maybe he'll see this thread and chime in.
The description he has in the snippet post is exactly what I need.
Bummer!
It would be very cool if he would chime in indeed.
-
I was wrong. It does work...
m=Sketchup.active_model;a=m.active_entities;s=[];m.start_operation("!");a.to_a.each{|e|s<<e if e.layer==m.layers[0]};g=a.add_group(s);g.name=m.layers[0].name;g.layer=nil;(g.entities.each{|i|i.layer=nil})unless s.empty?;m.layers.to_a[1..-1].each{|l|s=[];a.to_a.each{|e|s<<e if e.layer==l};next if s.empty?;g=a.add_group(s);g.name=l.name;g.layer=l;g.entities.each{|i|i.layer=nil};};m.commit_operation;
You need to have a group selected that is on Layer0 it then iterates through the model groups things to layer
-
It must be a group? I will try it then. Just paste this in the console, right?
-
It seems so. I'm not 100% on what needs to be selected but it seems to rename the selected group and then do some magic.
Try on sample first
-
Too late, I've tried it in the model directly and it's taking a lot of time. I don't know if I should just shut it down, try it in a sample, and then leave it on the whole night. It might finish right now, or it might take a week... who knows?
-
So I made a simple model and tested the snippet without selecting anything. It works flawlessly.
I don't think it iterates inside groups. Only tried on loose geometry, but I'm going to try That.
EDIT: What it does seems to be doing is grouping all groups in the model into a new group called Layer0. It doesn't act inside those groups. This is cool and a way to control the scope.
Geometry to be affected by the snippet should be in root of the model.
EDIT2: Groups that are tagged already, get their objects inside grouped and stripped from tags. This happens even if they have no tags. All other groups are grouped together in a group called Layer0
Advertisement