RhinoDoc

References
public sealed class RhinoDoc : IDisposable
Represents an active model.

Finalizer

~RhinoDoc

#
~RhinoDoc()

Properties

ActiveCommandId

#Since v8.0
Get the ID of the active command.
public Guid ActiveCommandId { get; }

ActiveDoc

#Since v5.0
WARNING!! Do not use the ActiveDoc if you don't have to. Under Mac Rhino the ActiveDoc can change while a command is running. Use the doc that is passed to you in your RunCommand function or continue to use the same doc after the first call to ActiveDoc.
public static RhinoDoc ActiveDoc { get; set; }

ActiveSpace

#Since v8.0
Get the space associated with the active viewport for this document
public ActiveSpace ActiveSpace { get; }

AnimationProperties

#Since v6.11
public AnimationProperties AnimationProperties { get; set; }

Bitmaps

#Since v5.0
bitmaps used in textures, backgrounds, wallpapers, ...
public BitmapTable Bitmaps { get; }

CurrentEnvironment

#Since v6.0
Access to the current environment for various uses
obsoletePlease use Rhino.Render.RenderSettings methods

CurrentUndoRecordDescription

#Since v9.0
The description of the undo record currently being recorded, as shown in Undo, Redo, and UndoMultiple. If no description has been set, this is the name of the command that owns the record. Null if undo recording is not active.
public string CurrentUndoRecordDescription { get; }

CurrentUndoRecordSerialNumber

#Since v6.0
>0: undo recording is active and being saved on the undo record with the specified serial number. 0: undo recording is not active. (Disabled or nothing is being recorded.)
[CLSCompliant(false)] public uint CurrentUndoRecordSerialNumber { get; }

CustomRenderSizes

#Since v6.0
public List<Size> CustomRenderSizes { get; }

DateCreated

#Since v5.0
public DateTime DateCreated { get; }

DateLastEdited

#Since v5.0
Returns the date the document was created in Coordinated Universal Time (UTC). Use DateTime.ToLocalTime to convert to local time.
public DateTime DateLastEdited { get; }

DimStyles

#ExampleSince v5.0
public DimStyleTable DimStyles { get; }

DistanceDisplayPrecision

#Since v5.0 Obsolete v9.0
[DebuggerBrowsable(DebuggerBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)] public int DistanceDisplayPrecision { get; }
obsolete. Use ModelDistanceDisplayPrecision instead.

DocumentId

#Since v5.0
Gets the Document Id.
[Browsable(false)] [DebuggerBrowsable(DebuggerBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)] public int DocumentId { get; }
obsoleteUse RuntimeSerialNumber instead

EarthAnchorPoint

#Since v5.0
public EarthAnchorPoint EarthAnchorPoint { get; set; }

Fonts

#Since v5.0
[EditorBrowsable(EditorBrowsableState.Never)] public FontTable Fonts { get; }
obsoleteUse DimStyles table instead

GroundPlane

#Since v5.0 Obsolete v8.0
Gets the ground plane of this document.
[DebuggerBrowsable(DebuggerBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)] public GroundPlane GroundPlane { get; }
RdkNotLoadedExceptionIf the RDK is not loaded.

Groups

#ExampleSince v5.0
public GroupTable Groups { get; }

HatchPatterns

#ExampleSince v5.0
public HatchPatternTable HatchPatterns { get; }

InGetPoint

#Since v8.5
Returns true if currently in a GetPoint.Get().
public bool InGetPoint { get; }

InstanceDefinitions

#ExampleSince v5.0
public InstanceDefinitionTable InstanceDefinitions { get; }

IsAvailable

#Since v6.0
public bool IsAvailable { get; }

IsClosing

#Since v6.0
public bool IsClosing { get; }

IsCommandRunning

#Since v7.0
Returns true if Rhino is currently running a command.
public bool IsCommandRunning { get; }

IsCreating

#Since v6.0
public bool IsCreating { get; }

IsHeadless

#Since v7.0
public bool IsHeadless { get; }

IsInitializing

#Since v6.0
public bool IsInitializing { get; }

IsLocked

#Since v5.0
Check to see if the file associated with this document is locked. If it is locked then this is the only document that will be able to write the file. Other instances of Rhino will fail to write this document.
public bool IsLocked { get; }

IsOpening

#Since v6.0
public bool IsOpening { get; }

IsReadOnly

#Since v5.0
Current read-only mode for this document. true if the document can be viewed but NOT saved. false if document can be viewed and saved.
public bool IsReadOnly { get; }

IsSendingMail

#Since v5.0
true if Rhino is in the process of sending this document as an email attachment.
public bool IsSendingMail { get; }

Layers

#Since v5.0
Layers in the document.
public LayerTable Layers { get; }

LayoutSpaceAnnotationScalingEnabled

#Since v6.0
If LayoutSpaceAnnotationScaling is on, sizes in dimstyles are multiplied by dimscale when the annotation is displayed in a detail viewport not in a detail
public bool LayoutSpaceAnnotationScalingEnabled { get; set; }

Lights

#Since v5.0
public LightTable Lights { get; }

Linetypes

#Since v5.0
Linetypes in the document.
public LinetypeTable Linetypes { get; }

LinkedInstanceDefinitionUpdate

#Since v8.29
Controls if, when, and how linked and linked and embedded instance definitions are updated when the source archive that was used to create the instance definition has changed.
public LinkedInstanceDefinitionUpdateStyle LinkedInstanceDefinitionUpdate { get; set; }

Manifest

#Since v6.0
public ManifestTable Manifest { get; }

MarkupMode

#Since v9.0
The markup mode this document is currently in: creating, viewing or editing a markup, or MarkupMode.None when not in markup mode. MarkupViewChanged reports changes to this value.
public MarkupMode MarkupMode { get; }

Markups

#Since v9.0
Collection of markups in this document
public MarkupTable Markups { get; }

Materials

#Since v5.0
Materials in the document.
public MaterialTable Materials { get; }

MeshingParameterStyle

#Since v5.1
Type of MeshingParameters currently used by the document to mesh objects
public MeshingParameterStyle MeshingParameterStyle { get; set; }

ModelAbsoluteTolerance

#Since v5.0
Model space absolute tolerance.
public double ModelAbsoluteTolerance { get; set; }

ModelAngleToleranceDegrees

#Since v5.0
Model space angle tolerance.
public double ModelAngleToleranceDegrees { get; set; }

ModelAngleToleranceRadians

#Since v5.0
Model space angle tolerance.
public double ModelAngleToleranceRadians { get; set; }

ModelBasepoint

#Since v6.10
The base point in the model that is used when inserting the model into another as a block definition. By default the base point in any model is 0,0,0.
public Point3d ModelBasepoint { get; set; }

ModelDistanceDisplayMode

#Since v8.0
Gets/Sets the distance display mode for model space.
public DistanceDisplayMode ModelDistanceDisplayMode { get; set; }

ModelDistanceDisplayPrecision

#ExampleSince v5.8
public int ModelDistanceDisplayPrecision { get; set; }

ModelRelativeTolerance

#Since v5.0
Model space relative tolerance.
public double ModelRelativeTolerance { get; set; }

ModelSpaceAnnotationScalingEnabled

#Since v6.0
If ModelSpaceAnnotationScaling is on, sizes in dimstyles are multiplied by dimscale when the annotation is displayed in a model space viewport not in a detail
public bool ModelSpaceAnnotationScalingEnabled { get; set; }

ModelSpaceHatchScale

#Since v6.1
The scale factor for hatches in model space when Hatch Scaling is enabled
public double ModelSpaceHatchScale { get; set; }

ModelSpaceHatchScalingEnabled

#Since v6.16
True if hatch scaling is enabled, false if not.
public bool ModelSpaceHatchScalingEnabled { get; set; }

ModelSpaceTextScale

#Since v6.1
The scale factor for text in model space when Annotation Scaling is enabled
public double ModelSpaceTextScale { get; set; }

ModelUnits

#Since v9.0
Length unit used on model space.
public LengthUnit ModelUnits { get; set; }

ModelUnitSystem

#Since v5.0
public UnitSystem ModelUnitSystem { get; set; }

ModelUrl

#Since v9.0
Gets and sets the link address, or URL, for the model.
public string ModelUrl { get; set; }

Modified

#Since v5.0
Returns or sets the document's modified flag.
public bool Modified { get; set; }

Name

#Since v5.0
Returns the name of the currently loaded Rhino document (3DM file).
public string Name { get; }

NamedConstructionPlanes

#Since v5.0
Collection of named construction planes.
public NamedConstructionPlaneTable NamedConstructionPlanes { get; }

NamedLayerStates

#Since v6.14
Collection of named layer states.
public NamedLayerStateTable NamedLayerStates { get; }

NamedPositions

#Since v6.0
Collection of named positions.
public NamedPositionTable NamedPositions { get; }

NamedViews

#ExampleSince v5.0
Collection of named views.
public NamedViewTable NamedViews { get; }

NextUndoRecordSerialNumber

#Since v6.0
The serial number that will be assigned to the next undo record that is constructed.
[CLSCompliant(false)] public uint NextUndoRecordSerialNumber { get; }

Notes

#Since v5.0
Returns or sets the document's notes.
public string Notes { get; set; }

NotesLocked

#Since v8.6
public bool NotesLocked { get; set; }

Objects

#Since v5.0
public ObjectTable Objects { get; }

PageAbsoluteTolerance

#Since v5.0
Page space absolute tolerance.
public double PageAbsoluteTolerance { get; set; }

PageAngleToleranceDegrees

#Since v5.0
Page space angle tolerance.
public double PageAngleToleranceDegrees { get; set; }

PageAngleToleranceRadians

#Since v5.0
Page space angle tolerance.
public double PageAngleToleranceRadians { get; set; }

PageDistanceDisplayMode

#Since v8.0
Gets/Sets the distance display mode for page space.
public DistanceDisplayMode PageDistanceDisplayMode { get; set; }

PageDistanceDisplayPrecision

#Since v5.8
public int PageDistanceDisplayPrecision { get; set; }

PageRelativeTolerance

#Since v5.0
Page space relative tolerance.
public double PageRelativeTolerance { get; set; }

PageUnits

#Since v9.0
Length unit used on page space geometry.
public LengthUnit PageUnits { get; set; }

PageUnitSystem

#Since v5.0
public UnitSystem PageUnitSystem { get; set; }

PageViewGroups

#Since v9.0
Collection of markups in this document
public PageViewGroupTable PageViewGroups { get; }

Path

#Since v5.0
Returns the path of the currently loaded Rhino document (3DM file).
public string Path { get; }

PostEffects

#Since v7.0
Access to the post effects
obsoletePlease use Rhino.Render.RenderSettings methods

RedoActive

#Since v6.0
Returns true if Redo is currently active.
public bool RedoActive { get; }

RenderEnvironments

#Since v5.7
public RenderEnvironmentTable RenderEnvironments { get; }

RenderMaterials

#Since v5.7
public RenderMaterialTable RenderMaterials { get; }

RenderSettings

#Since v5.0
public RenderSettings RenderSettings { get; set; }

RenderTextures

#Since v5.7
public RenderTextureTable RenderTextures { get; }

RuntimeData

#Since v6.3
Collection of document runtime data. This is a good place to put non-serializable, per document data, such as panel view models. Note well: This data will be dispose with the document and does not get serialized.
public RuntimeDocumentDataTable RuntimeData { get; }
The runtime document data table.

RuntimeSerialNumber

#Since v6.0
Unique serialNumber for the document while the application is running. This is not a persistent value.
[CLSCompliant(false)] public uint RuntimeSerialNumber { get; }

SectionStyles

#Since v9.0
Collection of section styles in this document
public SectionStyleTable SectionStyles { get; }

Snapshots

#Since v6.7
Collection of snapshots.
public SnapshotTable Snapshots { get; }

Strings

#Since v5.0
Collection of document user data strings in this document
public StringTable Strings { get; }

SubDAppearance

#Since v7.5
Returns or sets the appearance of all SubD objects in the document.
public SubDComponentLocation SubDAppearance { get; set; }
Remarks: When setting this property, if the document contains SubD objects, then the document will be redrawn automatically.

TemplateFileUsed

#Since v5.0
name of the template file used to create this document. This is a runtime value only present if the document was newly created.
public string TemplateFileUsed { get; }

UndoActive

#Since v6.0
Returns true if Undo is currently active.
public bool UndoActive { get; }

UndoRecordingEnabled

#Since v5.0
public bool UndoRecordingEnabled { get; set; }

UndoRecordingIsActive

#Since v5.0
true if undo recording is actually happening now.
public bool UndoRecordingIsActive { get; }

Views

#Since v5.0
public ViewTable Views { get; }

ViewUserInterface

#Since v9.0
public ViewUserInterfaceTable ViewUserInterface { get; }

Worksession

#Since v6.0
Provides access to the document's worksession.
public Worksession Worksession { get; }

Methods

AddCustomUndoEvent

#ExampleSince v5.0
Add a custom undo event so you can undo private plug-in data when the user performs an undo or redo
public bool AddCustomUndoEvent()

AddCustomUndoEvent

#Since v5.0
public bool AddCustomUndoEvent()

AdjustLengthUnits

#Since v9.0
public bool AdjustLengthUnits(
modelUnits,
units,
scale
)

AdjustModelUnitSystem

#Since v5.0
public void AdjustModelUnitSystem(
newUnitSystem,
scale
)

AdjustPageUnitSystem

#Since v5.0
public void AdjustPageUnitSystem(
newUnitSystem,
scale
)

Audit

#Since v8.19
Audits the contents of the document.
public bool Audit(
textLog,
If an error is detected, then a description of the error is logged here.
attemptRepair
If true, then the method attempts to repair any detected errors.
)
True if document is valid.

BeginUndoRecord

#Since v5.0
Instructs Rhino to begin recording undo information when the document is changed outside of a command. We use this, e.g., to save changes caused by the modeless layer or object properties dialogs when commands are not running.
[CLSCompliant(false)] public uint BeginUndoRecord(
description
A text describing the record.
)
Serial number of record. Returns 0 if record is not started because undo information is already being recorded or undo is disabled.

ClearRedoRecords

#Since v5.0
public void ClearRedoRecords()

ClearUndoRecords

#Since v5.0
public void ClearUndoRecords(
purgeDeletedObjects
)

ClearUndoRecords

#Since v6.0
[CLSCompliant(false)] public void ClearUndoRecords(
undoSerialNumber,
purgeDeletedObjects
)

Create

#Since v6.4
Creates a new RhinoDoc
public static RhinoDoc Create(
modelTemplateFileName
Name of a Rhino model to use as a template to initialize the document. If the template contains views, those views are created. If null, an empty document with no views is created
)

CreateDefaultAttributes

#ExampleSince v5.0
Gets the default object attributes for this document. The attributes will be linked to the currently active layer and they will inherit the Document WireDensity setting.
public ObjectAttributes CreateDefaultAttributes()

CreateHeadless

#Since v7.0
Create a new headless RhinoDoc from a template file
public static RhinoDoc CreateHeadless(
file3dmTemplatePath
Name of a Rhino model to use as a template to initialize the document. If null, an empty document is created
)
New RhinoDoc on success. Note that this is a "headless" RhinoDoc and it's lifetime is under your control.

CustomRenderMeshesBoundingBox

#Since v8.0
Returns the bounding box of custom render primitives for this object .
public bool CustomRenderMeshesBoundingBox(
mt,
The mesh type requested (render or analysis).
vp,
The viewport being rendered
ref Flags
flags,
See RenderMeshProvider.Flags. This is an in/out parameter: on return it also carries any status flags - including RenderMeshProvider.Flags.Incomplete when an asynchronous provider has not finished - so reset it before each call and test it afterwards.
plugin,
The requesting plug-in (typically the calling plugin)
attrs,
Display attributes for the caller - null if this is a full rendering.
boundingBox
The requested bounding box
)
True if the process was a success

Dispose

#Since v7.0
public void Dispose()

EndUndoRecord

#Since v5.0
Ends the undo record.
[CLSCompliant(false)] public bool EndUndoRecord(
undoRecordSerialNumber
The serial number of the undo record.
)
True if successful, false otherwise.

Equals

#
public override bool Equals(
obj
)
Object.Equals

Export

#Since v8.0
Export the entire document to a file. All file formats that Rhino can export to are supported by this function.
public bool Export(
filePath,
options
Options to help define how data should be exported.
)
true on success

Export

#Since v7.0
Export the entire document to a file. All file formats that Rhino can export to are supported by this function.
public bool Export(
filePath
)
true on success

ExportSelected

#Since v8.0
Export selected geometry to a file. All file formats that Rhino can export to are supported by this function.
public bool ExportSelected(
filePath,
options
Options to help define how data should be exported.
)
true on success

ExportSelected

#Since v7.0
Export selected geometry to a file. All file formats that Rhino can export to are supported by this function.
public bool ExportSelected(
filePath
)
true on success

ExtractPreviewImage

#Since v5.0
Extracts the bitmap preview image from the specified .3dm file.
public static Bitmap ExtractPreviewImage(
path
The .3dm file from which to extract the preview image. If null, the path to the active document is used.
)
The preview bitmap if successful, null otherwise.

FindFile

#Since v5.0
Search for a file using Rhino's search path. Rhino will look in the following places:
  1. Current model folder
  2. Path specified in options dialog/File tab
  3. Rhino system folders
  4. Rhino executable folder
public string FindFile(
filename
)
Path to existing file if found, an empty string if no file was found

FormatNumber

#Since v8.0
Call this method to get string representing the specified value using the documents display coordinate system and display precision.
public string FormatNumber(
value,
appendUnitSystemName,
abbreviate
)

FormatNumber

#Since v8.0
Call this method to get string representing the specified value using the documents display coordinate system and display precision.
public string FormatNumber(
value
)

FromFilePath

#Since v6.0
Search the open document list for a document with a Path equal to the specified file path.
public static RhinoDoc FromFilePath(
filePath
The full path to the file to search for.
)
The file name to search for

FromId

#Since v5.0 Obsolete v6.0
[EditorBrowsable(EditorBrowsableState.Never)] public static RhinoDoc FromId(
docId
)
obsoleteUse FromRuntimeSerialNumber

FromRuntimeSerialNumber

#Since v6.0
[CLSCompliant(false)] public static RhinoDoc FromRuntimeSerialNumber(
serialNumber
)

GetAnalysisMeshingParameters

#Since v6.0
Get analysis meshing parameters currently used by the document
public MeshingParameters GetAnalysisMeshingParameters()

GetCurrentMeshingParameters

#Since v6.0
Get the custom meshing parameters that this document will use.
public MeshingParameters GetCurrentMeshingParameters()

GetCustomUnitSystem

#Since v7.9
Get the custom unit system name and custom unit scale.
public bool GetCustomUnitSystem(
modelUnits,
Set true to get values from the document's model unit system. Set false to get values from the document's page unit system.
out string
customUnitName,
The custom unit system name.
out double
metersPerCustomUnit
The meters per custom unit scale.
)
true if successful, false otherwise.

GetEmbeddedFilesList

#Since v6.0
public string[] GetEmbeddedFilesList(
missingOnly
)

GetGridDefaults

#Since v8.13
public ConstructionPlaneGridDefaults GetGridDefaults()

GetGumballPlane

#Since v6.0
Returns the active plane of Rhino's auto-gumball widget. Note, when calling from a Rhino command, make sure the command class has the Rhino.Commands.Style.Transparent command style attribute.
public bool GetGumballPlane(
out Plane
plane
The active plane.
)
true if the auto-gumball widget is enabled and visible. False otherwise.

GetHashCode

#
public override int GetHashCode()

GetMeshingParameters

#Since v5.1
Get MeshingParameters currently used by the document
public MeshingParameters GetMeshingParameters()

GetModelUrl

#Since v9.0
Gets the link address, or URL, for the model.
public void GetModelUrl(
out string
url,
The URL.
out string
urlDescription
The URL description.
)

GetRedoRecords

#Since v9.0
Gets this document's redo history, ordered from the action that the next call to Redo() repeats to the oldest action that can be redone.
public UndoRecordEntry[] GetRedoRecords()
The redo records. The list is empty when there is nothing to redo.

GetRenderPrimitiveList

#Since v6.9 Obsolete v8.0
Build custom render mesh(es) for this document (i.e. - GH meshes).
[EditorBrowsable(EditorBrowsableState.Never)] public RenderPrimitiveList GetRenderPrimitiveList(
viewport,
The viewport being rendered.
attrs
Attributes for the view mode you are supplying meshes for. Will be null if this is a modal rendering.
)
Returns a RenderPrimitiveList if successful otherwise returns null.

GetRenderPrimitives

#Since v6.0 Obsolete v8.0
Get a enumerable list of custom mesh primitives
[EditorBrowsable(EditorBrowsableState.Never)] public IEnumerable<RenderPrimitive> GetRenderPrimitives(
forceTriangleMeshes,
If true all mesh faces will be triangulated
quietly
Iterate quietly, if true then no user interface will be displayed
)
obsoleteThis version is obsolete because - uses the old school custom render meshes. Prefer CustomRenderMeshes

GetRenderPrimitives

#Since v6.0 Obsolete v8.0
Get a enumerable list of custom mesh primitives
[EditorBrowsable(EditorBrowsableState.Never)] public IEnumerable<RenderPrimitive> GetRenderPrimitives(
plugInId,
The Id of the plug-in creating the iterator.
viewport,
The rendering view camera.
forceTriangleMeshes,
If true all mesh faces will be triangulated
quietly
Iterate quietly, if true then no user interface will be displayed
)
obsoleteThis version is obsolete because - uses the old school custom render meshes. Prefer RenderPrimitives

GetRenderPrimitives

#Since v6.0 Obsolete v8.0
Get a enumerable list of custom mesh primitives
[EditorBrowsable(EditorBrowsableState.Never)] public IEnumerable<RenderPrimitive> GetRenderPrimitives(
viewport,
The rendering view camera.
forceTriangleMeshes,
If true all mesh faces will be triangulated
quietly
Iterate quietly, if true then no user interface will be displayed
)
obsoleteThis version is obsolete because - uses the old school custom render meshes. Prefer RenderMeshes

GetUndoRecords

#Since v9.0
Gets this document's undo history, ordered from the most recently recorded action to the oldest recorded action.
public UndoRecordEntry[] GetUndoRecords()
The undo records. The list is empty when there is nothing to undo.

GetUnitSystemName

#
public string GetUnitSystemName(
modelUnits,
capitalize,
singular,
abbreviate
)

HasCustomRenderMeshes

#Since v8.0
Returns true if the document has a set of custom render primitives - ie, CustomRenderMeshes will return non-null.
public bool HasCustomRenderMeshes(
mt,
The mesh type requested (render or analysis).
vp,
The viewport being rendered.
ref Flags
flags,
See RenderMeshProvider.Flags. This is an in/out parameter: on return it also carries any status flags - including RenderMeshProvider.Flags.Incomplete when an asynchronous provider has not finished - so reset it before each call and test it afterwards.
plugin,
The requesting plug-in (typically the calling plugin)
attrs
Display attributes for the caller - null if this is a full rendering.
)
Returns true if the object will has a set of custom render primitives

Import

#Since v8.0
Import geometry into a RhinoDoc from a file. This can be any file format that Rhino can import
public bool Import(
filePath,
options
)

Import

#Since v7.0
Import geometry into a RhinoDoc from a file. This can be any file format that Rhino can import
public bool Import(
filePath
)
true on success

InCommand

#Since v8.0
This is a low level tool to determine if Rhino is currently running a command.
public int InCommand(
bIgnoreScriptRunnerCommands
If true, script running commands, like "ReadCommandFile" and the RhinoScript plug-ins "RunScript" command, are not counted.
)
Number of active commands.

IsMetricUnitSystem

#Since v8.6
Determines if a document unit system is a metric unit system.
public bool IsMetricUnitSystem(
modelUnits
True to query model units, false to query page units.
)
Return true if the length unit is a metric unit system.

Open

#Since v6.0
Opens a 3dm file and makes it the active document. If called on windows the active document will be saved and closed and the new document will be opened and become the active document. If called on the Mac the file will be opened in a new document window.
public static RhinoDoc Open(
filePath,
Full path to the 3dm file to open
out bool
wasAlreadyOpen
Will get set to true if there is a currently open document with the specified path; otherwise it will get set to false.
)
Returns the newly opened document on success or null on error.

OpenDocuments

#Since v6.0
Returns a list of currently open Rhino documents
public static RhinoDoc[] OpenDocuments()

OpenDocuments

#Since v7.2
Returns a list of currently open Rhino documents
public static RhinoDoc[] OpenDocuments(
includeHeadless
pass true to include headless docs in the list
)

OpenFile

#Since v5.0 Obsolete v6.0
[EditorBrowsable(EditorBrowsableState.Never)] public static bool OpenFile(
path
)
obsoleteOpenFile is obsolete, use Open instead

OpenHeadless

#Since v7.0
Opens a 3DM file into a new headless RhinoDoc.
public static RhinoDoc OpenHeadless(
file3dmPath
Path of a Rhino model to load.
)

OpenHeadless

#Since v8.21
Opens a file into a new headless RhinoDoc.
public static RhinoDoc OpenHeadless(
filePath,
Path of a Rhino model to load.
options
)

OpenInteractive

#Since v6.0
Opens a 3dm file and makes it the active document. If called on windows the active document will be saved and closed and the new document will be opened and become the active document. If called on the Mac the file will be opened in a new document window. This function is interactive in that it will ask you if you want to open a document as read only if it is already open in a different process
public static RhinoDoc OpenInteractive(
filePath,
Full path to the 3dm file to open
out bool
wasAlreadyOpen
Will get set to true if there is a currently open document with the specified path; otherwise it will get set to false.
)
Returns the newly opened document on success or null on error.

Purge

#Since v9.0
Purges unused table objects from this document, the same way the Purge command does.
public PurgeStatistics Purge(
filter,
The document table object types to purge.
quiet
Set to true to suppress any output or progress messages.
)
What was purged.

Purge

#Since v9.0
Purges unused table objects from this document, the same way the Purge command does.
public PurgeStatistics Purge(
filter
The document table object types to purge.
)
Remarks: The order in which the table object types are purged matters, and purging one type can make another type purgeable, so this purges everything filter asks for in a single operation.
What was purged.
var stats = doc.Purge(PurgeFilter.Layers | PurgeFilter.Materials);
RhinoApp.WriteLine($"Purged {stats.PurgedCount(PurgeFilter.Layers)} layers.");

PurgeObjectHistory

#Since v9.0
Purges the history records of every object in this document.
public int PurgeObjectHistory()
Remarks: Objects that are deleted (and therefore on the undo stack) have their history records purged but are not included in the returned count.
The number of objects that had a history record purged.

PurgeObjectHistory

#Since v9.0
Purges the history records of a list of objects.
public int PurgeObjectHistory(
objects
The objects whose history records are to be purged. Objects that have no history record are skipped.
)
The number of objects that had a history record purged.

PurgeObjectHistory

#Since v9.0
Purges the history records of every object in this document.
public int PurgeObjectHistory(
out int
hiddenCount
The number of purged objects that were hidden or on a hidden layer.
)
The number of objects that had a history record purged.

ReadFile

#Since v5.0
public static bool ReadFile(
path,
options
)

ReadFileVersion

#Since v5.0
Returns the major version of Rhino that wrote the .3dm file this document was read from. Values from referenced or merged files are not reported.
public int ReadFileVersion()
Remarks: This is the Rhino version, not the 3dm archive version: a file written by Rhino 8 returns 8, not 80. Use File3dm.ReadArchiveVersion(string) for the archive version of a file on disk, or File3dm.ReadRevisionHistory(string, string, string, int, DateTime, DateTime) for who last edited it. A document created by "New" returns -1 even when a template was read.
The Rhino major version (e.g. 1, 2, 3, ... 8, 9), or -1 if this document was not read from a .3dm file.

Redo

#Since v6.16
Redo the last action that was "undone"
public bool Redo()
true on success

RenderMeshes

#Since v8.0
Returns a set of non-object custom render primitives for this document.
public RenderMeshes[] RenderMeshes(
mt,
The mesh type requested (render or analysis).
vp,
The viewport being rendered
ref Flags
flags,
See RenderMeshProvider.Flags. This is an in/out parameter: on return it also carries any status flags - including RenderMeshProvider.Flags.Incomplete when an asynchronous provider has not finished - so reset it before each call and test it afterwards.
plugin,
The requesting plug-in (typically the calling plugin)
attrs
Display attributes for the caller - null if this is a full rendering.
)
Returns a set of custom render primitives for this object

Save

#Since v7.0
Save doc to disk using the document's Path
public bool Save()

SaveAs

#Since v9.0
Save doc as a 3dm to a specified path
public bool SaveAs(
file3dmPath,
version,
Rhino file version
saveSmall,
whether to inlcude render meshes and preview image
saveTextures,
whether to include the bitmap table
saveGeometryOnly,
whether to write enything besides geometry
savePluginData,
whether to write plugin user data
useCompression
"whether to compress meshes and embedded files
)
true on success

SaveAs

#Since v8.0
Save doc as a 3dm to a specified path
public bool SaveAs(
file3dmPath,
version,
Rhino file version
saveSmall,
whether to inlcude render meshes and preview image
saveTextures,
whether to include the bitmap table
saveGeometryOnly,
whether to write enything besides geometry
savePluginData
whether to write plugin user data
)
true on success

SaveAs

#Since v7.0
Save doc as a 3dm to a specified path
public bool SaveAs(
file3dmPath,
version
Rhino file version
)
true on success

SaveAs

#Since v7.0
Save doc as a 3dm to a specified path using the current Rhino file version
public bool SaveAs(
file3dmPath
)
true on success

SaveAsTemplate

#Since v7.0
Save this document as a template to a specific Rhino file version
public bool SaveAsTemplate(
file3dmTemplatePath,
version
)
true on success

SaveAsTemplate

#Since v7.0
Save this document as a template
public bool SaveAsTemplate(
file3dmTemplatePath
)
true on success

SelectRenderContentInEditor

#Since v7.20
Selects a collection of contents in any editors they appear in.
public void SelectRenderContentInEditor(
collection,
A collection of RenderContents to select
append
Append to current selection
)

SetCurrentUndoRecordDescription

#Since v9.0
Sets the description of the undo record currently being recorded. Use this to give the undo record of a running command, such as RunPythonScript, a meaningful name in Undo, Redo, and UndoMultiple.
public bool SetCurrentUndoRecordDescription(
description
The new description. Cannot be null, empty, or only white space.
)
true if an undo record is active and its description was set.

SetCustomMeshingParameters

#Since v5.1
Set the custom meshing parameters that this document will use. You must also modify the MeshingParameterStyle property on the document to Custom if you want these meshing parameters to be used
public void SetCustomMeshingParameters()

SetCustomUnitSystem

#Since v7.9
Changes the unit system to custom units and sets the custom unit scale.
public bool SetCustomUnitSystem(
modelUnits,
Set true to set values from the document's model unit system. Set false to set values from the document's page unit system.
customUnitName,
The custom unit system name.
metersPerCustomUnit,
The meters per custom unit scale.
scale
Set true to scale existing objects.
)
true if successful, false otherwise.

SetGridDefaults

#Since v8.13
public void SetGridDefaults()

SetModelUrl

#Since v9.0
Sets the link address, or URL, for the model.
public void SetModelUrl(
url,
The URL.
urlDescription
The URL description.
)

SupportsRenderPrimitiveList

#Since v6.9 Obsolete v8.0
Determines if custom render meshes will be built for this document (i.e. - GH meshes).
[EditorBrowsable(EditorBrowsableState.Never)] public bool SupportsRenderPrimitiveList(
viewport,
The viewport being rendered.
attrs
Type of mesh to build. If attrs is non-null then a smaller mesh may be generated in less time, false is meant when actually rendering.
)
Returns true if custom render mesh(es) will get built for this document.

TimeoutActiveGet

#Since v9.0
Exit the active get operation with a timeout
public void TimeoutActiveGet()

TryGetRenderPrimitiveBoundingBox

#Since v6.9 Obsolete v8.0
Get the bounding box for the custom render meshes associated with this document (i.e. - GH meshes).
[EditorBrowsable(EditorBrowsableState.Never)] public bool TryGetRenderPrimitiveBoundingBox(
viewport,
The viewport being rendered.
attrs,
Attributes for the view mode you are supplying meshes for. Will be null if this is a modal rendering.
boundingBox
This will be set to BoundingBox.Unset on failure otherwise it will be the bounding box for the custom render meshes associated with this object.
)
Returns true if the bounding box was successfully calculated otherwise returns false on error.

Undo

#Since v6.16
Undo the last action
public bool Undo()
true on success

Write3dmFile

#Since v6.5
Write information in this document to a .3dm file. Note, the active document's name will not be changed.
public bool Write3dmFile(
path,
The name of the .3dm file to write.
options
The file writing options.
)
true if successful, false on failure.

WriteFile

#Since v5.0
Write information in this document to a file. Note, the active document's name will be changed to that of the path provided.
public bool WriteFile(
path,
The name of the file to write.
options
The file writing options.
)
Remarks: This is the best choice for general file writing. It handles making backups using temporary files, locking and unlocking, loading file writing plug-ins, and many other details.
true if successful, false on failure.

Events

ActiveDocumentChanged

#Since v6.0
This event is raised when the active document used by modeless user interface changes. On Mac Rhino this will get raised before the NewDocument, BeginOpenDocument and EndOpenDocument events. Mac Rhino will also raise this event with 0 for the document Id and a null document pointer when the last document is closed. Windows Rhino will raise this event after the NewDocument, BeginOpenDocument and EndOpenDocument events when a new or existing model is opened.
public static event EventHandler<DocumentEventArgs> ActiveDocumentChanged

AddRhinoObject

#Since v5.0
Called if a new object is added to the document.
public static event EventHandler<RhinoObjectEventArgs> AddRhinoObject

AfterTransformObjects

#Since v8.15
Called after objects are being transformed
public static event EventHandler<RhinoAfterTransformObjectsEventArgs> AfterTransformObjects

BeforeTransformObjects

#ExampleSince v5.10
Called before objects are being transformed
public static event EventHandler<RhinoTransformObjectsEventArgs> BeforeTransformObjects

BeginOpenDocument

#Since v5.0
This event is raised when the document open operation begins. NOTE: On Windows, this event will be fired when a clipboard paste operation occurs, as Rhino opens a .tmp file in the User's Local folder with the contents of the pasted document.
public static event EventHandler<DocumentOpenEventArgs> BeginOpenDocument

BeginSaveDocument

#Since v5.0
public static event EventHandler<DocumentSaveEventArgs> BeginSaveDocument

CloseDocument

#Since v5.0
public static event EventHandler<DocumentEventArgs> CloseDocument

DeleteRhinoObject

#Since v5.0
Called if an object is deleted. At some later point the object can be un-deleted.
public static event EventHandler<RhinoObjectEventArgs> DeleteRhinoObject

DeselectAllObjects

#Since v5.0
Called when all objects are deselected.
public static event EventHandler<RhinoDeselectAllObjectsEventArgs> DeselectAllObjects

DeselectObjects

#Since v5.0
Called when object(s) are deselected.
public static event EventHandler<RhinoObjectSelectionEventArgs> DeselectObjects

DimensionStyleTableEvent

#Since v6.0
Called when any modification happens to a document's dimension style table.
public static event EventHandler<DimStyleTableEventArgs> DimensionStyleTableEvent

DocumentPropertiesChanged

#Since v5.0
public static event EventHandler<DocumentEventArgs> DocumentPropertiesChanged

EndOpenDocument

#Since v5.0
public static event EventHandler<DocumentOpenEventArgs> EndOpenDocument

EndOpenDocumentInitialiViewUpdate

#Since v5.11
This event is raised after EndOpenDocument when the documents initial views have been created and initialized.
[EditorBrowsable(EditorBrowsableState.Never)] public static event EventHandler<DocumentOpenEventArgs> EndOpenDocumentInitialiViewUpdate
obsoleteTypo: use EndOpenDocumentInitialViewUpdate

EndOpenDocumentInitialViewUpdate

#Since v6.18
This event is raised after EndOpenDocument when the documents initial views have been created and initialized.
public static event EventHandler<DocumentOpenEventArgs> EndOpenDocumentInitialViewUpdate

EndSaveDocument

#Since v5.0
public static event EventHandler<DocumentSaveEventArgs> EndSaveDocument

GroupTableEvent

#Since v5.0
Called when any modification happens to a document's group table.
public static event EventHandler<GroupTableEventArgs> GroupTableEvent

HatchPatternTableEvent

#Since v8.15
Called when any modification happens to a document's hatch pattern table.
public static event EventHandler<HatchPatternTableEventArgs> HatchPatternTableEvent

InstanceDefinitionTableEvent

#Since v5.3
Called when any modification happens to a document's instance definition table.
public static event EventHandler<InstanceDefinitionTableEventArgs> InstanceDefinitionTableEvent

LayerTableEvent

#Since v5.0
Called when any modification happens to a document's layer table.
public static event EventHandler<LayerTableEventArgs> LayerTableEvent

LightTableEvent

#Since v5.3
Called when any modification happens to a document's light table.
public static event EventHandler<LightTableEventArgs> LightTableEvent

LinetypeTableEvent

#Since v8.0
Called when any modification happens to a document's linetype table.
public static event EventHandler<LinetypeTableEventArgs> LinetypeTableEvent

MarkupTableEvent

#Since v9.0
Called when any modification happens to a document's markup table.
public static event EventHandler<MarkupTableEventArgs> MarkupTableEvent

MarkupViewChanged

#Since v9.0
Called when a document's markup view state changes, i.e. when the document enters or leaves markup viewing/editing, or switches which markup is being viewed or edited. Unlike MarkupTableEvent (which reports markup add/delete/modify), this reports which markup is currently active so UI can indicate it.
public static event EventHandler<MarkupViewChangedEventArgs> MarkupViewChanged
Remarks: Switching directly from one markup to another first leaves the current markup, so the switch is reported as two events: an intervening MarkupMode.None (index -1) followed by the new markup. Handlers should treat each event as the current state.

MaterialTableEvent

#Since v5.0
Called when any modification happens to a document's material table.
public static event EventHandler<MaterialTableEventArgs> MaterialTableEvent

ModifyObjectAttributes

#Since v5.0
Called when all object attributes are changed.
public static event EventHandler<RhinoModifyObjectAttributesEventArgs> ModifyObjectAttributes

NewDocument

#Since v5.0
public static event EventHandler<DocumentEventArgs> NewDocument

PageViewGroupTableEvent

#Since v9.0
Called when any modification happens to a document's pageview group table.
public static event EventHandler<PageViewGroupTableEventArgs> PageViewGroupTableEvent

PurgeRhinoObject

#Since v5.0
Called if an object is being purged from a document. The object will cease to exist forever.
public static event EventHandler<RhinoObjectEventArgs> PurgeRhinoObject

RenderEnvironmentTableEvent

#Since v5.7
public static event EventHandler<RhinoDoc.RenderContentTableEventArgs> RenderEnvironmentTableEvent

RenderMaterialsTableEvent

#Since v5.7
public static event EventHandler<RhinoDoc.RenderContentTableEventArgs> RenderMaterialsTableEvent

RenderTextureTableEvent

#Since v5.7
Called when the RenderTextureTable has been loaded, is about to be cleared or has been cleared. See RhinoDoc.RenderContentTableEventType for more information.
public static event EventHandler<RhinoDoc.RenderContentTableEventArgs> RenderTextureTableEvent

ReplaceRhinoObject

#Since v5.0
Called if an object is about to be replaced. If both UndoActive and RedoActive return false, then immediately after the ReplaceRhinoObject event, there will be a DeleteRhinoObject event followed by a AddRhinoObject event. If either UndoActive or UndoActive return true, then immediately after the ReplaceRhinoObject event, there will be a DeleteRhinoObject event followed by a UndeleteRhinoObject event.
public static event EventHandler<RhinoReplaceObjectEventArgs> ReplaceRhinoObject

SectionStyleTableEvent

#Since v9.0
Called when any modification happens to a document's section style table.
public static event EventHandler<SectionStyleTableEventArgs> SectionStyleTableEvent

SelectObjects

#Since v5.0
Called when object(s) are selected.
public static event EventHandler<RhinoObjectSelectionEventArgs> SelectObjects

TextureMappingEvent

#Since v5.8
Called when any modification happens to a document objects texture mapping.
public static event EventHandler<RhinoDoc.TextureMappingEventArgs> TextureMappingEvent

UndeleteRhinoObject

#Since v5.0
Called if an object is un-deleted.
public static event EventHandler<RhinoObjectEventArgs> UndeleteRhinoObject

UnitsChangedWithScaling

#Since v7.20
Called when a change in the model units results in a scaling operation on all of the objects in the document. This call is made before any of the objects are scaled. A call to RhinoDoc.DocumentPropertiesChanged follows.
public static event EventHandler<UnitsChangedWithScalingEventArgs> UnitsChangedWithScaling

UserStringChanged

#
This event is raised when document user text strings are changed
public static event EventHandler<RhinoDoc.UserStringChangedArgs> UserStringChanged

WorksessionFileChanged

#Since v9.0
Raised after a worksession reference model has been attached to or detached from a document. The document state already reflects the change at the time the event fires.
public static event EventHandler<RhinoDoc.WorksessionFileChangedEventArgs> WorksessionFileChanged