Grasshopper

algorithmic modeling for Rhino


I am looking for a way to "ExtendCrvOnSrf"
 I've been searching the RhinoCommon SDK, but I can't seem to find it.
Can someone help me ?

thanks

Views: 507

Replies to This Discussion

I'm stuck at a similar road-block.. has it been exposed in RhCommon yet?

I haven't been able to find it.

 

Any of the McNeel SDK people?

It doesn't appear to be anywhere in RhinoCommon, I can add it.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Added ExtendOnSurface() to Rhino.Geometry.Curve.

It works both on Surfaces and BrepFaces.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

That's great.. thanks!

 

Just out of curiosity: so the method already exists in the C++ core, and you just added a .NET 'handle' to it, or do you have to tinker around with C++ too?

In this case the function already existed as a C++ function, but even that requires a modicum of C++ coding. In case you're interested in the specifics, this is what the C# part looks like:

 


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;
}


 

and the C++ portion:

 


RH_C_FUNCTION ON_Curve* RHC_RhinoExtendCrvOnSrf(const ON_Curve* pConstCurve, const ON_BrepFace* pConstFace, int side)
{
  ON_Curve* rc = NULL;

  if( side >= 0 && side <= 2)
  {
    if( pConstCurve && pConstFace )
    {
      ON_Curve* pDuplicateCurve = pConstCurve->DuplicateCurve();
      if( pDuplicateCurve )
      {
        if( !RhinoExtendCrvOnSrf(*pConstFace, pDuplicateCurve, side) )
        {
          delete pDuplicateCurve;
          pDuplicateCurve = NULL;
        }

        rc = pDuplicateCurve;
      }
    }
  }
  return rc;
}


 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Great addition, thanks!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service