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
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;
}
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:
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: