예제 #1
0
        public NurbsCurve ToNurbsCurve()
        {
            IntPtr const_ptr_this = ConstPointer();
            IntPtr ptr_nurbs_crv  = UnsafeNativeMethods.ON_BezierCurve_GetNurbForm(const_ptr_this);

            return(GeometryBase.CreateGeometryHelper(ptr_nurbs_crv, null) as NurbsCurve);
        }
예제 #2
0
        /// <summary>
        /// Get a cubic, uniform, non-rational, NURBS curve that is on the
        /// edge's limit curve.
        /// </summary>
        /// <param name="clampEnds">
        /// If true, the end knots are clamped.
        /// Otherwise the end knots are(-2,-1,0,...., k1, k1+1, k1+2).
        /// </param>
        /// <returns></returns>
        /// <since>7.0</since>
        public NurbsCurve ToNurbsCurve(bool clampEnds)
        {
            IntPtr const_ptr_this = ConstPointer();
            IntPtr ptr_nurbscurve = UnsafeNativeMethods.ON_SubDEdge_LimitCurve(const_ptr_this, clampEnds);

            return(GeometryBase.CreateGeometryHelper(ptr_nurbscurve, null) as NurbsCurve);
        }
예제 #3
0
        /// <summary>
        /// Gets the segment curve at the given index.
        /// </summary>
        /// <param name="index">Index of segment to retrieve.</param>
        /// <returns>The segment at the given index or null on failure.</returns>
        public Curve SegmentCurve(int index)
        {
            IntPtr ptr    = ConstPointer();
            IntPtr pCurve = UnsafeNativeMethods.ON_PolyCurve_SegmentCurve(ptr, index);

            return(GeometryBase.CreateGeometryHelper(pCurve, this, index) as Curve);
        }
예제 #4
0
        /// <summary>
        /// Gets the line-like curve that is the conceptual axis of the extrusion.
        /// </summary>
        /// <returns>The path as a line curve.</returns>
        public LineCurve PathLineCurve()
        {
            IntPtr pConstThis = ConstPointer();
            IntPtr pLineCurve = UnsafeNativeMethods.ON_Extrusion_PathLineCurve(pConstThis);

            return(GeometryBase.CreateGeometryHelper(pLineCurve, null) as LineCurve);
        }
예제 #5
0
        /// <summary>
        /// Gets one of the longitudinal curves along the beam or extrusion.
        /// </summary>
        /// <param name="ci">The index of this profile.</param>
        /// <returns>The profile.</returns>
        public Curve WallEdge(ComponentIndex ci)
        {
            IntPtr pConstThis = ConstPointer();
            IntPtr pCurve     = UnsafeNativeMethods.ON_Extrusion_WallEdge(pConstThis, ci);

            return(GeometryBase.CreateGeometryHelper(pCurve, null) as Curve);
        }
예제 #6
0
        /// <summary>
        /// Gets one of the longitudinal surfaces of the extrusion.
        /// </summary>
        /// <param name="ci">The index specifying which precise item to retrieve.</param>
        /// <returns>The surface.</returns>
        public Surface WallSurface(ComponentIndex ci)
        {
            IntPtr pConstThis = ConstPointer();
            IntPtr pSurface   = UnsafeNativeMethods.ON_Extrusion_WallSurface(pConstThis, ci);

            return(GeometryBase.CreateGeometryHelper(pSurface, null) as Surface);
        }
예제 #7
0
        //[skipping]
        //ProfileParamter
        //Profile

        /// <summary>
        /// Gets a transversal isocurve of the extruded profile.
        /// </summary>
        /// <param name="profileIndex">
        /// 0 &lt;= profileIndex &lt; ProfileCount
        /// The outer profile has index 0.
        /// </param>
        /// <param name="s">
        /// 0.0 &lt;= s &lt;= 1.0
        /// A relative parameter controling which profile is returned.
        /// 0 = bottom profile and 1 = top profile.
        /// </param>
        /// <returns>The profile.</returns>
        public Curve Profile3d(int profileIndex, double s)
        {
            IntPtr pConstThis = ConstPointer();
            IntPtr pCurve     = UnsafeNativeMethods.ON_Extrusion_Profile3d(pConstThis, profileIndex, s);

            return(GeometryBase.CreateGeometryHelper(pCurve, null) as Curve);
        }
예제 #8
0
        /// <summary>
        /// Constructs a brep form of the extrusion. The outer profile is always the first face of the brep.
        /// If there are inner profiles, additional brep faces are created for each profile. If the
        /// outer profile is closed, then end caps are added as the last two faces of the brep.
        /// </summary>
        /// <param name="splitKinkyFaces">
        /// If true and the profiles have kinks, then the faces corresponding to those profiles are split
        /// so they will be G1.
        /// </param>
        /// <returns>A brep with a similar shape like this extrustion, or null on error.</returns>
        public Brep ToBrep(bool splitKinkyFaces)
        {
            IntPtr pConstThis = ConstPointer();
            IntPtr pBrep      = UnsafeNativeMethods.ON_Extrusion_BrepForm(pConstThis, splitKinkyFaces);

            return(GeometryBase.CreateGeometryHelper(pBrep, null) as Brep);
        }
예제 #9
0
        /// <summary>
        /// Constructs a NURBS curve representation of this curve.
        /// </summary>
        /// <returns>NURBS representation of the curve on success, null on failure.</returns>
        public NurbsCurve ToNurbsCurve()
        {
            IntPtr pConstThis  = ConstPointer();
            IntPtr pNurbsCurve = UnsafeNativeMethods.ON_BezierCurve_GetNurbForm(pConstThis);

            return(GeometryBase.CreateGeometryHelper(pNurbsCurve, null) as NurbsCurve);
        }
예제 #10
0
        /// <summary>
        /// Removes any nesting of polycurves. If this polycurve has just a single segment, the segment is returned.
        /// If, after nest removal, there are adjacent segments which are polylines, they are combined into a single polyline.
        /// The new curve may have a different domain from this polycurve. If the start and end segments of a closed input are polylines,
        /// the result may have a different seam location since the start and end segments will be combined.
        /// </summary>
        /// <returns>A new curve that is not necessarily a polycurve if successful, null otherwise. </returns>
        /// <seealso cref="RemoveNesting"/>
        /// <since>7.0</since>
        public Curve CleanUp()
        {
            IntPtr ptr_const_this = ConstPointer();
            IntPtr ptr            = UnsafeNativeMethods.RHC_RhinoCleanUpPolyCurve(ptr_const_this);

            return(GeometryBase.CreateGeometryHelper(ptr, null) as Curve);
        }
예제 #11
0
        public NurbsSurface ToNurbsSurface()
        {
            IntPtr constPtrThis    = ConstPointer();
            IntPtr ptrNurbsSurface = UnsafeNativeMethods.ON_BezierSurface_GetNurbForm(constPtrThis);

            return(GeometryBase.CreateGeometryHelper(ptrNurbsSurface, null) as NurbsSurface);
        }
예제 #12
0
        /// <summary>
        /// Gets a rational degree 2 NURBS curve representation
        /// of the circle. Note that the parameterization of NURBS curve
        /// does not match circle's transcendental paramaterization.
        /// Use GetRadianFromNurbFormParameter() and
        /// GetParameterFromRadian() to convert between the NURBS curve
        /// parameter and the transcendental parameter.
        /// </summary>
        /// <returns>Curve on success, null on failure.</returns>
        public static NurbsCurve CreateFromCircle(Circle circle)
        {
            IntPtr pNC     = UnsafeNativeMethods.ON_NurbsCurve_New(IntPtr.Zero);
            int    success = UnsafeNativeMethods.ON_Circle_GetNurbForm(ref circle, pNC);

            if (0 == success)
            {
                UnsafeNativeMethods.ON_Object_Delete(pNC);
                return(null);
            }
            return(GeometryBase.CreateGeometryHelper(pNC, null) as NurbsCurve);
        }
예제 #13
0
        private Silhouette(IntPtr ptrSilEvent)
        {
            IntPtr ptr_curve = UnsafeNativeMethods.TLC_SilEvent_ExtractCurve(ptrSilEvent);

            Curve = GeometryBase.CreateGeometryHelper(ptr_curve, null) as Curve;
            ComponentIndex ci = ComponentIndex.Unset;
            var            et = UnsafeNativeMethods.TLC_SilEvent_Extract(ptrSilEvent, ref ci);

            switch (et)
            {
            case UnsafeNativeMethods.SilEventType.None:
                SilhouetteType = SilhouetteType.None;
                break;

            case UnsafeNativeMethods.SilEventType.Tangent:
                SilhouetteType = SilhouetteType.Tangent;
                break;

            case UnsafeNativeMethods.SilEventType.Projecting:
                SilhouetteType = SilhouetteType.Projecting;
                break;

            case UnsafeNativeMethods.SilEventType.TanProjects:
                SilhouetteType = SilhouetteType.TangentProjects;
                break;

            case UnsafeNativeMethods.SilEventType.Boundary:
                SilhouetteType = SilhouetteType.Boundary;
                break;

            case UnsafeNativeMethods.SilEventType.Crease:
                SilhouetteType = SilhouetteType.Crease;
                break;

            case UnsafeNativeMethods.SilEventType.DraftCurve:
                SilhouetteType = SilhouetteType.DraftCurve;
                break;
            }
            GeometryComponentIndex = ci;
        }
예제 #14
0
        /// <summary>
        /// Explodes this PolyCurve into a list of Curve segments. This will <b>not explode</b> nested polycurves.
        /// Call <see cref="RemoveNesting"/> first if you need all individual segments.
        /// </summary>
        /// <returns>An array of polycurve segments.</returns>
        public Curve[] Explode()
        {
            Runtime.InteropWrappers.SimpleArrayCurvePointer curves = new Runtime.InteropWrappers.SimpleArrayCurvePointer();
            IntPtr pConstThis  = ConstPointer();
            IntPtr pCurveArray = curves.NonConstPointer();

            UnsafeNativeMethods.ON_PolyCurve_SegmentCurves(pConstThis, pCurveArray);

            int count = UnsafeNativeMethods.ON_CurveArray_Count(pCurveArray);

            Curve[] rc = new Curve[count];
            for (int i = 0; i < count; i++)
            {
                IntPtr pConstSegmentCurve = UnsafeNativeMethods.ON_CurveArray_Get(pCurveArray, i);
                if (IntPtr.Zero == pConstSegmentCurve)
                {
                    continue;
                }
                IntPtr pNewCurve = UnsafeNativeMethods.ON_Curve_DuplicateCurve(pConstSegmentCurve);
                rc[i] = GeometryBase.CreateGeometryHelper(pNewCurve, null) as Curve;
            }
            curves.Dispose();
            return(rc);
        }