Developer: FlamingoScript
Summary: Demonstrates how to display the Flamingo nXt legacy plant browser.
I am trying to figure out how to display the Flamingo 2.0 legacy plant browser so a user can choose a plant. What can I do?
The following are examples of how to display the Flamingo 2.0 legacy plant browser so a user can choose a plant
RhinoScript
Option Explicit Call Main() Sub Main() Dim objPlugIn, plant On Error Resume Next Set objPlugIn = Rhino.GetPluginObject("8008880f-8d13-4b2d-92b0-727e12878a4c") If Err Then MsgBox Err.Description Exit Sub End If plant = objPlugIn.ModalFlamingo2PlantBrowser("", "", "") If Not IsNull(plant) Then Rhino.Print("Library(" & plant(0) & ") Folder(" & plant(1) & ") Plant(" & plant(2) & ")") End If Set objPlugIn = Nothing End Sub
Python
import clr # Load the Flamingo nXt SDK DLL clr.AddReference("FlamingoNXtSDK") import FlamingoNXtSDK import scriptcontext # Get the Flamingo nXt plug-in's SDK implimentaion, this will force the # plug-in to load if it is not currently loaded flSDK = FlamingoNXtSDK.SDK.FlamingoSDK def GetSticky(name, default = ""): if scriptcontext.sticky.has_key(name): return scriptcontext.sticky[name] return default def GetLegacyPlantPath(): plantLib = GetSticky("LegacyPlantLib") plantFolder = GetSticky("LegacyPlantFolder") plantName = GetSticky("LegacyPlantName") result, plantLib, plantFolder, plantName = flSDK.ModalFlamingo2PlantBrowser(None, plantLib, plantFolder, plantName) if not result: return scriptcontext.sticky["LegacyPlantLib"] = plantLib scriptcontext.sticky["LegacyPlantFolder"] = plantFolder scriptcontext.sticky["LegacyPlantName"] = plantName return plantLib, plantFolder, plantName if __name__=="__main__": GetLegacyPlantPath()
C#
using System; using System.IO; using Rhino; using Rhino.Commands; using FlamingoNXtSDK; partial class Examples { static string m_PlantLibrary; static string m_PlantFolder; static string m_PlantName; public static Result GetFlamingo2Plant(RhinoDoc doc, Rhino.Commands.RunMode mode) { SDK sdk = SDK.FlamingoSDK; if (null == sdk) return Rhino.Commands.Result.Failure; Result result = Result.Cancel; if (sdk.ModalFlamingo2PlantBrowser(null, ref m_PlantLibrary, ref m_PlantFolder, ref m_PlantName)) { RhinoApp.WriteLine("Plant name: \"" + m_PlantLibrary + Path.DirectorySeparatorChar + (string.IsNullOrWhiteSpace(m_PlantFolder) ? "" : m_PlantFolder + Path.DirectorySeparatorChar) + m_PlantName + "\""); result = Result.Success; } return result; } }