File3dm

References
public class File3dm : IDisposable
Represents a 3dm file, which is stored using the OpenNURBS file standard.

The 3dm format is the main Rhinoceros storage format.

Visit http://www.opennurbs.com/ for more details.

Constructors

File3dm

#Since v5.0
public File3dm()
Initializes a new instance of a 3dm file.

Finalizer

~File3dm

#
~File3dm()
Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().

Properties

AllDimStyles

#Since v6.0
public File3dmDimStyleTable AllDimStyles { get; }
Dimension Styles in this file.

AllGroups

#Since v6.5
public File3dmGroupTable AllGroups { get; }
Groups in this file.

AllHatchPatterns

#Since v6.0
public File3dmHatchPatternTable AllHatchPatterns { get; }
Hatch patterns in this file.

AllInstanceDefinitions

#Since v6.0
public File3dmInstanceDefinitionTable AllInstanceDefinitions { get; }
Instance definitions in this file

AllLayers

#Since v6.0
public File3dmLayerTable AllLayers { get; }
Layers in this file.

AllLinetypes

#Since v6.0
public File3dmLinetypeTable AllLinetypes { get; }
Linetypes in this file.

AllMaterials

#Since v6.0
public File3dmMaterialTable AllMaterials { get; }
Materials in this file.

AllNamedConstructionPlanes

#Since v6.0
public File3dmNamedConstructionPlanes AllNamedConstructionPlanes { get; }
Named construction planes in this file.

AllNamedViews

#Since v6.0
public File3dmViewTable AllNamedViews { get; }
Named views in this file.

AllViews

#Since v6.0
public File3dmViewTable AllViews { get; }
Views that represent the RhinoViews which are displayed when Rhino loads this file.

ApplicationDetails

#Since v5.0
public string ApplicationDetails { get; set; }
Gets or sets details for the application that wrote this file.

ApplicationName

#Since v5.0
public string ApplicationName { get; set; }
Gets or sets the name of the application that wrote this file.

ApplicationUrl

#Since v5.0
public string ApplicationUrl { get; set; }
Gets or sets a URL for the application that wrote this file.

ArchiveVersion

#Since v7.9
public int ArchiveVersion { get; }
Gets the 3dm file archive version.

Created

#Since v5.6
public DateTime Created { get; }
Get the DateTime that this file was originally created. If the value is not set in the 3dm file, then DateTime.MinValue is returned

CreatedBy

#Since v5.0
public string CreatedBy { get; }
Gets a string that names the user who created the file.

DimStyles

#Since v5.0
public IList<DimensionStyle> DimStyles { get; }
obsoleteUse the new AllDimStyles property
Dimension Styles in this file.

EarthAnchorPoint

#Since v8.3
public EarthAnchorPoint EarthAnchorPoint { get; set; }
If set, this is the model's location on the earth. This information is used when the model is used with GIS information.

EmbeddedFiles

#Since v8.0
public File3dmEmbeddedFiles EmbeddedFiles { get; }
The embedded files in this file.

HatchPatterns

#Since v5.0
public IList<HatchPattern> HatchPatterns { get; }
obsoleteUse the new AllHatchPatterns property
Hatch patterns in this file

InstanceDefinitions

#Since v5.6
public IList<InstanceDefinitionGeometry> InstanceDefinitions { get; }
obsoleteUse the new AllInstanceDefinitions property
Instance definitions in this file.

LastEdited

#Since v5.6
public DateTime LastEdited { get; }
Get the DateTime that this file was last edited. If the value is not set in the 3dm file, then DateTime.MinValue is returned

LastEditedBy

#Since v5.0
public string LastEditedBy { get; }
Gets a string that names the user who last edited the file.

Layers

#Since v5.0
public IList<Layer> Layers { get; }
obsoleteUse the new AllLayers property
Layers in this file.

Linetypes

#Since v5.0
public IList<Linetype> Linetypes { get; }
obsoleteUse the new AllLinetypes property
Linetypes in this file.

Manifest

#Since v6.0
public ManifestTable Manifest { get; }
Retrieves the manifest with all object descriptions in this file.

Materials

#Since v5.0
public IList<Material> Materials { get; }
obsoleteUse the new AllMaterials property
Materials in this file.

NamedConstructionPlanes

#Since v6.0
public IList<ConstructionPlane> NamedConstructionPlanes { get; }
Named construction planes in this file.

NamedViews

#Since v5.0
public IList<ViewInfo> NamedViews { get; }
Named views in this file.

Notes

#Since v5.0
public File3dmNotes Notes { get; set; }
Gets or sets the model notes.

Objects

#Since v5.0
public File3dmObjectTable Objects { get; }
Gets access to the File3dmObjectTable class associated with this file, which contains all objects.

PlugInData

#Since v5.0
public File3dmPlugInDataTable PlugInData { get; }
Custom plug-in data in this file. This data is not attached to any geometry or attributes

RenderEnvironments

#Since v8.0
public File3dmRenderEnvironments RenderEnvironments { get; }
The render environments in this file.

RenderMaterials

#Since v8.0
public File3dmRenderMaterials RenderMaterials { get; }
The render materials in this file.

RenderTextures

#Since v8.0
public File3dmRenderTextures RenderTextures { get; }
The render textures in this file.

Revision

#Since v5.0
public int Revision { get; set; }
Gets or sets the revision number.

Settings

#Since v5.0
public File3dmSettings Settings { get; }
Settings include tolerance, and unit system, and defaults used for creating views and objects.

StartSectionComments

#Since v5.0
public string StartSectionComments { get; set; }
Gets or sets the start section comments, which are the comments with which the 3dm file begins.

Strings

#Since v6.0
public File3dmStringTable Strings { get; }
Document user strings in this file

Views

#Since v5.0
public IList<ViewInfo> Views { get; }
Views that represent the RhinoViews which are displayed when Rhino loads this file.

Methods

Audit

#Since v5.0 Obsolete v6.0
public int Audit(bool attemptRepair, out int repairCount, out string errors, out int[] warnings)
obsoletePolish and Audit functionality no longer exist.
This function is only kept for forward assembly compatibility.
attemptRepair (bool)Ignored.
repairCount (out int)Is set to 0.
errors (out string)Contains no meaningful error.
warnings (out int[])Is set to null.
Returns 0.

Dispose

#Since v5.0
public void Dispose()
Actively reclaims unmanaged resources that this instance uses.

Dispose

#
protected virtual void Dispose(bool disposing)
For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

disposing (bool)true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.

Dump

#Since v5.0
public string Dump()
Prepares a text dump of the entire model.
The text dump.

DumpSummary

#Since v5.0
public string DumpSummary()
Prepares a text dump of model properties and settings.
The text dump.

DumpToTextLog

#Since v5.1
public void DumpToTextLog(TextLog log)
Prepares a text dump of the entire model.
log (TextLog)

FromByteArray

#Since v7.0
public static File3dm FromByteArray(byte[] bytes)
Read a 3dm file from a byte array
bytes (byte[])
New File3dm on success, null on error.

GetPreviewImage

#Since v6.0
public Bitmap GetPreviewImage()
Preview image used for file explorer

IsValid

#Since v5.0 Obsolete v6.0
public bool IsValid(out string errors)
obsoleteIsValid now returns always true.
The File3dm object is kept consistent during its creation. Therefore, this function now returns only true.
errors (out string)No errors are found.
true in any case.

IsValid

#Since v5.1 Obsolete v6.0
public bool IsValid(TextLog errors)
obsoleteIsValid now returns always true.
The File3dm object is kept consistent during its creation. Therefore, this function now returns only true.
errors (TextLog)No errors are found.
>true in any case.

Polish

#Since v5.0 Obsolete v6.0
public void Polish()
obsoletePolish and Audit functionality no longer exist.
This function is only kept for forward assembly compatibility.

Read

#Since v5.9
[CLSCompliant(false)] public static File3dm Read(string path, TableTypeFilter tableTypeFilterFilter, ObjectTypeFilter objectTypeFilter)
Reads a 3dm file from a specified location.
path (string)The file to read.
tableTypeFilterFilter (File3dm.TableTypeFilter)If tableTypeFilterFilter is None, then everything in the archive is read. Otherwise tableTypeFilterFilter identifies what tables should be read.
objectTypeFilter (File3dm.ObjectTypeFilter)If objectTypeFilter is not None, then is a filter made by bitwise or-ing values to select which types of objects will be read from the model object table.
new File3dm on success, null on error.
FileNotFoundExceptionIf path does not exist.

Read

#Since v5.0
public static File3dm Read(string path)
Reads a 3dm file from a specified location.
path (string)The file to read.
new File3dm on success, null on error.
FileNotFoundExceptionIf path does not exist.

ReadApplicationData

#Since v5.0
public static void ReadApplicationData(string path, out string applicationName, out string applicationUrl, out string applicationDetails)
Reads only the application information from an existing 3dm file.
path (string)A location on disk or network.
applicationName (out string)The application name. This out parameter is assigned during this call.
applicationUrl (out string)The application URL. This out parameter is assigned during this call.
applicationDetails (out string)The application details. This out parameter is assigned during this call.

ReadArchiveVersion

#Since v5.10
public static int ReadArchiveVersion(string path)
Reads only the archive 3dm version from an existing 3dm file.
path (string)The file from which to read the archive version.
The 3dm file archive version.
FileNotFoundExceptionIf path does not exist, is null or cannot be accessed because of permissions.

ReadDimensionStyles

#Since v6.0
public static DimensionStyle[] ReadDimensionStyles(string path)
Read the dimension styles table out of a 3dm file.
path (string)The location of the file.
Array of dimension styles on success (empty array if file does not contain dimension styles) null on error
FileNotFoundExceptionIf the provided path is null, does not exist or cannot be accessed.

ReadEarthAnchorPoint

#Since v8.3
public static EarthAnchorPoint ReadEarthAnchorPoint(string path)
Reads only the earth anchor point from an existing 3dm file
path (string)A location on disk or network.
The earth anchor point.

ReadNotes

#Since v5.0
public static string ReadNotes(string path)
Reads only the notes from an existing 3dm file.
path (string)The file from which to read the notes.
The 3dm file notes.
FileNotFoundExceptionIf path does not exist, is null or cannot be accessed because of permissions.

ReadPageViews

#Since v9.0
public static ViewInfo[] ReadPageViews(string path)
Reads page view, or layout, information from an existing 3dm file.
path (string)A location on disk or network.
An array of view information if successful, otherwise an empty array.

ReadPreviewImage

#Since v5.0
public static Bitmap ReadPreviewImage(string path)
Attempts to read the preview image out of a 3dm file.
path (string)The location of the file.
A bitmap, or null on failure.
FileNotFoundExceptionIf the provided path is null, does not exist or cannot be accessed.

ReadRevisionHistory

#Since v5.6
public static bool ReadRevisionHistory(string path, out string createdBy, out string lastEditedBy, out int revision, out DateTime createdOn, out DateTime lastEditedOn)
Quickly check a file for it's revision information. This function does not read the entire file, just what it needs to get revision information out
path (string)path to the 3dm file
createdBy (out string)original author of the file
lastEditedBy (out string)last person to edit the file
revision (out int)which revision this file is at
createdOn (out DateTime)date file was created (DateTime.MinValue if not set in file)
lastEditedOn (out DateTime)date file was last edited (DateTime.MinValue if not set in file)
true on success

ReadSettings

#Since v9.0
public static File3dm ReadSettings(string path)
Reads only the start section, properties, and settings from a 3dm file at a specified location. The rest of the model (objects, layers, and other tables) is not read.
path (string)The file to read.
new File3dm on success, null on error.
FileNotFoundExceptionIf path does not exist.

ReadWithLog

#Since v5.0
public static File3dm ReadWithLog(string path, out string errorLog)
Read a 3dm file from a specified location and log any archive reading errors.
path (string)The file to read.
errorLog (out string)Any archive reading errors are logged here.
New File3dm on success, null on error.
FileNotFoundExceptionIf path does not exist.

ReadWithLog

#Since v5.9
[CLSCompliant(false)] public static File3dm ReadWithLog(string path, TableTypeFilter tableTypeFilterFilter, ObjectTypeFilter objectTypeFilter, out string errorLog)
Reads a 3dm file from a specified location.
path (string)The file to read.
tableTypeFilterFilter (File3dm.TableTypeFilter)If tableTypeFilterFilter is None, then everything in the archive is read. Otherwise tableTypeFilterFilter identifies what tables should be read.
objectTypeFilter (File3dm.ObjectTypeFilter)If objectTypeFilter is not None, then is a filter made by bitwise or-ing values to select which types of objects will be read from the model object table.
errorLog (out string)Any archive reading errors are logged here.
new File3dm on success, null on error.
FileNotFoundExceptionIf path does not exist.

SetPreviewImage

#Since v6.0
public void SetPreviewImage(Bitmap image)
Preview image used for file explorer
image (Bitmap)

ToByteArray

#Since v7.1
public byte[] ToByteArray()
Write to an in-memory byte[]

ToByteArray

#Since v7.1
public byte[] ToByteArray(File3dmWriteOptions options)
Write to an in-memory byte[]
options (File3dmWriteOptions)

Write

#Since v5.9
public bool Write(string path, File3dmWriteOptions options)
Writes contents of this model to an openNURBS archive. If the model is not valid, then Write will refuse to write it.
path (string)The file name to use for writing.
options (File3dmWriteOptions)An options instance, or null for default.
true if archive is written with no error. false if errors occur.

Write

#Since v5.0
public bool Write(string path, int version)
Writes contents of this model to an openNURBS archive. If the model is not valid, then Write will refuse to write it.
path (string)The file name to use for writing.
version (int)Version of the openNURBS archive to write. Must be [2; current version]. Rhino can read its current version, plus earlier file versions except 1. Use latest version when possible.

Alternatively, 0 is a placeholder for the last valid version.

true if archive is written with no error. false if errors occur.

WriteMultipleObjects

#Since v7.0
public static bool WriteMultipleObjects(string path, IEnumerable<GeometryBase> geometry)
Creates a simple 3dm file that contains a multiple geometric objects.
path (string)Path to the 3dm file to create.
geometry (IEnumerable<GeometryBase>)The geometry to be saved in the archive's object table. This is typically some Curves, Surfaces, Breps, Meshs, or SubDs.
True if successful, false otherwise.

WriteOneObject

#Since v7.0
public static bool WriteOneObject(string path, GeometryBase geometry)
Creates a simple 3dm file that contains a single geometric object.
path (string)Path to the 3dm file to create.
geometry (GeometryBase)The geometry to be saved in the archive's object table. This is typically a Curve, Surface, Brep, Mesh, or SubD.
True if successful, false otherwise.

WriteWithLog

#Since v6.0
public bool WriteWithLog(string path, File3dmWriteOptions options, out string errorLog)
Writes contents of this model to an openNURBS archive. If the model is not valid, then Write will refuse to write it.
path (string)The file name to use for writing.
options (File3dmWriteOptions)An options instance, or null for default.
errorLog (out string)This argument will be filled by out reference.
true if archive is written with no error. false if errors occur.

WriteWithLog

#Since v5.0
public bool WriteWithLog(string path, int version, out string errorLog)
Writes contents of this model to an openNURBS archive. If the model is not valid, then Write will refuse to write it.
path (string)The file name to use for writing.
version (int)Version of the openNURBS archive to write. Must be [2; current version]. Rhino can read its current version, plus earlier file versions except 1. Use latest version when possible.

Alternatively, 0 is a placeholder for the last valid version.

errorLog (out string)This argument will be filled by out reference.
true if archive is written with no error. false if errors occur.