5
$\begingroup$

How can I get the length of an edge of an object using it's index and snap them together using GN.

Example:

My goal is to have:

  1. Geometry Nodes generate a smaller box with the same height as another objects edge length, which is acquired from the objects edge index (in the yellow color located at index 4)
  2. Have their vertices snap together. See image below.

img1

But I'm having trouble with getting the edge length correct. I tried 2 different ways see image below.

img2

And

img 3

$\endgroup$

2 Answers 2

5
$\begingroup$

This one works by capturing your target solid's edge-vectors, edge-lengths, and edge-normals, before converting its edges to points, and instancing a unit-cube on the points.

the unit cube is offset by .5 in X and Y, before instancing, so one of its vertical edges is on its origin.

The captured attributes are then used to scale and orient the cube.

enter image description here

You can select the target edge in the modifier interface, and adjust the spin of the cube around it:

enter image description here

$\endgroup$
3
$\begingroup$

you can do it with this node setup:

enter image description here

result:

enter image description here

Important node is here the transfer attribute node so that the position is from the group input node (the "original cube").

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.