Example #1
0
        void ReconstructColumnByCurve
        (
            Document doc,
            ref Autodesk.Revit.DB.Element element,

            Rhino.Geometry.Line curve,
            Optional <Autodesk.Revit.DB.FamilySymbol> type,
            Optional <Autodesk.Revit.DB.Level> level
        )
        {
            if (curve.FromZ > curve.ToZ)
            {
                curve.Flip();
            }

            var scaleFactor = 1.0 / Revit.ModelUnits;

            curve = curve.ChangeUnits(scaleFactor);

            SolveOptionalType(ref type, doc, BuiltInCategory.OST_StructuralColumns, nameof(type));

            if (!type.Value.IsActive)
            {
                type.Value.Activate();
            }

            SolveOptionalLevel(doc, curve, ref level, out var bbox);

            // Type
            ChangeElementTypeId(ref element, type.Value.Id);

            if (element is FamilyInstance familyInstance && element.Location is LocationCurve locationCurve)
            {
                locationCurve.Curve = curve.ToHost();
            }