Utilities

public static class Utilities

Properties

DefaultRenderPlugInId

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

ShowIncompatibleEnvironments

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

ShowIncompatibleMaterials

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

ShowIncompatibleTextures

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

Methods

ChangeContentType

#Since v6.0
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.
public static RenderContent ChangeContentType(
oldContent,
oldContent is the old content which is deleted.
newType,
The type of content to replace pOldContent with.
harvestParameters
Determines whether or not parameter harvesting will be performed.
)
A new persistent render content.

ExpandEnvVarsInFileName

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

FindFile

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

GetUnpackedFilesCacheFolder

#Since v8.0
Gets a folder associated with the document for unpacking textures to
public static string GetUnpackedFilesCacheFolder(
doc,
The document the folder is associated with
create
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
Determines if any texture in any persistent content list is using the specified file name for caching.
public static bool IsCachedTextureFileInUse(
textureFileName
The file name to check for. The extension is ignored.
)
true if the texture is present.

LoadPersistentRenderContentFromFile

#Since v6.0
Loads a content from a library file and adds it to the persistent content list of a particular document.
[CLSCompliant(false)] public static RenderContent LoadPersistentRenderContentFromFile(
docSerialNumber,
identifies the document into which the content should be loaded.
filename
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,
rect,
bRepaint,
bRepaintNC
)

PromptForSaveImageFileParameters

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

SafeFrameEnabled

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

SetDefaultRenderPlugIn

#Since v5.3
Set default render application
public static bool SetDefaultRenderPlugIn(
pluginId
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
Shows the Content New / Existing Browser to allow the user to select a new or existing content.
public static Utilities.ShowContentChooserResults ShowContentChooser(
defaultType,
defaultInstanceId,
kinds,
ref Guid
instanceIdOut,
flags,
doc
)
obsolete: Use ShowContentNewExistingBrowser() instead

ShowContentChooser

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

ShowContentChooser

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

ShowContentNewExistingBrowser

#Since v9.0
Shows the Content New / Existing Browser to allow the user to select a new or existing content, or multiple contents.
public static Utilities.ContentNewExistingResults ShowContentNewExistingBrowser(
doc,
A Rhino document.
defaultType,
The content type that will be initially selected in the 'New' tab.
defaultInstanceId,
The content instance that will be initially selected in the 'Existing' tab.
kinds,
Semicolon-delimited string specifying which content kinds will be displayed.
flags,
Flags controlling the browser (tabs to hide, type of selection).
presetCategory,
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,
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,
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.
out Guid[]
contents
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
Display and track the context menu.
public static bool ShowIORMenu(
nint
hwnd,
The window that displays the menu, for example an edit box.
pt,
The position to display the menu at inside the window
ref double
outIOR,
Accepts the IOR value of the user's chosen substance
ref string
outString
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.