Navisworks API

Reply
Contributor
karteek.iitm
Posts: 12
Registered: ‎02-24-2012
Message 1 of 12 (317 Views)

Hide model items

317 Views, 11 Replies
01-10-2013 10:45 PM

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.

ADN Support Specialist
xiaodong.liang
Posts: 1,299
Registered: ‎06-12-2011
Message 2 of 12 (309 Views)

Re: Hide model items

01-10-2013 11:04 PM in reply to: karteek.iitm

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



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
karteek.iitm
Posts: 12
Registered: ‎02-24-2012
Message 3 of 12 (301 Views)

Re: Hide model items

01-11-2013 12:41 AM in reply to: xiaodong.liang

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.
Contributor
karteek.iitm
Posts: 12
Registered: ‎02-24-2012
Message 4 of 12 (300 Views)

Re: Hide model items

01-11-2013 12:42 AM in reply to: karteek.iitm

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

ADN Support Specialist
xiaodong.liang
Posts: 1,299
Registered: ‎06-12-2011
Message 5 of 12 (290 Views)

Re: Hide model items

01-13-2013 11:01 PM in reply to: karteek.iitm

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.



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
karteek.iitm
Posts: 12
Registered: ‎02-24-2012
Message 6 of 12 (280 Views)

Re: Hide model items

01-18-2013 03:44 AM in reply to: xiaodong.liang

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.

ADN Support Specialist
xiaodong.liang
Posts: 1,299
Registered: ‎06-12-2011
Message 7 of 12 (264 Views)

Re: Hide model items

01-21-2013 09:33 PM in reply to: karteek.iitm

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.

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
karteek.iitm
Posts: 12
Registered: ‎02-24-2012
Message 8 of 12 (258 Views)

Re: Hide model items

01-22-2013 04:51 AM in reply to: xiaodong.liang

That helps a lot. Thank you for the information. 

Active Member
dickinsjohn
Posts: 7
Registered: ‎02-24-2013
Message 9 of 12 (230 Views)

Re: Hide model items

02-24-2013 11:22 AM in reply to: karteek.iitm

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

ADN Support Specialist
xiaodong.liang
Posts: 1,299
Registered: ‎06-12-2011
Message 10 of 12 (210 Views)

Re: Hide model items

02-26-2013 05:01 PM in reply to: dickinsjohn

Hi dickinsjohn,

 

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



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.