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: 

Hide model items

11 REPLIES 11
Reply
Message 1 of 12
karteek.iitm
687 Views, 11 Replies

Hide model items

Hi,

 

I am trying to read selection items for tasks in timeliner and trying to hide them using API.

this is the code for the same.

 

foreach (Tl.TimelinerTask oTask in tl_doc.Tasks)
{
      DateTime date2 = oTask.ActualStartDate.Value.Date;
      int result = DateTime.Compare(date1, date2);
      if (result > 0 || result == 0)
     {
          Tl.TimelinerSelection oTlSel = oTask.Selection;

         if (oTlSel != null)
                {
                         if (oTlSel.HasExplicitSelection)
                                  {
                                     Nw.ModelItemCollection oExplicitSel = oTlSel.ExplicitSelection;
                                   }

                                   Autodesk.Navisworks.Api.Application.ActiveDocument.Models.SetHidden(oExplicitSel, false);
                 }
       }
}

 

But when i debug the program it says "the name 'oExplicitSele' does not exist in the current context. Can anyone please explain how to hide selection items attached to a task.

11 REPLIES 11
Message 2 of 12

It is C# and you are using oExplicitSel in the brackets,  right? I beleive you have figured it out after posting the question 🙂

Message 3 of 12

Thank you for your reply Mr. Xiaodong Liang.

 

When i run the code I am facing the following error (although i added the dll as a refrence in thr app). Can you please explain why this is happening.

 

System.IO.FileNotFoundException: Could not load file or assembly 'Autodesk.Navisworks.Timeliner.dll' or one of its dependencies. The specified module could not be found.
Message 4 of 12
karteek.iitm
in reply to: karteek.iitm

I have also added all the dependencies through .net reflector.

Message 5 of 12

Please take a look at this post. Hope you could find what you missed.

 

http://adndevblog.typepad.com/aec/2012/10/timeliner-api-part1.html

 

In addition, please switch the .NET framework to 4.0 if it helps.

Message 6 of 12

I developed my code based on the link which you have provided and did not miss anything.

.NET Framework 4.0 does not help too.

Message 7 of 12

So, I believe your app is a standalone EXE of .NET control. Unfortunately TimeLiner/ClashTest has not exposed to .NET control. you can only use them in a plugin.

 

The possible way I can think of is: you create an automation and plugin. plugin accesses timeliner and writes the info you need into a temporary file. When your app of .Net control wants to get timeliner info, it launches the automation, the automation starts a process of Navisworks (invisible), executes the plugin. finally, the app pf .Net control reads the temporary file and gets the info.

 

Message 8 of 12

That helps a lot. Thank you for the information. 

Message 9 of 12
dickinsjohn
in reply to: karteek.iitm

you havent included the .dll file in references. please find it in navisworks freedom folder. cheers.

Message 10 of 12

Hi dickinsjohn,

 

I am not sure which question you are answering. But please note: no API for Freedom.

Message 11 of 12

Sir I am talking about the following error.

"the name 'oExplicitSele'

 

I had the same issue. i couldnt find the timeliner api .dll file in api folder of navis manage. i had to include it from the freedom folder to resolve the error.

Message 12 of 12

hum...no dll in Manage? sounds strange to me. I suspect this is an issue with the installer.

 

In the original question in this thread, the code demo obviously shows the variable oExplicitSele is defined within the brackets, but karteek.iitm wanted to use it outside of the region. That looks just a simple compiling error to me. 

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

Post to forums  

Rail Community


Autodesk Design & Make Report