[Plugin] Groups to Components

[Plugin] Groups to Components

Postby thomthom » Fri Jul 09, 2010 9:23 am

Overview
By request; bulk conversion of groups to components. The Group's name is transferred to the component's definition's name.

If anything selected, it processes only the selection, else it processes the current context.

Access
Plugins -> Groups to Components
(Supports ThomThom's Menu)

Download

1
Last edited by thomthom on Sat Jan 18, 2014 1:10 pm, edited 1 time in total.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby CadFather » Fri Jul 09, 2010 9:46 am

Thanks Thom - i take it if there are multiple instances of a group, we'll get one component definition too (a la select toys)

how about mining into nested groups?
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 10:01 am

CadFather wrote:Thanks Thom - i take it if there are multiple instances of a group, we'll get one component definition too (a la select toys)

No - it doesn't. This was quickly produced according to some specific requirement in time of a deadline. It's very basic.
But I can update it to take into account multiple group-instances.
2
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby CadFather » Fri Jul 09, 2010 10:18 am

That would be great
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 11:30 am

There is a logic issue here:
This plugin works in a selection or current context scope. Group instances can exist across this scope.
What is expected to happen to group instances outside the scope?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby TIG » Fri Jul 09, 2010 12:37 pm

You use model.definitions to get all of the group.instances [?] and then swap them out for the new component's definition, even if they are outside of the active_entities...

Just as you could if you were swapping all definition1.instances for definition2 with
definition1.instances.each{|ins|ins.definition=definition2} - which ignores 'context' :?:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 12:43 pm

That's the thing - ignore the working context or not... ?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby TIG » Fri Jul 09, 2010 1:01 pm

IF you are to replace all instances of a group with a component surely you'd [usually] should do it across the whole model.
Perhaps if there are 'other-context' instances of a group [which is easily checked by getting all instances and comparing their parents against the current context parent ?] then a simple dialog along the lines of "There are Instances of Group 'xxx' outside 'active_entities'\n Make a Component of these too ?" Yes/No - which would allow the user to choose to leave some unfixed or fix all........... :?:
0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 1:41 pm

I'm wondering if this isn't a feature fit for this plugin after all.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby mac1 » Fri Jul 09, 2010 1:43 pm

There is a plug in Make_components by Matt66 I think is the author. It will change groups to single or one overall. Is there any diff here??
0

mac1 
Top SketchUcator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 1:47 pm

mac1 wrote:There is a plug in Make_components by Matt66 I think is the author. It will change groups to single or one overall. Is there any diff here??

viewtopic.php?t=17590
Matt666 wrote:
  • Make a group of just one entity (right click or menu plugins/Make group)
  • Make a component instance of just one entity (right click or menu plugins/Make component)
  • Convert each entity in the selection in a single group (right click or menu plugins/Convert on single groups)
  • Convert each entity in the selection in a single component (right click or menu plugins/Convert on single components)
  • Convert the selected component into a group (right click or menu plugins/Make group)


I don't see any Group -> Component feature there... no?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby mac1 » Fri Jul 09, 2010 1:58 pm

I use it very often to convert single groups to components especially in models where some one has used a number of identical groups. Then you can use the component browser function of replace selected to replace all these converted groups with one component. Caution there is a quirk with the program. You also have to include in your selection a line also. viewtopic.php?f=323&t=28395
0
Last edited by mac1 on Fri Jul 09, 2010 2:03 pm, edited 1 time in total.

mac1 
Top SketchUcator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 2:02 pm

Might be partly duplicate functions - but a key feature in this script was the naming: the definition inherited the group's name, not the instance.


mac1 wrote:I use it very often to convert single groups to components especially in models where some one has used a number of identical groups.

Does SketchUp still consider them copies of each other? If you select one and open Entity Info - does it say "Group (3 in model)" ?
If so, Selection Toys can convert them into components in one operation.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby mac1 » Fri Jul 09, 2010 2:08 pm

thomthom wrote:Might be partly duplicate functions - but a key feature in this script was the naming: the definition inherited the group's name, not the instance.


mac1 wrote:I use it very often to convert single groups to components especially in models where some one has used a number of identical groups.

Does SketchUp still consider them copies of each other? If you select one and open Entity Info - does it say "Group (3 in model)" ?
If so, Selection Toys can convert them into components in one operation.


Don't remember but you can take say 50 groups and then convert them to a single component or individual components (50) If my memory is correct it did use the same name for the component as the group number but what I don't like is how it moves around in the outliner and in a large model you have to then search to find the ones converted to replace as noted above
0

mac1 
Top SketchUcator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby mac1 » Fri Jul 09, 2010 2:21 pm

Here is a good test case for you if you want to go crazy. http://www.google.com/support/forum/p/s ... e1bf&hl=en The model uses a number of identical groups and those should be reduced to a single definition
0

mac1 
Top SketchUcator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 2:23 pm

I did not see any model to download... where about in the thread is it?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby mac1 » Fri Jul 09, 2010 2:28 pm

thomthom wrote:I did not see any model to download... where about in the thread is it?

https://docs.google.com/leaf?id=0B37CGP ... h&hl=en_GB
0

mac1 
Top SketchUcator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby DIEGO-RODRIGUEZ » Fri Jul 09, 2010 2:35 pm

thom hello.
thanks for the new plugins.
a question:
what is the difference with the "Group copies> Convert Into components" of your plugins SELECTION TOY 2.0.
0

DIEGO-RODRIGUEZ 
Banned
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Fri Jul 09, 2010 2:43 pm

DIEGO-RODRIGUEZ wrote:thom hello.
thanks for the new plugins.
a question:
what is the difference with the "Group copies> Convert Into components" of your plugins SELECTION TOY 2.0.

This one converts each group instance into a component instance. (plus it transfers the name to the definition)

Selection Toys will convert all instances of a group into instances of one component definition.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby CadFather » Fri Jul 09, 2010 4:29 pm

Matts plugin is still buggy, he has been very busy and not able to update many of his scripts - on the other hand Fredo's scale tools include a group to component command, so Thom you don't really need the extra effort for this plugin - but perhaps a CTRL toggle between the wider context and not could be handy... :mrgreen:
0
Quarr-IT - SketchUp Training from the Master.. http://quarr-it.com/
User avatar
CadFather 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby JClements » Fri Jul 09, 2010 5:57 pm

Thank you, Thomas!

Might I suggest this plugin could stand as it is and another be created to deal with the issues mentioned above where there are identical instances of a group and rename this plugin "Groups to UniqueComponents" or something similar to describe what it does ... a quick and dirty conversion.
0
Last edited by JClements on Fri Jul 09, 2010 7:12 pm, edited 1 time in total.
John
Illustrator
Beaverton, Oregon
User avatar
JClements 
Premium Member
Premium Member
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby mac1 » Fri Jul 09, 2010 7:04 pm

CadFather wrote:Matts plugin is still buggy, he has been very busy and not able to update many of his scripts - on the other hand Fredo's scale tools include a group to component command, so Thom you don't really need the extra effort for this plugin - but perhaps a CTRL toggle between the wider context and not could be handy... :mrgreen:



Ref Matt's tool is Buggy but I can work around by just including a line I draw in my selection and has worked Ok for me that way
0

mac1 
Top SketchUcator
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby autarchos » Sat Jul 24, 2010 12:11 am

i'm looking for a method to simplify an xfrog tree using perhaps this plugin, or matt's, but i'm running into problems with the component axes.

the idea is:

1. make each leaf (1.5"x1" rectangles) into a component.

2. in the component window, i replace the selected unique leaf components with a single leaf component.

the glitch comes with the fact that each leaf is tilted to a different angle, but component creation scripts seem to set the axes identical to that of the world axes (see pics below). thus when i replace the selected components with one single component they all end up angled to the exact same direction. so is there a way that i can do this and maintain the orientation of each individual component? ie. can an option be included in this script to set all component axes exactly the same relative to each 'unique' component?

good if axes of each leaf is the same, maybe here:
leaf1.jpg


bad if axes of each leaf component is different relative to comp.:
leaf2.jpg


thanks!
0

autarchos 
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Sat Jul 24, 2010 2:35 am

That is a good question. I got X-Frog trees myself - have it on my todo list somewhere to find a way to optimize them.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby thomthom » Sat Jul 24, 2010 2:36 am

Maybe my component dropper plugin will work for this...?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby autarchos » Sat Jul 24, 2010 6:07 pm

thanks for the tip, thomthom. i see solo proposed the idea in your component dropper thread. i am experimenting with it on a few trees. it actually makes the workflow quite a bit faster and easier, but does not keep geometry in the exact original orientation.

thus, i'm creating components of each leaf (painfully slow), using component dropper to make them all the same (instantaneous, even for thousands of leaves), and then using chris fullmer's scale and rotate multiple to give them a little bit of randomness. i'll show you a tree with some stats when finished - it's slow, but i think will yield a more natural chaotic result than the original trees - xfrog tends to be too fractal and perfect in my opinion.

a note however, your 'groups to components' works almost instantly, whereas the same function with matts plugin took several minutes. perhaps at some point this script could be updated to work on non-group entities as matts does, but with more efficiency.
0

autarchos 
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby publied » Mon Jul 26, 2010 1:11 pm

very interesting Thom,
now i'm trying it!
0

publied 
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby halroach » Mon Sep 23, 2013 2:22 pm

Hi,

Sometimes when I'm using this plugin it only converts one selected group to one component leaving all the rest as groups. Not sure what's causing that. ideas?
0
User avatar
halroach 
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby halroach » Mon Sep 23, 2013 2:24 pm

halroach wrote:Hi,

Sometimes when I'm using this plugin it only converts one selected group to one component leaving all the rest as groups. Not sure what's causing that. ideas?


I copied and pasted all the groups to another sketchup model (outside of the one component they were in, and they were all converted. could it be this plugin doesn't work within a component?
0
User avatar
halroach 
 

Re: [Plugin] Groups to Components (1.0.0) — 09 July 2010

Postby tt_su » Mon Sep 23, 2013 10:42 pm

Do you have a sample scenario/model where I can reproduce this?
0
User avatar
tt_su 
SketchUp Team
SketchUp Team
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 

Next


 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 5 guests

Visit our sponsors: