Beispiel #1
0
        void ReconstructDirectShapeByMesh
        (
            Document doc,
            ref Autodesk.Revit.DB.Element element,

            Rhino.Geometry.Mesh mesh
        )
        {
            var scaleFactor = 1.0 / Revit.ModelUnits;

            ThrowIfNotValid(nameof(mesh), mesh);

            if (element is DirectShape ds)
            {
            }
            else
            {
                ds = DirectShape.CreateElement(doc, new ElementId(BuiltInCategory.OST_GenericModel));
            }

            var shape = mesh.
                        ToHostMultiple(scaleFactor).
                        SelectMany(x => x.ToDirectShapeGeometry());

            ds.SetShape(shape.ToList());

            ReplaceElement(ref element, ds);
        }