コード例 #1
0
        private static rg.Brep ExtrudeBrep(rg.Brep brep, rg.Vector3d dir)
        {
            if (dir.IsZero)
            {
                return(brep);
            }
            List <rg.Curve> edgeCurves = new List <rg.Curve>();
            List <rg.Brep>  breps;

            checked
            {
                int num = brep.Edges.Count - 1;
                for (int i = 0; i <= num; i++)
                {
                    if (brep.Edges[i].TrimCount == 1)
                    {
                        rg.Curve item = brep.Edges[i].DuplicateCurve();
                        edgeCurves.Add(item);
                    }
                }
                if (edgeCurves.Count == 0)
                {
                    return(brep);
                }
                breps = new List <rg.Brep>()
                {
                    brep
                };
                int num2 = edgeCurves.Count - 1;
                for (int j = 0; j <= num2; j++)
                {
                    rg.Surface extrusion = Rhino.Compute.SurfaceCompute.CreateExtrusion(edgeCurves[j], dir);
                    if (extrusion != null)
                    {
                        rg.Brep val2 = extrusion.ToBrep();
                        // val2.Faces.SplitKinkyFaces();
                        breps.Add(val2);
                    }
                }
                rg.Brep topFace = brep.DuplicateBrep();
                topFace.Translate(dir);
                breps.Add(topFace);
            }
            rg.Brep[] array = Rhino.Compute.BrepCompute.JoinBreps(breps, 0.0001);
            if (array == null)
            {
                return(brep);
            }
            return(array[0]);
        }
コード例 #2
0
ファイル: FromRhino.cs プロジェクト: BHoM/Rhinoceros_Toolkit
        /***************************************************/

        public static BHG.ISurface FromRhino(this RHG.Surface surface)
        {
            if (surface == null)
            {
                return(null);
            }

            if (surface.IsPlanar(BHG.Tolerance.Distance))
            {
                BHG.ICurve externalEdge = RHG.Curve.JoinCurves(surface.ToBrep().DuplicateNakedEdgeCurves(true, false)).FirstOrDefault().FromRhino();
                return(new BHG.PlanarSurface(externalEdge, new List <oM.Geometry.ICurve>()));
            }

            return(surface.ToNurbsSurface().FromRhino());
        }
コード例 #3
0
    /// <summary>
    /// Extends a curve on a surface.
    /// </summary>
    /// <param name="side">The end of the curve to extend.</param>
    /// <param name="surface">Surface that contains the curve.</param>
    /// <returns>New extended curve result on success, null on failure.</returns>
    public Curve ExtendOnSurface(CurveEnd side, Surface surface)
    {
      if (surface == null) { throw new ArgumentNullException("surface"); }
      Brep brep = surface.ToBrep();
      if (brep == null) { return null; }

      return ExtendOnSurface(side, brep.Faces[0]);
    }
コード例 #4
0
        /***************************************************/

        public static void RenderRhinoMeshes(RHG.Surface surface, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            pipeline.DrawBrepShaded(surface.ToBrep(), material);
        }
コード例 #5
0
ファイル: FromRC.cs プロジェクト: lulzzz/Nucleus
 /// <summary>
 /// Convert a Rhino surface to a Nucleus one
 /// </summary>
 /// <param name="surface"></param>
 /// <returns></returns>
 public static Surface Convert(RC.Surface surface)
 {
     return(Convert(surface.ToBrep()));
 }
コード例 #6
0
        /***************************************************/

        public static RHG.Mesh CreatePreviewMesh(RHG.Surface surface, RHG.MeshingParameters parameters)
        {
            return(CreatePreviewMesh(surface.ToBrep(), parameters));
        }