Iso/Trim SubSurf Domain in Real Measurements


I am just brushing up on Grasshopper. Basically, I want to subdivide a surface, and then work my way inward to make various things, like often building windows and whatnot are made, BUT, the trick of it is: I want to be able to measure in by real world dimensions.

Say, I want it to be say, 2mm or 2 meters in from the edge–instead of doing trial and error trying to using a domain multiplied by various values, using 0 to 1.

For a lack of a better way, I have been using and moving vertexes along vectors to accomplish a similar thing, which seems silly. In a way, I want to zero it, and Remap it, in real-world units.

So, another words, if the top surface is 50x200, I want to be able to measure in 5mm from the top and bottom, and then 15mm from each side. So, the result is Reparameterized from 0 to 170 for x, and 0 to 190 for y.

What is the best or at least an easy way to do this?

This is the problem example. I solved it, but it was pretty complicated. What I wanted to do was to reference the top surface, and then using a border that was measured from the sides 5mm in from the top and bottom, and then I wanted to leave a 12mm gap from the bottom. All of this was done with vextexes, some dispatch, and some deconstructing vertexes and then modifying the values, and reconstructing them to make surface planes.
(The surfaces are lifted a bit so you can see them.)

If Reparameteized Domains can only take from 0 to 1, I had idea…

I often mess with Arduinos, and they use have a map statement which, is a simple one-liner, which scales variables. It would seem that a remapped domain thing could be made in such a fashion, for scaled variables. In other words, a function could be made to map the real world units–back into the Reparamatized domain. Something like that. Though, the actual size of the Domain would need to be measured to plug in the values.

[The small bit of code is there, it’s so handy, I have both integer versions for speed, and floating point versions for more accuracy, well, on the Teensy 4,1, anyway. LOL!]

Please ignore the original code.

long map(long x, long in_min, long in_max, long out_min, long out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

[The components solution I used solve for 5mm in from top and bottom, 15mm in from sides, 12mm for the bar between rectangle surfaces–and however many surfaces I want, but it’s inelegant, to state the least.]

1 Like

Have you seen the Remap Numbers component?


1 Like

Thank you, @kev.r

Can it remap a ordinary real input number such as: 125.7
…To a domain number from: 0 to 1?

The example given here is backwards from what I want to do, but it would seem that it might work for Real Number → Reparamitized Domain.

Also, the trick of it is: I think? I would have to get the length of the x/y values before I attempt to remap the number.

It’s pretty late here, I will look at again in the morning, when a clearer head might help.
Thanks again : )

If I understand correctly, you’re trying to do something like this: (8.1 KB)



Thank you Kevin. That works great!

For a test, I did the classical ios-trim (lower-center). In the example, I am just making a centered box.

Readability and organization is important to me. As I use it, I am going to watch its implementation. Perhaps I will make a cluster for this, as I am going to use this everywhere. Well, it’s always using Dom²Num and 4 remaps. Might as well throw the SubSurf in there.

From your offering, I made a cluster, that you input a surface, and it outputs an isotrimed scaled surface.

It also outputs the The input and output U and V size, which obviously don’t need text boxes. The input size can just be moused over to make sure one isn’t going out of bounds. The reparamiterization is set internally, because I often forget it.

I reuploaded it again to put the surface in the center, as it will be the only usual output. The SubSrf/Iso-Trim wires look messy, but I like to keep the triangle arrangement, as a habit, that and it’s 1:05am here : O

The name changed on import. I will have to look at the properties in the morning. Grr.

Scaled Inset.ghcluster (5.5 KB)

Thanks again!