Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

developer:sdksamples:extendrhinoscript [2015/09/14]
127.0.0.1 external edit
developer:sdksamples:extendrhinoscript [2015/12/04] (current)
sandy
Line 1: Line 1:
-====== How to extend ​RhinoScript with a .NET plug-in ======+====== How to Extend ​RhinoScript with a .NET Plug-in ======
  
-> **Summary:​** //Rhino 4.0 plug-ins can now add new scripting methods to [[developer:​rhinoscript|RhinoScript]].//+> **Summary:​** //Rhino 4.0 plug-ins can now add new scripting methods to [[developer:​rhinoscript|RhinoScript]]//​
  
 Rhino 4.0 plug-ins can extend the [[developer:​rhinoscript|RhinoScript]] with new objects and methods to permit users to create elaborate scripts for plug-ins. The Rhino plug-in class has a virtual function named **GetPlugInObjectInterface** which plug-ins can override and return a COM enabled class. In .NET creating a COM enabled class is as easy as adding a **ComVisible** attribute to a class. Rhino 4.0 plug-ins can extend the [[developer:​rhinoscript|RhinoScript]] with new objects and methods to permit users to create elaborate scripts for plug-ins. The Rhino plug-in class has a virtual function named **GetPlugInObjectInterface** which plug-ins can override and return a COM enabled class. In .NET creating a COM enabled class is as easy as adding a **ComVisible** attribute to a class.
  
 ===== VB.NET ===== ===== VB.NET =====
-By adding the ComVisible attribute to a class, all of the public functions inside of the class are accessible to COM (ie RhinoScript)+By adding the ComVisible attribute to a class, all the public functions inside of the class are accessible to COM (ie RhinoScript).
 <code vb> <code vb>
    <​System.Runtime.InteropServices.ComVisible(True)>​ _    <​System.Runtime.InteropServices.ComVisible(True)>​ _
Line 20: Line 20:
 End Class End Class
 </​code>​ </​code>​
-2. Override GetPlugInObjectInterface and return the com class+ 
 +Override GetPlugInObjectInterface and return the com class.
 <code vb> <code vb>
 '​inside of your MRhinoPlugIn derived class '​inside of your MRhinoPlugIn derived class
Line 27: Line 28:
 End Function End Function
 </​code>​ </​code>​
-Read below on how to use your class in [[developer:​rhinoscript|RhinoScript]]+Read below on how to use your class in [[developer:​rhinoscript|RhinoScript]].
  
 ===== C# ===== ===== C# =====
-By adding the ComVisible attribute to a class, all of the public functions inside of the class are accessible to COM (ie RhinoScript)+By adding the ComVisible attribute to a class, all the public functions inside of the class are accessible to COM (i.e. RhinoScript).
  
 <code c#> <code c#>
Line 48: Line 49:
 } }
 </​code>​ </​code>​
-2. Override GetPlugInObjectInterface and return the com class+Override GetPlugInObjectInterface and return the com class.
  
 <code c#> <code c#>
Line 60: Line 61:
 Inside of a [[developer:​rhinoscript|RhinoScript]] routine get a hold of your plug-in'​s script class and have fun! Inside of a [[developer:​rhinoscript|RhinoScript]] routine get a hold of your plug-in'​s script class and have fun!
  
-The following is some sample [[developer:​rhinoscript|RhinoScript]]. **Assuming ​that your plug-in is named WikiSamples**+The following is some sample [[developer:​rhinoscript|RhinoScript]]. **It assumes ​that your plug-in is named WikiSamples.**
  
 <code vb> <code vb>
developer/sdksamples/extendrhinoscript.txt · Last modified: 2015/12/04 by sandy