Transforming all branch objects using the same plane?

I’m having hard time with trees in GH - i want to orient several objects at once and i’m fighting with it for 30 min without desired result.

I have sth like this:

I want place breps from each branch using each plane corresponding to branch. But it doesnt work it places only once one of them ( from 1;1) and then only second from the same branch is considered. It turns out that trees are far away from programming launguages collectitons concept :sweat_smile:

Anyone?

You can use Group and Ungroup.(Transform–>Util–>Group)
Or you can duplicate your plane based on the list length of your geometries per branch using Duplicate Data.

Umm i guess thats not the most universal solution ? I want to allow user to put in many objects so list of object could look like this:

and each branch acordingly will have own plane

Post your data.

Here it is :slight_smile: BranchTransform.gh (33.8 KB)

Have in mind that lenght of branch 1.x may vary and count of objects in each of it also.

It seems the problem is your target planes.
They are randomly distributed and have larger numbers per branch than your objects.
Do you want data matching? what exactly are you after?


For example, Data matching like this…

BranchTransform_re.gh (43.5 KB)

No i want it exactly how it is :smiley: Look when you put object to orient and give 50 target planes it will transform there 50 times thats exactly behavior i want. But i want to transform all of the object in relation to branch from single plane to other planes. Thats silly that achieveing this is so hard (for me :sweat_smile:) in GH it is basicaly like that:

foreach ( branch in branches )
{
    foreach (obj in branch)
    {
        for(every target plane in this branch)
        {
             Orient (obj from this branch plane to i++ target plane of this branch)
        }
    }
} 

But it seems that my logic fails in construction of trees in GH :sweat_smile:


BranchTransform_reV2.gh (47.1 KB)s
Or this.

BranchTransform_reV3.gh (50.7 KB)

Really appreciate your help and it is bit closer but look that those breps are on one branch but put around separately - those should be like branch == group and put each group on from branch plane to target branch planes - don’t know if that makes sense to you.

Basicaly what i do and why this is in branches i use c# to retrieve block as a whole then operate on those to see whats going on and finaly compound xforms to bake blocks according to made xforms.

Yep i guess v3 will do the work however data duplication gives me tons of unecessery xforms but ill try to reverse it later or just do separate operation to get not displayed data.

My bad. In this case, no need Duplicate Data or Repeat Data.


BranchTransform_reV4.gh (47.3 KB)

2 Likes

And thats it ? :smiley: Thank you @HS_Kim very much for your time!

I tried earlier but i used wrong group component :sweat_smile:

Theres still lots to do but proof of concept seems to be working :slight_smile:

1 Like

Using Group as @HS_Kim did is the correct solution but there is a different approach in this case. Not the same thing but instead of Group you can use SUnion, which gives the same result by appearance, though the pieces of each “building” are fused. Much quicker to do the SUnion before Orient than after!

BranchTransform_2019Jun15a.gh (44.9 KB)

Hmm not really … I aim for wide range of GeometryBase while SUnion is bound to Brep which is not valid when we would have derivative type of Mesh which very likely can be part of InstanceDefinition for eg. However thanks for contribution in topic :wink: