Making a group out of everything in a component definition

Making a group out of everything in a component definition

Postby Al Hart » Sat May 03, 2008 8:45 pm

We wanted to take all the exiting geometry in a component definition, and put it in a group within the same component definition, so that we could put the new group in a layer, which made it easy to turn off a layer to hide all of the existing geometry. (This was part of our project to convert hi-poly components so that they could be displayed as lo-poly proxies just by turning layers on and off)

We came up this this logic:
(I thought I would share this here in case anyone ever need to perform a similar task)

1. Make a new dummy component instance with the same definition as the original component

2. Make the dummy component instance unique. (It now has a cloned copy of the geometry in the original component definition)

3. Erase the geometry from the definition of the original component.

4. Add a group to the original component definition and give it the layer desired.

5. Place an instance of the dummy component into the group in the original component.

6. Explode the instance, in the group in the original component definition.

- (You can also add additional information to the original component - such as the low-poly geometry.)

7. Erase the dummy component instance and the dummy component definition.
(I was not able to figure out how to remove a component instance - I used purge_unused instead)

---

Here is a sample ruby script which does this:

lo_poly.rb


This seems to work well, but is rather complicated.

Is there some easy way to do this that I am missing?
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Making a group out of everything in a component definition

Postby sorgesu » Sat May 03, 2008 11:57 pm

1. Edit the component.
2. Select all of the geometry of the component and "copy" which will copy it all to the clipboard.
3. Create one simple segment, still within the component, and Make a group out of it. ( I don't believe that the "right click" works to get the "make group" option when you only have a single segment so you will need to use the "make group" option under the edit menu or, if you have one, a keyboard shortcut".
4. Edit the group.
5. Erase the segment that you didn't need anyway, and choose "paste in place" from the edit menu. This will place the geomtry in the clipboard inside the group.
6. Close the group and associate the group with whatever layer you want.
7. Do whatever you need to do with the component geometry outside the group and inside the component.
0
Susan Sorger
Former Seller Hand Rendered Entourage
Former Canadian Authorized Training Centre, SketchUp

sorgesu 
 

Re: Making a group out of everything in a component definition

Postby Al Hart » Sun May 04, 2008 3:54 am

sorgesu wrote:1. Edit the component.
2. Select all of the geometry of the component and "copy" which will copy it all to the clipboard.


I;m not sure how to emulate "Edit Component" from a ruby script.

Ditto, for copy and paste.
0
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Making a group out of everything in a component definition

Postby sorgesu » Sun May 04, 2008 4:52 am

can't help there. I have no clue how to do a ruby.

I know for a fact that edit component is possible since I own a ruby that does that.
I have posted it once before. It is called cleanimage.rb and it edits a component and hides all the lines.

I have uploaded it here
Perhaps you can deconstruct the ruby to see the way to "edit component". I have nothing that does a "paste in place" that I am know of, but I'm sure one of the guys here who do ruby scripts can be of help.
0
Susan Sorger
Former Seller Hand Rendered Entourage
Former Canadian Authorized Training Centre, SketchUp

sorgesu 
 

Re: Making a group out of everything in a component definition

Postby Al Hart » Sun May 04, 2008 5:05 am

I appreciate your trying to help, Susan, but I put this query in the ruby forum because I was soliciting help from other ruby programmers on how best to do this task.

It is easy in SketchUp itself, as you point out, although probably even easier than you suggest because you can probably:

1. Open the component for edit
2. Select all the geometry in the component
3. Right click and select Make group

and you have the group.

My problem is that this is much more difficult in Ruby, unless there is a ruby command for #1 and #3 (there is a one line command for #2)

Again, though, thanks for offering your help.
0
Last edited by Al Hart on Sun May 04, 2008 6:26 am, edited 2 times in total.
Al Hart
IRender nXt from Render Plus
User avatar
Al Hart 
PluginStore Author
PluginStore Author
 

Re: Making a group out of everything in a component definition

Postby sorgesu » Sun May 04, 2008 5:09 am

Sorry Al. I didn't even notice that it was in the Ruby forum since I always view "active topices".
I also thought you wanted both the "group" as well as the component. Sorry about that. I'll leave the ruby queries to the ruby experts and I'll make sure to check which forum the question comes from.
0
Susan Sorger
Former Seller Hand Rendered Entourage
Former Canadian Authorized Training Centre, SketchUp

sorgesu 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 9 guests