Site Tools


Un-tag an object as a Flamingo nXt Plant

Developer: FlamingoScript
Summary: Demonstrates how to un-tag an object as a Flamingo nXt plant.

Question

I am trying to figure out how to un-tag an object as a Flamingo nXt plant. What can I do?

Answer

The following are examples of how to un-tag an object as a Flamingo nXt plant.

RhinoScript

Option Explicit
 
Call Main()
 
Sub Main()
	Dim objPlugIn, strObject, plant
	On Error Resume Next
	Set objPlugIn = Rhino.GetPluginObject("8008880f-8d13-4b2d-92b0-727e12878a4c")
	If Err Then
		MsgBox Err.Description
		Exit Sub
	End If
	strObject = Rhino.GetObject("Select object")
  If Not IsNull(strObject) And Not strObject = "" Then
		If objPlugIn.UnTagObjectAsPlant(strObject) Then
      Rhino.Print("Plant tags removed from object")
    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
# 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 UnTagObjectAsPlant():
    """ Removes plant information associated with an object """
    # Prompt user to select oject to assign material to
    objID = rs.GetObject("Object to tag as plant")
    # Attempt to remove the plant tag from the specified object
    if flSDK.UnTagObjectAsPlant(objID):
        print "Plant tags removed from object"
 
if __name__=="__main__":
    UnTagObjectAsPlant()

C#

using System;
 
using Rhino;
using Rhino.DocObjects;
using Rhino.Input;
using Rhino.Commands;
 
using FlamingoNXtSDK;
 
partial class Examples
{
  public static Result UnTagObjectAsPlant(RhinoDoc doc, Rhino.Commands.RunMode mode)
  {
    SDK sdk = SDK.FlamingoSDK;
    if (null == sdk)
      return Rhino.Commands.Result.Failure;
    string matName = string.Empty;
    Guid matGuid = Guid.Empty;
    if (!sdk.ModalMaterialBrowser(Rhino.RhinoApp.MainWindow(), out matName, out matGuid))
      return Rhino.Commands.Result.Cancel;
    ObjRef objRef = null;
    Result result = RhinoGet.GetOneObject("Select object", false, ObjectType.None, out objRef);
    if (result != Result.Success)
      return result;
    if (sdk.UnTagObjectAsPlant(objRef.ObjectId))
      RhinoApp.WriteLine("Object no longer tagged as a plant");
    else
      RhinoApp.WriteLine("Error removing plant tag");
    return Result.Success;
  }
}
flamingo/flamingosdk/untagobjectasplant.txt · Last modified: 2012/04/20 by johnm