move specific points of a grid

Hello all,

I am trying to build an hexagonal tiles grid (see attachement). I don’t really know the best way to achieve that.

First thing that come into y ming would be to use a base shape like a circle SOP with 6 divisions and spread it on a grid using instances.

Little detail here is : how can i offset every second grid line on the x axis ?

thanks

1 Like

3 ideas inside…
hex grids.tox (2.46 KB)

A group SOP will let you collect points on every other line, which you can then offset with a transform SOP.
base_offset_grid.tox (750 Bytes)

Wow, there are lot of things to learn in those examples ! thanks a lot !

Matthews’ approach seems more obvious to me though, closer to my logical way of thinking :wink: but both are really helpful

Matthew, can you explain how you defined the group pattern, i am not sure to understand how it works ?

hex gridsDeleteorModel.tox (8.93 KB)

This one had 3 more examples, is expanded on one of my others examples, just pull the slider to add or remove rows for the automated one.

1 Like

hey bwanajh - I think Ben has mentioned this before but I applying materials on a geo rather than with a material SOP is actually a more efficient approach in Touch. Small detail, but those can add up over time. :slight_smile:

gallo - the operation is by pattern:

derivative.ca/wiki099/index. … =Group_SOP

Using a group SOP allows you to move a subset of your original. Here the pattern approach is based on points. From 0 to 7480 grab every other point. That looks like the following in the parameter field:

0-7480:2

Why 7480? I pulled this example out of another network where I have a mesh doing almost the same exact thing, and the total number of points there was 7480. For this case you need a number equal to or greater than your total number of grid points.

The first transform SOP rotates the whole geometry 90 degrees (this puts the geometry in the right orientation for the desired pattern), the second transform TOP offsets only group1 by 0.54 units completing the patterning template for instancing.

1 Like

Ok thanks !

It seems grouping points with this pattern only works for certain number or rows though (which makes sense)

Is there a more “universal” way of doing it ?

I was trying to export the grid SOP into DAT and manipulate the values (positions) via a script but the only tests i did throws me errors saying table values are not editable. Well i am not skilled enough for now i imagine.

I am also looking at solutions based on select DAT with expression and evaluate DAT to modify some values and then merge them back to the initial table.

Using code i know i would select points with something based on modulo the number of grid columns or something similar…

Well i have some ideas, but i am unable to figure out how to transcript them into TD network

Or maybe my way ok thinking is a bit biased by the code way of doing things and i should probably think more the node based approach

thanks a lot for this example. My first idea was to use instancing but i am glad to learn another way of doing it !

Can you say a little more about what you mean here?

The contents of a SOP to DAT aren’t editable because the contents of that table are defined by the source SOP. The step you’re missing here is to make a copy of those data points into an empty table DAT - here you’re able to manipulate the contents of the table.

base_copy_a_dat.tox (782 Bytes)

Another alternative would be use a script SOP, which allows you to iterate over the points in a SOP. Op Snippets, available from the help menu has some examples of how the Script SOP works, and might be closer to what you’re looking for.

1 Like

I mean unless number of rows are odd, grouped points are not inline.
I can live with that, but for my personal knowledge i wonder how to tell “group rows 1, 3, 5 etc…” instead of “group every other point” but i think it would involve a chunk of code to achieve that unless this is doable with some OPs i am no aware of.

Thanks for the example tox. That makes sense. So can’t i convert the sopto DAT into a table and edit this one ? The purpose would be to modify the X position of every other point and convert it back to a SOP

I see… the group SOP is agnostic about the input geometry, so while rows might make for a logical pattern with a grid mesh it might be strange with polygons or nurbs on irregular objects. Knowing the number of rows and columns from the input SOP you could figure out what row you were in though - with a bit of modus work. Which is to say that I think you’d be better served using a script SOP and python.

That’s the idea - copy the converted data into a new table, and then edit the contents. You can convert back into a SOP with an Add SOP (I think there’s an example in Op Snippets). All that said, the script SOP would save you the headache of converting to a DAT and then back to a SOP.

ok i’ll try the script way !

Can the sopto content copy be done on the fly ? (i.e. when grid size changes)

a script op will re-cook if the input changes - the other round about way wouldn’t update automatically.