|
![]() |
Any copyright statement
Namespace: Autodesk.Navisworks.Api
Assembly: Autodesk.Navisworks.Api (in Autodesk.Navisworks.Api.dll)
Syntax
Examples

using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows.Forms; using System.Text; using Autodesk.Navisworks.Api.Controls; static public void PublishFile() { //Create the PublishProperties object PublishProperties properties = new PublishProperties(); //Set the published file's properties properties.AllowResave = true; properties.Author = "Mr A.N. Other"; properties.Comments = "this is the comment for the file"; properties.Copyright = "Autodesk Ltd. 2010"; properties.DisplayAtPassword = true; properties.DisplayOnOpen = true; properties.EmbedDatabaseProperties = true; properties.EmbedTextures = true; properties.ExpiryDate = new DateTime(2099, 12, 31); properties.Keywords = string.Empty; properties.PreventObjectPropertyExport = false; properties.PublishDate = DateTime.Now; properties.PublishedFor = "Mrs. Other"; properties.Publisher = "A. Person"; properties.Subject = "The subject field"; properties.Title = "Title of the content"; properties.SetPassword("Password"); //create the published NWD try { Autodesk.Navisworks.Api.Application.ActiveDocument.PublishFile(@"C:\publishedFile.nwd", properties); } catch (Autodesk.Navisworks.Api.DocumentFileException) { //Failed to publish ile, perhaps try saving in //an alternate location using the exception safe method if (!Autodesk.Navisworks.Api.Application.ActiveDocument.TryPublishFile(@"C:\publishedFile2.nwd", properties)) { MessageBox.Show("Failed to publish the file"); } } catch (System.InvalidOperationException) { MessageBox.Show("Document is clear"); } }
Exceptions
Exception | Condition |
---|---|
System..::..ObjectDisposedException | Object has been Disposed |
System..::..NotSupportedException | Object is Read-Only |