Rhino.LastCreatedObjects to return a string?

This is not working because in VB.net the return of the command is not an Array.

Hi Dale,

Is there any complete reference guide for Rhino.NET SDK like we have for RhinoScript ??

This shows Error : Error 2 Implicit conversion from ‘Object’ to ‘System.Collections.IEnumerable’.

The help file for the old .NET SDK is in the zip archive below.

RhinoDotNetSDK_20080927.zip (19.6 MB)

And this is the link to some information on the old .NET SDK.

http://wiki.mcneel.com/developer/dotnetplugins

Like I said, this works.

Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result

  Dim rs As RhinoScript4.IRhinoScript = RhinoApp.GetPlugInObject("RhinoScript")
  If rs Is Nothing Then
    Return Result.Failure
  End If

  rs.Command("_Line 0,0,0 1,1,0", 1)

  Dim results = rs.LastCreatedObjects()
  If IsArray(results) Then
    For Each res As Object In results
      If res IsNot Nothing Then
        Dim str = TryCast(res, String)
        If str IsNot Nothing Then
          RhinoApp.WriteLine(str)
        End If
      End If
    Next
  End If

  Return Result.Success

End Function

Sorry, don’t know how else to help.

Hi Dale,

When i tried to get the RhinoScript object using your method, i dont gent the RhinoApp.GetPluginObject command
It shows RhinoApp.GetPluginObjectInterface
It gives me Error : GetPlugInObject’ is not a member of 'RMA.Rhino.MRhinoApp

Do i have to add any reference to project ??

take a look at the image posted

If you want your project to work (like my command), then you will need to add a reference to the RhinoScript type library (RhinoScript.tlb) to your project.

Yes Dale. I have added the RhinoScript.tlb to my project… but then also i am not getting option GetPluginObject.

Hi Dale,

Found the solution :wink:

Here is the code :

    Dim LastObj As Object
    LastObj = RScript.LastCreatedObjects()
    Dim tempArray = CType(LastObj, System.Collections.IEnumerable)
    For Each OB In tempArray
        RScript.ObjectLayer(OB, "Layer 05")
    Next