Ejemplo n.º 1
0
    /// <summary>
    /// Extends a curve on a surface.
    /// </summary>
    /// <param name="side">The end of the curve to extend.</param>
    /// <param name="face">BrepFace that contains the curve.</param>
    /// <returns>New extended curve result on success, null on failure.</returns>
    public Curve ExtendOnSurface(CurveEnd side, BrepFace face)
    {
      if (face == null) { throw new ArgumentNullException("face"); }

      if (CurveEnd.None == side)
        return null;
      int _side = 0;
      if (CurveEnd.End == side)
        _side = 1;
      else if (CurveEnd.Both == side)
        _side = 2;

      IntPtr pConstCurve = ConstPointer();
      IntPtr pConstFace = face.ConstPointer();

      IntPtr rc = UnsafeNativeMethods.RHC_RhinoExtendCrvOnSrf(pConstCurve, pConstFace, _side);
      return GeometryBase.CreateGeometryHelper(rc, null) as Curve;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Pulls this curve to a brep face and returns the result of that operation.
    /// </summary>
    /// <param name="face">A brep face.</param>
    /// <param name="tolerance">A tolerance value.</param>
    /// <returns>An array containing the resulting curves after pulling. This array could be empty.</returns>
    /// <exception cref="ArgumentNullException">If face is null.</exception>
    public Curve[] PullToBrepFace(BrepFace face, double tolerance)
    {
      if (face == null)
        throw new ArgumentNullException("face");

      IntPtr pConstCurve = ConstPointer();
      IntPtr pConstBrepFace = face.ConstPointer();
      using (Runtime.InteropWrappers.SimpleArrayCurvePointer curves = new SimpleArrayCurvePointer())
      {
        IntPtr pCurves = curves.NonConstPointer();
        UnsafeNativeMethods.RHC_RhinoPullCurveToFace(pConstCurve, pConstBrepFace, pCurves, tolerance);
        return curves.ToNonConstArray();
      }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Intersects a curve with a Brep face.
    /// </summary>
    /// <param name="curve">A curve.</param>
    /// <param name="face">A brep face.</param>
    /// <param name="tolerance">Fitting and near miss tolerance.</param>
    /// <param name="overlapCurves">A overlap curves array argument. This out reference is assigned during the call.</param>
    /// <param name="intersectionPoints">A points array argument. This out reference is assigned during the call.</param>
    /// <returns>true on success, false on failure.</returns>
    public static bool CurveBrepFace(Curve curve, BrepFace face, double tolerance, out Curve[] overlapCurves, out Point3d[] intersectionPoints)
    {
      overlapCurves = new Curve[0];
      intersectionPoints = new Point3d[0];

      Runtime.InteropWrappers.SimpleArrayPoint3d outputPoints = new Runtime.InteropWrappers.SimpleArrayPoint3d();
      IntPtr outputPointsPtr = outputPoints.NonConstPointer();

      Runtime.InteropWrappers.SimpleArrayCurvePointer outputCurves = new Runtime.InteropWrappers.SimpleArrayCurvePointer();
      IntPtr outputCurvesPtr = outputCurves.NonConstPointer();

      IntPtr curvePtr = curve.ConstPointer();
      IntPtr facePtr = face.ConstPointer();

      bool rc = UnsafeNativeMethods.RHC_RhinoCurveFaceIntersect(curvePtr, facePtr, tolerance, outputCurvesPtr, outputPointsPtr);

      if (rc)
      {
        overlapCurves = outputCurves.ToNonConstArray();
        intersectionPoints = outputPoints.ToArray();
      }

      outputPoints.Dispose();
      outputCurves.Dispose();

      return rc;
    }