Developer: FlamingoScript
Summary: Demonstrates how to generate a wire-frame representation of a Flamingo 2.0 plant.
I am trying to figure out how to get wire-frame representation of a Flamingo 2.0 plant. What can I do?
The following are examples of how to generate a wire-frame representation from a Flamingo 2.0 plant.
RhinoScript
Option Explicit Call Main() Sub Main() Dim objPlugIn, plant, lines, line, i, count 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 lines = objPlugIn.GetFlamingo2PlantWireframe(plant(0), plant(1), plant(2)) If Not IsNull(lines) Then count = UBound(lines) If count > 0 Then For i = 0 to count Rhino.Print("Line " & (i + 1) & " of " & (count + 1)) Rhino.AddLine Array(lines(i,0), lines(i,1), lines(i,2)), Array(lines(i,3), lines(i,4), lines(i,5)) Next Rhino.Redraw() End If End If End If Set objPlugIn = Nothing End Sub
Python
import clr # Load the Flamingo nXt SDK DLL clr.AddReference("FlamingoNXtSDK") import FlamingoNXtSDK import rhinoscriptsyntax as rs 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 Flamingo2PlantWireframe(): plantLib = GetSticky("LegacyPlantLib") plantFolder = GetSticky("LegacyPlantFolder") plantName = GetSticky("LegacyPlantName") result, plantLib, plantFolder, plantName = flSDK.ModalFlamingo2PlantBrowser(None, plantLib, plantFolder, plantName) lines = flSDK.GetFlamingo2PlantWireframe(plantLib, plantFolder, plantName) if not lines: return for line in lines: start = rs.coerce3dpoint((line.Start.X, line.Start.Y, line.Start.Z)) end = rs.coerce3dpoint((line.End.X, line.End.Y, line.End.Z)) scriptcontext.doc.Objects.AddLine(start, end) scriptcontext.doc.Views.Redraw() if __name__=="__main__": Flamingo2PlantWireframe()
C#
using System; using Rhino; using Rhino.Geometry; using Rhino.Commands; using FlamingoNXtSDK; partial class Examples { public static Result Flamingo2PlantWireframe(RhinoDoc doc, Rhino.Commands.RunMode mode) { SDK sdk = SDK.FlamingoSDK; if (null == sdk) return Rhino.Commands.Result.Failure; Result result = Examples.GetFlamingo2Plant(doc, mode); if (result == Result.Success) { FlamingoNXtSDK.Line3D[] lineList = sdk.GetFlamingo2PlantWireframe(m_PlantLibrary, m_PlantFolder, m_PlantName); if (null != lineList && lineList.Length > 0) { foreach (FlamingoNXtSDK.Line3D line in lineList) { Point3d startPoint = new Point3d(line.Start.X, line.Start.Y, line.Start.Z); Point3d endPoint = new Point3d(line.End.X, line.End.Y, line.End.Z); doc.Objects.AddLine(startPoint, endPoint); } doc.Views.Redraw(); } else result = Result.Failure; } return result; } }