Sorting points clockwise

Hi All

I am bringing sketchup (v8) model in to rhino 6. As always, the blocks have come as meshes and need to be converted to workable polysurfaces. In an attempt to convert meshes to polysurfaces in GH, I have hit upon a point where I need to sort points clockwise (or counter-clockwise). I have gone through threads on sorting but couldn’t get it done. Any help in this regard will be greatly appreciated. (40.4 KB)

Can’t look at your file atm. But create a circle in the center of your points (you can use average for center)
You can flip the circle if you want in other direction. Than sort your points along this circle

That means the Sort Along Curve component.

All that component does is find the closest parameter along the curve for each point and sort the list of points for ascending parameters. You could do the same, or even directly using angles, but @tim.stark is probably right in that Circle+SortAlongCurve is the easiest solution.

Here’s another approach (fitting a plane through the points and sorting the points by angles within the plane): (3.9 KB)


just an idea, couldnt you convert it into a brep(Brep.CreateFromMesh), than merge the faces with the same normal vector?
Just read it breafly since Istarted to work, I hope i got it right!Later maybe ill give it a try.

Edit: also, you have some internal faces

I kept thinking of, you can just merge them:

Hi David and everybody else, thanks for your reply on this. I have tried doing sort along curve component in this file but had no luck with it. The problem is that there is a difference between the angular distance and scalar distance from, let’s say a point of interest. Hence the sorted points do not make logical sense although they algorithm is doing its job right. If you could please look at the file, I have tried a number of things to make it right. However the problem is that the final step which will complete this conversion from mesh to brep is just not happening.

Thanks again,

Maybe clean it up a bit, make logical groups, name things etc. to better communicate your algorithm.

Bullant (available for free from ) has a command ggMeshToBrep that collapses internal mesh edges on planar faces into a polysurface. My testing it works a lot faster than MeshToNurb.




I played a bit. I think your main problem is, that your mesh is bad.

I kept trying with a cleaner mesh and to get isoCurves usable for pattern making:

It is really slow but seems kind of work.
initial mesh:

The gg component gives me an error message:

Let me know what you think!
Edit: also Pufferfish has a MeshToPlySrf component:


Although I use rhino 5, there’s an option to import as trimmed planes or mesh for models from sketchup 8 and earlier. Trimmed planes brings the model in as a collection of surfaces/polysurfaces (if solid), just MergeAllFaces after it’s brought in to remove some unnecessary surface divisions. You might need to make your tolerance larger to help MergeAllFaces


Thanks for your reply. I will work on these lines and keep you posted about my progress.

Hey Anders,

This is real cool! Thanks.


1 Like