Пример #1
0
 public static Rhino.Commands.Result AddBrepBox(Rhino.RhinoDoc doc)
 {
   Rhino.Geometry.Point3d pt0 = new Rhino.Geometry.Point3d(0, 0, 0);
   Rhino.Geometry.Point3d pt1 = new Rhino.Geometry.Point3d(10, 10, 10);
   Rhino.Geometry.BoundingBox box = new Rhino.Geometry.BoundingBox(pt0, pt1);
   Rhino.Geometry.Brep brep = box.ToBrep();
   Rhino.Commands.Result rc = Rhino.Commands.Result.Failure;
   if( doc.Objects.AddBrep(brep) != System.Guid.Empty )
   {
     rc = Rhino.Commands.Result.Success;
     doc.Views.Redraw();
   }
   return rc;
 }
Пример #2
0
        /***************************************************/
        /**** Public Methods  - Miscellanea             ****/
        /***************************************************/

        public static void RenderRhinoMeshes(RHG.BoundingBox bbBox, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            pipeline.DrawBrepShaded(bbBox.ToBrep(), material);
        }
Пример #3
0
        /***************************************************/
        /**** Public Methods  - Miscellanea             ****/
        /***************************************************/

        public static RHG.Mesh CreatePreviewMesh(RHG.BoundingBox bbBox, RHG.MeshingParameters parameters)
        {
            return(CreatePreviewMesh(bbBox.ToBrep(), parameters));
        }
            /// <summary>
            /// If possible, calculate the volume of the room.
            /// </summary>
            /// <param name="Breps">Surfaces that make up the model.</param>
            /// <param name="Volume"></param>
            /// <param name="SurfaceArea"></param>
            /// <returns>True if successful.</returns>
            public static bool RoomVolume(List<Brep> Breps, ref double Volume, out double[] SurfaceArea)
            {
                SurfaceArea = new double[Breps.Count];
                for (int x = 0; x < Breps.Count; x++)
                {
                    AreaMassProperties ap = AreaMassProperties.Compute(Breps[x]);
                    SurfaceArea[x] = ap.Area;
                }

                Brep[] Room = Brep.JoinBreps(Breps, 0.001);            
                Rhino.RhinoApp.WriteLine("Room is not closed. Using Bounding Volume.");
                BoundingBox Box = new BoundingBox();
                foreach (Brep srf in Breps)
                {
                     Box.Union(srf.GetBoundingBox(false));
                }

                ///////////////////////////////////////////////////////////////
                //Rhino.RhinoDoc.ActiveDoc.Objects.AddPoints(Box.GetCorners());
                ///////////////////////////////////////////////////////////////
                try
                {
                    Volume = VolumeMassProperties.Compute(Box.ToBrep()).Volume;
                }
                catch 
                {
                    Volume = 0;
                }

                return false;
            }