Autodesk Navisworks API
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
I am trying to find TimeLiner Task(s) that contain(s) a given ModelItem. I'd like to avoid looping on all tasks as this may be extremely time consuming considering the number of tasks.
Using the PropertyCategories.DataProperties I can find names and basic properties of the tasks a ModelItem is linked to, but they are all of type "DisplayString". Can I retrieve the TimeLiner Task instance from there?
My goal would be achieve by either displaying "Synchronization ID" or "Display ID" of the TimeLiner task in the ModelItem Property panel (eg PropertyCategory.DataProperties) OR by being able to retrieve the TimeLiner Task instance from the ModelItem (and then read the properties I want with some custom code).
Thank you for your suggestions,
-Nicolas
Solved! Go to Solution.
Re: From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
TimelinerTasks is a collection of ICollection which supports LINQ. You can search it without iterating.
Nw.Document doc = Nw.Application.ActiveDocument;
Nw.DocumentParts.IDocumentTimeliner tl = doc.Timeliner;
Tl.DocumentTimeliner tl_doc = (Tl.DocumentTimeliner)tl;
IEnumerable<SavedItem> items =
from x in tl_doc.Tasks
where x.DisplayName == "task1"
select x;
MessageBox.Show(items.Count<SavedItem>().ToString());
Xiaodong Liang
Developer Technical Services
Autodesk Developer Network
Re: From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi xiaodong,
Thank you for answering to me, again.
I understand this method you propose, it sure requires less lines of code than an iteration loop although it might be just what LINQ is doing behind...
I am surpirsed that there is no link between a model item and its timeliner tasks; especially, an item can be in a task with a none unique name and thus the LINQ query will return multiple match that I'll have to go through to find the correct one, am I correct?
also, can the timeliner be scrolled to a task programaticaly? Say I find the task I was looking for, can I get the timeliner to zoom on it rather that have the user scroll down and expand collapse nodes manually?
Thank you.
Nic
Re: From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I am surpirsed that there is no link between a model item and its timeliner tasks; especially, an item can be in a task with a none unique name and thus the LINQ query will return multiple match that I'll have to go through to find the correct one, am I correct?
It looks to me you are correct. And I did not find a property to identify two tasks with same display name. I am not sure there is any solution. It not, this is a good wish.
also, can the timeliner be scrolled to a task programaticaly? Say I find the task I was looking for, can I get the timeliner to zoom on it rather that have the user scroll down and expand collapse nodes manually?
I am not clear the question. From task you can know the attached object. it will not difficult to zoom to the objects. Why it requires to scroll down to select the task and select selection?
Xiaodong Liang
Developer Technical Services
Autodesk Developer Network
Re: From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Because I'd like to retrieve the timelinertask a model item is attached too.
If I select a model item that is in a task the information I get from the Property panel are very limited, if I want to find out the Synchronization ID of the TimelinerTask or its Activity ID then I need to be able to find the TimelinerTask from the model item.
My only goal here, is to get the timelinertask ID from a selected model item.
I'm gonna go for the option you first proposed and then loop through the matches to check if the model item is in the attachments.
cheers,
-Nic
Re: From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sorry, I only read the end of your answer, I thought the rest was quote.
I'd like to be able to highligh/show/scroll to the task in the timeliner because that is one of the navigation I need when assigning attachment to tasks; sometimes I need to select an object and easily go to the task it belongs to and do some attachment management there...
I think this is currently not possible; thank you for your help anyway.
-Nic
Re: From ModelItem to Timeliner Task(s)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the description. I think I understand it now. If there were a property/method to set current timeliner task (like the user selects a row/sub-row), your requirement would be possible. Unfortunetly, it looks to me no such API either. ![]()
I logged wishes for the two requirements.
Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

