Create a solid from a SLC file

Hey All

I have a usage scenario to reverse a SLC file back to a mesh and this was my attempt so far, but it is INSANELY slow and it will fail where two curves are INSIDE each other and meant to be hollow they will instead both be extruded.

I am sure im close but dont know how to iterate through the Keys as a set of curves

Example there are 4 X 0.675 keys, ie 4 curves on the same Z layer of the SLC, if i can grabe them together, I can create a boundary surface then extrude that surface so the “hollows” are intact.

An enterprising person mght be able to figoure out how to loft it all but thats beyond my brain power…

any help appreciated

SLC2STL.gh (158.4 KB)
ring.zip (8.9 MB)



Forget lofting.

I’d suggest to either go back to where the SLC was exportedd and export something more useful. If that isn’t possible, there is software to convert the SLC file into a mesh. I just quickly googled and found this: Formware 3D - SLC to STL Converter

Otherwise there are a few posts in this forum on how to mesh points…

Here is a way, it takes 2 minutes to compute a mesh. There is a first slice to mesh then Dendro. You can then smooth the mesh …

For the hollow parts curves must be separated in 2 groups in order to have the hollow part




extrude curves to mesh.gh (160.5 KB)

First polylines are transformed to a mesh (bottom cap)
Translated to make upper cap
Extruded to make the side
Joined
then all joined (Dendro is fastest with a big uggly mesh than with many nice little meshes)

 private void RunScript(List<Polyline> polylines, double heigth, ref object meshes)
  {
    List<Mesh> lst_meshes = new List<Mesh>();
    Vector3d vZ = Vector3d.ZAxis * heigth;
    foreach (Polyline pl in polylines)
    {
      Polyline plTranslated = pl.Duplicate();
      Transform translate = Transform.Translation(vZ);
      plTranslated.Transform(translate);

      Mesh mesh1 = Mesh.CreateFromClosedPolyline(pl);
      Mesh mesh2 = Mesh.CreateFromClosedPolyline(plTranslated);

      Mesh mesh3 = new Mesh();
      for (int i = 0; i < pl.Count - 1; i++)
      {
        mesh3.Vertices.Add(pl[i]);
      }
      for (int i = 0; i < pl.Count - 1; i++)
      {
        mesh3.Vertices.Add(pl[i] + Vector3d.ZAxis * heigth);
      }
      for (int i = 0; i < pl.Count - 1; i++)
      {
        int A = i;
        int B = (i + 1) % (pl.Count - 1);
        int C = (i + 1) % (pl.Count - 1) + (pl.Count - 1);
        int D = i + (pl.Count - 1);
        mesh3.Faces.AddFace(new MeshFace(A, B, C, D));
      }
      if (mesh1 != null && mesh2 != null && mesh3 != null)
      {
        mesh1.Append(mesh2);
        mesh1.Append(mesh3);
        mesh1.Vertices.CombineIdentical(true, true);
        mesh1.RebuildNormals();
        mesh1.UnifyNormals();
        lst_meshes.Add(mesh1);
      }
    }
    meshes = lst_meshes;
  }
2 Likes

very nice thank you!

Again thank you