Navisworks Timeliner API

Navisworks Timeliner API

Anonymous
Not applicable
8,421 Views
21 Replies
Message 1 of 22

Navisworks Timeliner API

Anonymous
Not applicable

I'm new to the Navisworks API and am trying to export all the timeliner information shown in image attached(timeliner.png)  associated with all objects out to a txt file but can't seem to figure out how to do it.  I've got the Item displayname(Revit name and ID) to export and the higher level Task information but can't seem to get down another level and get the items timeliner info.  I've looked at examples but cant seem to get it work Can someone please help with this.

 

Here is the Item display name code I'm used not sure if this is even the approach to use:

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;

namespace BasicPlugIn
{
 [PluginAttribute("BasicPlugIn.ABasicPlugin",

                     "ADSK",

                     ToolTip = "BasicPlugIn.ABasicPlugin tool tip",

                     DisplayName = "Sample Plugin")]

public class ABasicPlugin : AddInPlugin
    {

        public override int Execute(params string[] parameters)
        {
            string myPath = @"C:\Revit Projects\test.txt";

            using (StreamWriter myText = File.CreateText(myPath))

                foreach (ModelItem item in

              Autodesk.Navisworks.Api.Application

              .ActiveDocument.Models.RootItemDescendantsAndSelf)
                {

                    string dname = item.DisplayName;
                    myText.WriteLine(dname);
                }

            return 0;
}
}
}



 

 

Thanks,

Nate

0 Likes
8,422 Views
21 Replies
Replies (21)
Message 21 of 22

Anonymous
Not applicable

@Anonymouswrote:

Thanks @ngombault for your suggestion. I'm trying to edit the last code of Nchapman in order to export the actual duration of each task in a txt file.

 

But in 

PropertyCollection pCol = moDel.PropertyCategories.FindPropertyByDisplayName("Element ID", "Value");

I get the following error: "Cannot Implicity convert type "Autodesl.Navisworks.Api.DataProperty" to "System.Data.PropertyCollection"

Could you help me please?

Hi @Anonymous, 

Please change [PropertyCollection] to [DataProperty] and try again:

 

// PropertyCollection pCol = moDel.PropertyCategories.FindPropertyByDisplayName("Element ID", "Value");
DataProperty pCol = moDel.PropertyCategories.FindPropertyByDisplayName("Element ID", "Value");

 

Regards,
MinhHN.

Message 22 of 22

danyalahmed115
Explorer
Explorer

brothers ... can we get the task planned dates from timeliner for plugin like i export the task but the dates are not exporting...please help me in this

0 Likes