Extend Ironpython with a .NET plug-in


#1

Hi all

I found this page on the rhino wiki a while ago:
Extend RhinoScript with a .NET plug-in
http://wiki.mcneel.com/developer/sdksamples/extendrhinoscriptpython

To call the new method there is an example for vbs:

Dim customobj
On Error Resume Next
Set customobj = Rhino.GetPlugInObject("WikiSamples")
If Err Then
  MsgBox Err.Description
Else
  customobj.Print
  customobj.MakePoint 1,2,3
  Rhino.Redraw
End If

What would be the equivalent approach to access the new method in rhino python? Thanks!

M


(Dale Fugier) #2

Hi Manuel,

What do you want to extend Python with? Python scripts have full access to the .NET Framework and RhinoCommon - I can’t imagine what you need that this does not provide…


#3

Thanks Dale

You are right but in my case I would like to provide accessibility to some functions I already implemented in my c# plug-in. Basically to provide access to some features of my plug-in for more experienced users to automate a certain user-defined workflow. It works for rhinoscript-users so I am just interested if this can be accessed through python as well. I think I even saw this once but I cannot find the source anymore.

Best
M


(Steve Baer) #4

Here’s a sample using Grasshopper as the plug-in

import Rhino

gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")
functions = dir(gh)
for function in functions:
    #skip internal names
    if function.startswith("__"): continue
    print function
    
#Call a function in the plug-in
gh.ShowEditor()

#5

Thanks Steve!