Example #1
0
    /// <summary>
    /// Search the plug-in's dictionary for the specified plug-in and if it is
    /// not found then add it to the dictionary.
    /// </summary>
    /// <param name="plugIn"></param>
    /// <returns></returns>
    internal static RdkPlugIn GetRdkPlugIn(PlugIns.PlugIn plugIn)
    {
        var found = FromRhinoPlugIn(plugIn);

        if (null != found)
        {
            return(found);
        }
        var plugin_pointer = plugIn.NonConstPointer();

        return(AddPlugInToDictionary(plugin_pointer, plugIn.Id, plugIn.m_runtime_serial_number));
    }
Example #2
0
        /*
         *  public static Pixel.Rhino.Geometry.Curve TryCopyFromOnCurve(object source)
         *  {
         *    if (source != null)
         *    {
         *      try
         *      {
         *        Type base_type = Type.GetType("RMA.OpenNURBS.OnCurve");
         *        System.Type t = source.GetType();
         *        if (t.IsAssignableFrom(base_type))
         *        {
         *          System.Reflection.PropertyInfo pi = t.GetProperty("InternalPointer");
         *          IntPtr ptr = (IntPtr)pi.GetValue(source, null);
         *          Pixel.Rhino.Geometry.Curve crv = Pixel.Rhino.Geometry.Curve.CreateCurveHelper(ptr, null);
         *          crv.NonConstPointer();
         *          return crv;
         *        }
         *      }
         *      catch (Exception)
         *      {
         *      }
         *    }
         *    return null;
         *  }
         *
         *  /// <summary>
         *  /// Do not hold on to the returned class outside the scope of your current function.
         *  /// </summary>
         *  /// <param name="source">-</param>
         *  /// <returns>-</returns>
         *  public static Pixel.Rhino.Display.DisplayPipeline ConvertFromMRhinoDisplayPipeline(object source)
         *  {
         *    if (source != null)
         *    {
         *      try
         *      {
         *        Type base_type = Type.GetType("RMA.Pixel.Rhino.MRhinoDisplayPipeline");
         *        System.Type t = source.GetType();
         *        if (t.IsAssignableFrom(base_type))
         *        {
         *          System.Reflection.PropertyInfo pi = t.GetProperty("InternalPointer");
         *          IntPtr ptr = (IntPtr)pi.GetValue(source, null);
         *          return new Pixel.Rhino.Display.DisplayPipeline(ptr);
         *        }
         *      }
         *      catch (Exception)
         *      {
         *      }
         *    }
         *    return null;
         *  }
         */
#if RHINO_SDK
        /// <summary>
        /// Gets a C++ plug-in pointer for a given RhinoCommon plug-in.
        /// <para>This is a Rhino SDK function.</para>
        /// </summary>
        /// <param name="plugin">A plug-in.</param>
        /// <returns>A pointer.</returns>
        /// <since>5.0</since>
        public static IntPtr PlugInPointer(PlugIns.PlugIn plugin)
        {
            return(null == plugin ? IntPtr.Zero : plugin.NonConstPointer());
        }