Subdivide Surface/ make quad mesh in c#

Hi all,

I was trying to create a subdivided surface.
What I try to archieve is subdivide the surface to make a quad mesh out of it.
Thats why I thought maybe just divide it points,but the problem is partition the list correct.
I just found how to subdivide into points.
Maybe someone can push it a little bit in the correct direction? (10.3 KB)

Thanks a lot!

1 Like

Hi @Baris,

isn’t there a component to do this under: Mesh > Util > Mesh Surface ?


yes, didnt thought about it, thanks.
you know how the rhino common is called?

I don’t think there is an 1:1 equivalent which offers individual UV control yet. But you could create a mesh in the XYPlane using Mesh.CreateFromPlane and map that to the surface to create a new mesh…


For the grid what you have there seems little weird. The step is usually i++ and the amount of steps usually done by second part of the for loop conditions with i ans an integer (this also won’t get potential floating point errors). What I mean is you are being redundant in making a kind of step decimal there when you already have inputs for u and v might as well just use that as the amount of loops.

Also, you you are dealing with division count you don;t really need to reset the domain, usually you reset the domain if you are dealing with parameter values for the input. So you can just do some math dividing by the length of the domains.

private void RunScript(Surface S, int U, int V, ref object A)
    List<Point3d> uvGrid = new List<Point3d>();
    for(int i = 0; i < U + 1; i++)
      for(int j = 0; j < V + 1; j++)
        Point3d srfPt = S.PointAt(S.Domain(0).Length / U * i, S.Domain(1).Length / V * j);
    A = uvGrid; (3.5 KB)

So what you have is perfectly valid, it just seems a bit not standard for usual for loop routines.

1 Like

hi @Michael_Pryor,

thanks for explaining it clearly, I thought about something like that but didnt got it to work , so I used an example i found on the internet.
Is it possible to make a quad mesh out of it? Should be also doable with math I imagine? Or do you have an example of how to subdivide a srf?

Thanks for your time and effort!

that sounds kind of a hussle, isnt there a simpler approach?

The simplest is to use the existing component. Then only slighty harder is to use the method i’ve described by remapping an existing mesh face structure from the xy to the surface uv domains.

To make this ypurself in a C# component you would first create the mesh vertices using the points (done). Then generate the mesh face indices (faces). Then build a mesh. Example how to do this can be found here.


You can do it simple like this if you think about it as being like sub domains. (5.0 KB)


wow! thanks a lot ! it looks so easy when you do it

I give you one like for using exactly the same naming conventions and the naming of your variables. Although I dislike using i and j for loop indices. I prefer u and v, since we are moving in surface space.:wink:

haha, thanks, maybe its cause of the same motherlanguage
Also thanks for the tip, its seems better to me call them u and v, its more logical/obvious.