Consistent mesh

Is there a way that I can take a surface and create a uniform mesh from it. The MeshToolKit doesn’t appear to let me do it. It says that it is controlled by Dynamo’s render precision which isn’t accurate, more of a global control. I want to be able to create a room (possibly irregular), generate a surface from it and convert it to a mesh at say 500x500mm resolution. Is this possible? Using UV subdivide is a bit painful because you need to work out the bounding box or ALL rooms. Was hoping for a similar method.

There was something similar discussed here but its not exactly the same issue: Custom Meshes

Thanks

I don’t believe there’s anything like that for Dynamo. You could go for the average point approach and subdivide the surface until all resulting triangles’ areas are under a target area but the result won’t be very uniform. Vikram has posted one possible way on how to do that here:

This is what you can expect with that approach:

1 Like

The below approach should work in cases where points generated using Surface.PointAtParameter are all within the surface.
MeshFromSurface.dyn (6.9 KB)

In Dynamo, you could take a grid of points and project them down onto a surface, and then use these points to generate a mesh.

(I don’t quite understand what you mean by using a room)

It probably does not help you, but I have done something similar but using Civil3D- since it has in built tools to create grids of points from a surface. You can then bring this into Revit as a nice tidy topo, without loads of weird triangulation. (Although it looks neater, it is less efficient and less accurate)

@Dimitar_Venkov Like the animation
Don’t think it will impress @Paul_Wintour though :slight_smile:

Thanks for the response. Not exactly what I had in mind. I would prefer quads as much as possible. The projection method could work but for many surfaces I would imagine it would get very heavy/slow. i guess too that there is no way to ensure that when projecting you will hit the edges and corners of the surface.

@Paul_Wintour The definition provided with my post above converts a surface to a mesh (with quads) where the density of the quads can be controlled. (The limitation is that it only works with rectangular surfaces)
Here is a screenshot that highlights this aspect …

//Dividing surface and grouping points
pnts1=srf.PointAtParameter((0..1..#nU)<1>,(0..1..#nV)<2>);
pnts2=List.DropItems(List.Sublists(pnts1<1>,0..1,1)<1>,-1);
pnts3=List.DropItems(pnts2,-1);
pnts4=List.Reverse(List.DropItems(pnts2,1)<1><2>);
pnts5=List.AddItemToFront(pnts3<1><2>,pnts4<1><2>);
pnts6=List.Flatten(Flatten(pnts5<1><2>),1);
quads=Polygon.ByPoints(pnts6);

//Index Groups
indx=Transpose(IndexOf(Flatten(pnts1),pnts6<1><2>));
indGrp=IndexGroup.ByIndices(indx[0],indx[1],indx[2],indx[3]);
msh=Mesh.ByPointsFaceIndices(Flatten(pnts1),indGrp);

Hi Vikram

I need to be able to extract room polylines, convert them to a surface and then turn it into a quad mesh. So the workflow needs to be able to accept irregular shapes.

@Paul_Wintour Should be able to alter the code to accept irregular shapes.
Curved edges might end up being segmented, though.
Will work on it.

@Paul_Wintour This should work with irregular shapes.
MeshFromSurface-1.dyn (6.1 KB)

//Dividing surface and grouping points
pnts1=srf.PointAtParameter((0.00001..0.99999..#nU)<1>,(0.00001..0.99999..#nV)<2>);
lins1=Line.ByStartPointEndPoint(List.FirstItem(pnts1),List.LastItem(pnts1));
lins2=lins1.Intersect(srf);
pnts3=Flatten(lins2)<1>.PointAtParameter(0..1..#nU);

pnts4=List.DropItems(List.Sublists(pnts3<1>,0..1,1)<1>,-1);
pnts5=List.DropItems(pnts4,-1);
pnts6=List.Reverse(List.DropItems(pnts4,1)<1><2>);
pnts7=List.AddItemToFront(pnts5<1><2>,pnts6<1><2>);
pnts8=List.Flatten(Flatten(pnts7<1><2>),1);

//Index Groups
indx=Transpose(IndexOf(Flatten(pnts3),pnts8<1><2>));
indGrp=IndexGroup.ByIndices(indx[0],indx[1],indx[2],indx[3]);
msh=Mesh.ByPointsFaceIndices(Flatten(pnts3),indGrp);
3 Likes

@Keith_Alfaro1

Hi Vikram
Isn’t this a UV subdivide which results in irregular sized mesh faces? I’m trying to ensure the faces are all (more or less) the same size.

I thought it was, but Dynamo doesn’t seem to think so (not always, at least). And I’m not sure anymore :smirk:

@Paul_Wintour Upload a sample sketch of a simple irregular surface with a rough pattern.

Hi Vikram. Mostapha from Ladybug has been working on the creating a consistent mesh from a surface. I haven’t had a chance to test it out yet.

1 Like

Hi @Vikram_Subbaiah! The code is great, but I have a question. How can I modify it to get a more regular mesh in the case of a pentagon? If I do it with this code, this happens.

1 Like