Revit.SDK.Samples.GeometryCreation_BooleanOperation.CS.GeometryCreation.CreateCenterbasedSphere C# (CSharp) Method

CreateCenterbasedSphere() public method

Create a centerbased sphere
public CreateCenterbasedSphere ( XYZ center, double radius ) : Solid
center XYZ The given sphere center
radius double The given sphere's radius
return Solid
        public Solid CreateCenterbasedSphere(XYZ center, double radius)
        {
            Frame frame = new Frame(center,
            Autodesk.Revit.DB.XYZ.BasisX,
            Autodesk.Revit.DB.XYZ.BasisY,
            Autodesk.Revit.DB.XYZ.BasisZ);

             List<CurveLoop> profileloops = new List<CurveLoop>();
             CurveLoop profileloop = new CurveLoop();
             Ellipse cemiEllipse = m_app.Create.NewEllipse(center, radius, radius,
            Autodesk.Revit.DB.XYZ.BasisX,
            Autodesk.Revit.DB.XYZ.BasisZ,
            -Math.PI / 2.0, Math.PI / 2.0);
             profileloop.Append(cemiEllipse);
             profileloop.Append(m_app.Create.NewLine(
            new XYZ(center.X, center.Y, center.Z + radius),
            new XYZ(center.X, center.Y, center.Z - radius),
            true));
             profileloops.Add(profileloop);

             return GeometryCreationUtilities.CreateRevolvedGeometry(frame, profileloops, -Math.PI, Math.PI);
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Prepare 5 solids materials for CSG tree
        /// </summary>
        /// <param name="geometrycreation">The object that is responsible for creating the solids</param>
        /// <returns>The solids materials list</returns>
        private List <Solid> prepareSolids(GeometryCreation geometrycreation)
        {
            List <Solid> resultSolids = new List <Solid>();

            resultSolids.Add(geometrycreation.CreateCenterbasedBox(Autodesk.Revit.DB.XYZ.Zero, 25));

            resultSolids.Add(geometrycreation.CreateCenterbasedSphere(Autodesk.Revit.DB.XYZ.Zero, 20));

            resultSolids.Add(geometrycreation.CreateCenterbasedCylinder(Autodesk.Revit.DB.XYZ.Zero, 5, 40,
                                                                        GeometryCreation.CylinderDirection.BasisX));

            resultSolids.Add(geometrycreation.CreateCenterbasedCylinder(Autodesk.Revit.DB.XYZ.Zero, 5, 40,
                                                                        GeometryCreation.CylinderDirection.BasisY));

            resultSolids.Add(geometrycreation.CreateCenterbasedCylinder(Autodesk.Revit.DB.XYZ.Zero, 5, 40,
                                                                        GeometryCreation.CylinderDirection.BasisZ));

            return(resultSolids);
        }
All Usage Examples Of Revit.SDK.Samples.GeometryCreation_BooleanOperation.CS.GeometryCreation::CreateCenterbasedSphere