Utilities

public static class Utilities

Properties

DefaultRenderPlugInId

#Since v5.3
public static Guid DefaultRenderPlugInId { get; }
Get the plug-in Id for the default render plug-in

ShowIncompatibleEnvironments

#Since v5.3
public static bool ShowIncompatibleEnvironments { get; set; }
Specifies whether incompatible content should be shown in the corresponding editor.

ShowIncompatibleMaterials

#Since v5.3
public static bool ShowIncompatibleMaterials { get; set; }
Specifies whether incompatible content should be shown in the corresponding editor.

ShowIncompatibleTextures

#Since v5.3
public static bool ShowIncompatibleTextures { get; set; }
Specifies whether incompatible content should be shown in the corresponding editor.

Methods

ChangeContentType

#Since v6.0
public static RenderContent ChangeContentType(RenderContent oldContent, Guid newType, bool harvestParameters)
Changes the type of a content. This deletes the content and creates a replacement of the specified type allowing the caller to decide about harvesting.
oldContent (RenderContent)oldContent is the old content which is deleted.
newType (Guid)The type of content to replace pOldContent with.
harvestParameters (bool)Determines whether or not parameter harvesting will be performed.
A new persistent render content.

ExpandEnvVarsInFileName

#Since v9.0
public static string ExpandEnvVarsInFileName(string filename)
filename (string)

FindFile

#Since v6.0
[CLSCompliant(false)] public static string FindFile(RhinoDoc doc, string fullPathToFile, bool unpackFromBitmapTableIfNecessary)
Finds a file and also handles network shares. This is a replacement for CRhinoFileUtilities::FindFile().
doc (RhinoDoc)Document to use for locating .3dm file's folder.
fullPathToFile (string)The file to be found.
unpackFromBitmapTableIfNecessary (bool)True to seasch for the file in the bitmap table and unpack it into the temp folder if not found in the initial search.
The found file.

FindFile

#Since v6.0
[CLSCompliant(false)] public static string FindFile(RhinoDoc doc, string fullPathToFile)
Finds a file and also handles network shares. This is a replacement for CRhinoFileUtilities::FindFile().
doc (RhinoDoc)Document to use for locating .3dm file's folder.
fullPathToFile (string)The file to be found.
The found file.

GetUnpackedFilesCacheFolder

#Since v8.0
public static string GetUnpackedFilesCacheFolder(RhinoDoc doc, bool create)
Gets a folder associated with the document for unpacking textures to
doc (RhinoDoc)The document the folder is associated with
create (bool)If true, this will create a directory if it does not exist
The path to the unpacked files folder
ArgumentNullExceptionWhen doc is null

IsCachedTextureFileInUse

#Since v6.0
public static bool IsCachedTextureFileInUse(string textureFileName)
Determines if any texture in any persistent content list is using the specified file name for caching.
textureFileName (string)The file name to check for. The extension is ignored.
true if the texture is present.

LoadPersistentRenderContentFromFile

#Since v6.0
[CLSCompliant(false)] public static RenderContent LoadPersistentRenderContentFromFile(uint docSerialNumber, string filename)
Loads a content from a library file and adds it to the persistent content list of a particular document.
docSerialNumber (uint)identifies the document into which the content should be loaded.
filename (string)is the full path to the file to be loaded.
The loaded content or null if an error occurred.

MoveWindow

#Since v6.0
public static void MoveWindow(nint hwnd, Rectangle rect, bool bRepaint, bool bRepaintNC)
hwnd (nint)
rect (Rectangle)
bRepaint (bool)
bRepaintNC (bool)

PromptForSaveImageFileParameters

#Since v6.0
public static string PromptForSaveImageFileParameters(string filename, ref int width, ref int height, ref int colorDepth)
Prompts the user for a save file name and the width, height and depth of an image to be saved.
filename (string)The original file path.
width (ref int)A width.
height (ref int)An height.
colorDepth (ref int)A color depth.
The new file name.

SafeFrameEnabled

#Since v6.0
public static bool SafeFrameEnabled(RhinoDoc doc)
Queries whether or not the Safe Frame is visible.
doc (RhinoDoc)

SetDefaultRenderPlugIn

#Since v5.3
public static bool SetDefaultRenderPlugIn(Guid pluginId)
Set default render application
pluginId (Guid)ID of render plug-in
True if plug-in found and loaded successfully. False if pluginId is invalid or was unable to load plug-in

ShowContentChooser

#Since v6.25 Obsolete v7.9
public static Utilities.ShowContentChooserResults ShowContentChooser(Guid defaultType, Guid defaultInstanceId, RenderContentKind kinds, ref Guid instanceIdOut, ShowContentChooserFlags flags, RhinoDoc doc)
obsolete: Use ShowContentNewExistingBrowser() instead
Shows the Content New / Existing Browser to allow the user to select a new or existing content.
defaultType (Guid)
defaultInstanceId (Guid)
kinds (RenderContentKind)
instanceIdOut (ref Guid)
flags (RenderContent.ShowContentChooserFlags)
doc (RhinoDoc)

ShowContentChooser

#Since v7.9 Obsolete v9.0
public static Utilities.ShowContentChooserResults ShowContentChooser(RhinoDoc doc, Guid defaultType, Guid defaultInstanceId, RenderContentKind kinds, ContentChooserFlags flags, string presetCategory, IEnumerable<string> categories, IEnumerable<Guid> types, out Guid[] instanceIdsOut)
obsolete: Use ShowContentNewExistingBrowser() instead
Shows the Content New / Existing Browser to allow the user to select a new or existing content, or multiple contents.
doc (RhinoDoc)
defaultType (Guid)
defaultInstanceId (Guid)
kinds (RenderContentKind)
flags (Utilities.ContentChooserFlags)
presetCategory (string)
categories (IEnumerable<string>)
types (IEnumerable<Guid>)
instanceIdsOut (out Guid[])

ShowContentChooser

#Since v7.6 Obsolete v7.9
public static Utilities.ShowContentChooserResults ShowContentChooser(RhinoDoc doc, Guid defaultType, Guid defaultInstanceId, RenderContentKind kinds, ShowContentChooserFlags flags, string presetCategory, IEnumerable<string> categories, IEnumerable<Guid> types, out Guid[] instanceIdsOut)
obsolete: Use ShowContentNewExistingBrowser() instead
Shows the Content New / Existing Browser to allow the user to select a new or existing content.
doc (RhinoDoc)
defaultType (Guid)
defaultInstanceId (Guid)
kinds (RenderContentKind)
flags (RenderContent.ShowContentChooserFlags)
presetCategory (string)
categories (IEnumerable<string>)
types (IEnumerable<Guid>)
instanceIdsOut (out Guid[])

ShowContentNewExistingBrowser

#Since v9.0
public static Utilities.ContentNewExistingResults ShowContentNewExistingBrowser(RhinoDoc doc, Guid defaultType, Guid defaultInstanceId, RenderContentKind kinds, ContentNewExistingFlags flags, string presetCategory, IEnumerable<string> categories, IEnumerable<Guid> types, out Guid[] contents)
Shows the Content New / Existing Browser to allow the user to select a new or existing content, or multiple contents.
doc (RhinoDoc)A Rhino document.
defaultType (Guid)The content type that will be initially selected in the 'New' tab.
defaultInstanceId (Guid)The content instance that will be initially selected in the 'Existing' tab.
kinds (RenderContentKind)Semicolon-delimited string specifying which content kinds will be displayed.
flags (Utilities.ContentNewExistingFlags)Flags controlling the browser (tabs to hide, type of selection).
presetCategory (string)Specifies the category to preset in the drop-down list on the 'New' tab. If this string is empty, the preset category will be 'All'.
categories (IEnumerable<string>)Specifies the categories to display. Render contents that do not belong to one of these categories will not be listed. If this array is empty, all render contents from all categories will be listed.
types (IEnumerable<Guid>)Specifies content types to display. Contents that are not one of these types will not be listed. If this array is empty, all content types will be listed.
contents (out Guid[])Array of Guid(s) of the chosen item(s). Depending on the result, this can accept type id(s) of content type(s) or instance id(s) of existing content(s).
The result of displaying the browser.

ShowIORMenu

#Since v6.0
public static bool ShowIORMenu(nint hwnd, Point pt, ref double outIOR, ref string outString)
Display and track the context menu.
hwnd (nint)The window that displays the menu, for example an edit box.
pt (Point)The position to display the menu at inside the window
outIOR (ref double)Accepts the IOR value of the user's chosen substance
outString (ref string)Accepts the name of the user's chosen substance. Can be null if not required.
true if the function showed the IOR menu and something was picked.