Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

From ModelItem to Timeliner Task(s)

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
ngombault
873 Views, 6 Replies

From ModelItem to Timeliner Task(s)

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

6 REPLIES 6
Message 2 of 7
xiaodong_liang
in reply to: ngombault

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());

Message 3 of 7
ngombault
in reply to: xiaodong_liang

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

Message 4 of 7
xiaodong_liang
in reply to: ngombault

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?

Message 5 of 7
ngombault
in reply to: xiaodong_liang

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

Message 6 of 7
ngombault
in reply to: ngombault

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

Message 7 of 7
xiaodong_liang
in reply to: ngombault

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. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report