How to use BBox from a geo to drive size of another geo

   3886   7   2
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Hi!

I'm making a window and I would like the side borders (sweeps) to drive the size X of the bottom sill. I don't get how to…

I tried putting a wrangle after the sweep with:

f@myBBox = relbbox(0, @P).x;

but I don't know how to use this attribute to affect the bottom sill' size X (in parallel to the wrangle…)

Any help?

-Olivier

Attachments:
window_how_to_use_bbox_on_sizeX.jpg (100.0 KB)

User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
The box node has an input. Just plug the sweep node in it and scale it back with
1/$SIZEY
.

With VEX it´s
@P.x *= getbbox_size(1).x;

Attachments:
scale_to_other_node.hipnc (233.7 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
670 posts
Joined: Sept. 2013
Offline
Also there is a node called matchsize.
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Nice! I was waiting for the website to come back online to check your answer.

I like the idea that no matter the size and position of my reference geo, it would fit the main geo on the axes that I choose. So I started with this:


vector max = getbbox_max(1);
vector min = getbbox_min(1);
vector center = getbbox_center(1);


Now that I've got all the bbox infos I need from the reference geo, how can I use them on the main geo?

Thanks for the help!

-Olivier
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
You could use python in a parameter text box ( your box geo? or transform node?)

And if I do that, I usually use a wrangle set to detail for the bbox functions. Just to set up my reference attributes e.g.

v@My_Max = getbbox_max(geoself());

Then elsewhere in the parameter textbox that will be accessing the detail created:

Desired_Vector_Component = hou.node("Wrangle_Node_With_Bboxdetail").geometry().attribValue("My_Max")[0]
Edited by BabaJ - Feb. 26, 2018 11:01:47
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Thanks Babaj!

I'm just starting to learn vex (the only coding i've ever tried!) so I'd like to avoid python if I can.

I actually found the solution! (so proud!). I get the the bbox min and max for both my ref geo and the geo I want to modify. I pass all that info into a fit function:

vector Amin = getbbox_min(0);
vector Amax = getbbox_max(0);

vector Bmin = getbbox_min(1);
vector Bmax = getbbox_max(1);

@P = fit(@P, Amin, Amax, Bmin, Bmax);


…At some point, I'll see if I can also take the rotation into acount (something about the matrix..?)

Thanks for helping me out! I really appreciate it!

-Olivier
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
Yes I prefer to avoid python myself - but at the moment it comes in very handy with some of the nodes that still only use Hscript/Python.( SideFX is working on progressively on being able to use vex in more nodes).

But to do what you want in vex, Mestela( spelling? ) has an excellent reference page. ( down the page is reference to rotations with matrix )

http://www.tokeru.com/cgwiki/index.php?title=HoudiniVex [www.tokeru.com]
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Noted. Thanks for the head's-up!

I saw that webpage before. It's very handy! Someday, I'll get further down the page!

-Olivier
  • Quick Links