Page 1 of 2

Nested components, groups and instancing

PostPosted: Sat Feb 09, 2013 11:49 am
by smicha
TIG,

When I use the plugin for exporting components data into scatter data I encounter a problem when components are grouped. Namely, I have a component copied 10 times. Then a group is created. The groups is copied twice. A single copy of a component is created at the project origin. I run the plugin. The data that are exported are for 10 components only (from the first group) and they are all displaced (because - I suspect - the exported obj is at 0,0,0).

So my question to you is - is it possible to export the data for components that are in all groups without a need to explode them. This is so important to me. If this problem is solvable we can create nested components and use connected consecutive scatter nodes for multiplying instances.

Kind regards,

Sebastian

Re: Nested components, groups and instancing

PostPosted: Sat Feb 09, 2013 1:40 pm
by TIG
I'm not sure...
The related thread was driven by smicha...
I think you still need to place an instance of the 'collection' to get a 'zeroed' version.
Can you not make a component of the sub-parts and use that ?

Re: Nested components, groups and instancing

PostPosted: Sat Feb 09, 2013 3:54 pm
by smicha
TIG wrote:I'm not sure...
The related thread was driven by smicha...
I think you still need to place an instance of the 'collection' to get a 'zeroed' version.
Can you not make a component of the sub-parts and use that ?


Smicha - that's me :) I've started new thread to improve the plugin.

If I make a components of sub-parts it is still displaced by the distance from origin. The problem of setting the component exes to origin goes back.

Re: Nested components, groups and instancing

PostPosted: Sat Feb 09, 2013 4:02 pm
by smicha
TIG,

My idea is to add some code that would do the following:

1. User selects a component.
2. Plugin creates an auxiliary copy of entire project.
3. It deletes everything apart from the component and its copies.
4. It exports data for a scatter node.
5. It deletes the auxiliary file.

This way of thinking does not allow to use nested components but it allows exporting all of the copies of the components into scatter data. Is it possible to code it?

Re: Nested components, groups and instancing

PostPosted: Sun Feb 10, 2013 4:46 pm
by TIG
The first steps are easily done by hand.
And perhaps with the assistance of a simple tool like my 'InvertSelection'...

Copy the SKP.
Open the Component Browser.
Find the Component in the Model-tab and use context menu 'Select All Instances'.
Now use 'InvertSelection' and press Delete.
Only the Instances remain.
Do the Export as OBJ.
Only visible objects get Exported so anything that's on an off layer or hidden will be ignored.
Erase all Instances.
Place an Instance at the origin.
Export another OBJ for the one.
Now you have what you want ?

Re: Nested components, groups and instancing

PostPosted: Sun Feb 10, 2013 4:52 pm
by smicha
Yes TIG. That's the way I do it manually.

Now I am experimenting with nested components, and still have a problem with additional displacement when I export (scatter data) a component inside a group or a inside another component. If you find some time to play with the file I previously uploaded I could come up with a solution to the problem I'd be grateful.

Re: Nested components, groups and instancing

PostPosted: Sun Feb 10, 2013 8:56 pm
by smicha
TIG,

Is there a ruby code/function that sets component axes or group axes to 0,0,0 (to the same origin as entire project origin)?

Re: Nested components, groups and instancing

PostPosted: Sun Feb 10, 2013 11:01 pm
by TIG
It you have nested collections you must 'combine' their transformations [perhaps using .inverse at the end ?]
tr = (group.transformation * subgroup.transformation).inverse

Re: Nested components, groups and instancing

PostPosted: Mon Feb 18, 2013 1:34 pm
by smicha
TUTORIAL - nested components and instancing.

Download the tutorial and the plugin (the plugin was written by TIG, I added some changes to rotation matrix. TIG - thank you so much again).

Re: Nested components, groups and instancing

PostPosted: Sat Mar 09, 2013 4:35 pm
by FractalBuddha
Thank you Smicha :)