Civil3d Tin Surface to Revit Topography

Hi,

Could Civil3D Tin Surfaces be converted to higher level BuiltElements.Topography as opposed to a Geometry.Mesh.

We are using Tin Surfaces within Civil 3d is to model the Ground Surfaces. being able to pull these directly into Revit as a topography element as opposed to model in place Mesh would be great.

This would be great for sharing ground surfaces between our Civil teams working in Civil3D and wider design team usually in Revit.

Were are currently using Rhino.Inside Mesh to Topography component to facilitate this but with the aim of increasing adoption and usability it would be great if this could be achieved directly using the Speckle UI :star_struck:

A bit more detail:

Hacky implementation in ConverterAutoCadCivil.Civil.cs

// surfaces
public Topography SurfaceToSpeckle(TinSurface surface)
{
  // output vars
  List<double> vertices = new();
  List<int> faces = new();
  Dictionary<Point3d, int> indices = new();

  int indexCounter = 0;
  foreach (var triangle in surface.GetTriangles(false))
  {
    try
    {
      Point3d[] triangleVertices = { triangle.Vertex1.Location, triangle.Vertex2.Location, triangle.Vertex3.Location };
      foreach (Point3d p in triangleVertices)
      {
        if (!indices.ContainsKey(p))
        {
          var scaledP = ToExternalCoordinates(p);
          vertices.Add(scaledP.X);
          vertices.Add(scaledP.Y);
          vertices.Add(scaledP.Z);
          indices.Add(p, indexCounter);
          indexCounter++;
        }
      }
      faces.Add(3);
      faces.Add(indices[triangleVertices[0]]);
      faces.Add(indices[triangleVertices[1]]);
      faces.Add(indices[triangleVertices[2]]);
    }
    finally
    {
      triangle.Dispose();
    }
  }

  var mesh = new Mesh(vertices, faces)
  {
    units = ModelUnits,
    bbox = BoxToSpeckle(surface.GeometricExtents)
  };

  var speckleTopography = new Topography(mesh)
  {
    units = ModelUnits
  };

  // add tin surface props
  AddNameAndDescriptionProperty(surface.Name, surface.Description, mesh);
  Base props = Utilities.GetApplicationProps(surface, typeof(TinSurface), false);
  mesh[CivilPropName] = props;
  speckleTopography[CivilPropName] = props;

  return speckleTopography;
}

Sample Stream

using the above I still have two issues.

Revit’ Topography Mesh doesn’t match the source (Testing in Revit 2022)

The topography created doesn’t match the original. I believe this is because the convertor uses:

var revitSurface = TopographySurface.Create(Doc, pts);

Would it possible to update to use the alternative override which allows facets to be defined:
RevitAPI

public static TopographySurface Create(
	Document document,
	IList<XYZ> points,
	IList<PolymeshFacet> facets
)

which is the implementation the RIR node we are currently using does:

RIR

Coordinate Systems

Conversion to Revit coordinate system (I’m aware a custom UCS can be set in Autocad) that resolves this but sill a bit confused as to what happens in the translation and will review further.

Currently we the following implementation that resolves it for us when using RIR and a similar for Dynamo:

That’s a pretty fancy suggestion. Thanks @alex-d-richards. Stalking us here for a year and two great contributions in a day! :spockle_smirk: :fire:

1 Like

Haha, thanks @jonathon, ive been stalking :speckle: for some time using the original link between Grasshopper and GSA back in Speckle 1.

Thought it was about time to step out the shadows and join the community in a more constructive manner :smile:

We implemented something for the GIS workflows which converted GISTopography to RevitTopography. My good friend @Kateryna has reminded me that Revit has deprecated Topography in favour of TopoSolids which is a different prospect.

Have you any view if the TIN surfaces should grow depth to become solids instead of straightforward surfaces?

Our Civil Engineers typical have each surface that their interested in in separate files (.dwg) which are then data shortcut into various other civil 3d model files.

I have been reflecting this in the streams/ models that we create in speckle so on a typical project we may have:

  • Topo
    • Existing Surface
    • Proposed Surface
    • Site Strip
    • Roads
    • Carparks
    • Footpaths
    • Geotechnical stratum (usually very course)

all as separate streams.

To date as structural engineers we have only really been using the Existing, Proposed, Geo surfaces in Revit largely for coordination. however moving to TopoSolids would make the the use case for Roads, Carparks and Footpaths much better especially for Arch, Landscape etc?

As we generally stream each surface separately I’m not sure how you would associate a thickness to them. I don’t think there is anything in C3D that allows this to be specified and there would be no way to assess interaction with other surfaces?

Would it need to be achieved through the mapping functionality on the Revit side?

1 Like

No such facility exists in Mapper at this time. It was entirely speculative on my part.

TopoSolids extrude vertically downward to the next level or AOD, I believe.

1 Like

@alex-d-richards this is a great suggestion - functionally, TIN surfaces and topography/toposolids perform similar functions, and we should consider them inheriting from the same generic class if we get an opportunity to redesign them. I took a quick peek at our current Revit Toposolid class, the schema could definitely be abstracted better for the point-based construction of toposolids, and then be used for TIN surfaces down the line.

2 Likes