Revit.SDK.Samples.GeometryCreation_BooleanOperation.CS.GeometryCreation.CreateCenterbasedBox C# (CSharp) 메소드

CreateCenterbasedBox() 공개 메소드

Create a centerbased box
public CreateCenterbasedBox ( XYZ center, double edgelength ) : Solid
center XYZ The given box center
edgelength double The given box's edge length
리턴 Solid
        public Solid CreateCenterbasedBox(XYZ center, double edgelength)
        {
            double halfedgelength = edgelength / 2.0;

             List<CurveLoop> profileloops = new List<CurveLoop>();
             CurveLoop profileloop = new CurveLoop();
             profileloop.Append(m_app.Create.NewLine(
            new XYZ(center.X - halfedgelength, center.Y - halfedgelength, center.Z - halfedgelength),
            new XYZ(center.X - halfedgelength, center.Y + halfedgelength, center.Z - halfedgelength),
            true));
             profileloop.Append(m_app.Create.NewLine(
            new XYZ(center.X - halfedgelength, center.Y + halfedgelength, center.Z - halfedgelength),
            new XYZ(center.X + halfedgelength, center.Y + halfedgelength, center.Z - halfedgelength),
            true));
             profileloop.Append(m_app.Create.NewLine(
            new XYZ(center.X + halfedgelength, center.Y + halfedgelength, center.Z - halfedgelength),
            new XYZ(center.X + halfedgelength, center.Y - halfedgelength, center.Z - halfedgelength),
            true));
             profileloop.Append(m_app.Create.NewLine(
            new XYZ(center.X + halfedgelength, center.Y - halfedgelength, center.Z - halfedgelength),
            new XYZ(center.X - halfedgelength, center.Y - halfedgelength, center.Z - halfedgelength),
            true));
             profileloops.Add(profileloop);

             XYZ extrusiondir = new XYZ(0, 0, 1); // orthogonal

             double extrusiondist = edgelength;

             return GeometryCreationUtilities.CreateExtrusionGeometry(profileloops, extrusiondir, extrusiondist);
        }

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::CreateCenterbasedBox