- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have cylindrical layers in my project which represent layers of soil in a borehole. Since i have a number of boreholes, I have defined Toposurfaces which bind together the layer boundaries of same layer types in different boreholes to form a 3D structure. Now the task at hand is to create a mass between two consecutive toposurfaces to form a whole 3D Body. The created mass would have the same material and Colour as the layers it binds together and will lie between two toposurfaces. I have tried building a tesselated shape builder and also tried using a loft, But somehow I am unable to define the loft and the Tesselated shape between the toposurfaces. Any help in this regard would be greatly appreciated.
My revit project that contains the structure is attached hereby for reference.
The code that creates loft is here: (The code works by selecting the first topography and building the loft but Iam unable to confine the loft between two toposurfaces )
Selection sel = uiapp.ActiveUIDocument.Selection;
TopographySurface topo = doc.GetElement(sel.PickObject(ObjectType.Element)) as TopographySurface;
Mesh mesh = topo.get_Geometry(new Options()).First(m => m is Mesh) as Mesh;
double offsetDist = 10;
List<Solid> solids = new List<Solid>();
using (Transaction tx = new Transaction(doc))
{
tx.Start("Generate Topography");
for (int i = 0; i < mesh.NumTriangles; i++)
{
XYZ[] triangleCorners = new XYZ[3];
MeshTriangle triangle = mesh.get_Triangle(i);
triangleCorners[0] = triangle.get_Vertex(0);
triangleCorners[1] = triangle.get_Vertex(1);
triangleCorners[2] = triangle.get_Vertex(2);
List<Curve> curves = new List<Curve>();
List<Curve> newCurves = new List<Curve>();
curves.Add(Line.CreateBound(triangleCorners[0], triangleCorners[1]));
curves.Add(Line.CreateBound(triangleCorners[1], triangleCorners[2]));
curves.Add(Line.CreateBound(triangleCorners[2], triangleCorners[0]));
newCurves.Add(Line.CreateBound(new XYZ(triangleCorners[0].X, triangleCorners[0].Y, triangleCorners[0].Z - offsetDist), new XYZ(triangleCorners[1].X, triangleCorners[1].Y, triangleCorners[1].Z - offsetDist)));
newCurves.Add(Line.CreateBound(new XYZ(triangleCorners[1].X, triangleCorners[1].Y, triangleCorners[1].Z - offsetDist), new XYZ(triangleCorners[2].X, triangleCorners[2].Y, triangleCorners[2].Z - offsetDist)));
newCurves.Add(Line.CreateBound(new XYZ(triangleCorners[2].X, triangleCorners[2].Y, triangleCorners[2].Z - offsetDist), new XYZ(triangleCorners[0].X, triangleCorners[0].Y, triangleCorners[0].Z - offsetDist)));
List<CurveLoop> profiles = new List<CurveLoop>();
CurveLoop curveLoop = CurveLoop.Create(curves);
profiles.Add(curveLoop);
CurveLoop newCurveLoop = CurveLoop.Create(newCurves);
profiles.Add(newCurveLoop);
//create direct shape from curveloops
SolidOptions options = new SolidOptions(ElementId.InvalidElementId, ElementId.InvalidElementId);
//create loft
Solid loft = GeometryCreationUtilities.CreateLoftGeometry(profiles, options);
solids.Add(loft);
DirectShape ds1 = null;
ds1 = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
ds1.ApplicationId = "Application id";
ds1.ApplicationDataId = "Geometry object id";
ds1.Name = "TOPO";
ds1.SetShape(new GeometryObject[] { loft });
}
Cheers,
Mustaeen Qazi
Solved! Go to Solution.
Developer Advocacy and Support +