- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody!
I have to write a plugin, which adds some selection to every timeliner task. By selection i mean Autodesk.Navisworks.Api.Timeliner.TimelinerSelection class.
So, after user imports an MS Project file as a timeliner datasource, i get the timeliner object, i'm able to iterate through tasks and their children, BUT....
but i cannot write anything to a task or timeliner object - they are all read-only. I read about it in Developers Guide(collections returned by Navisworks are read-only, collections created programmatically are writeabe), i see ReadOnly == true in objects' properties, but i hope there is a solution for this.
So, does anybody know how to WRITE data to timeliner Tasks using .NET API?
This is how i get access to timeliner object:
public class navisTest :AddInPlugin
{ static Document navDoc = Autodesk.Navisworks.Api.Application.ActiveDocument;
static Autodesk.Navisworks.Api.DocumentParts.IDocumentTimeliner Itimeliner = navDoc.Timeliner;
static DocumentTimeliner timeliner = (DocumentTimeliner)Itimeliner;
TimelinerTask tsk = new TimelinerTask();
foreach (TimelinerTask task in timeliner.Tasks)
{
foreach (TimelinerTask childTask in task.Children)
{
if (!childTask.Selection.IsClear)
{
childTask.Selection.CopyFrom(newCollection); //some ModelItemCollection
//or CopyFrom(navDoc.CurrentSelection.SelectedItems.DescendantsAndSelf);
//anyway it crashes here - "object is readonly"
}
}
}
}
Also, i tried to create my own Task object and add it to timeliner - the same thing, it crashes:
TimelinerTask tsk = new TimelinerTask(); tsk.Selection.CopyFrom(navDoc.CurrentSelection.SelectedItems.DescendantsAndSelf); timeliner.Tasks.Add(tsk); //crashes here.
Thanks in advance,
Alexander. ![]()
Solved! Go to Solution.