• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Navisworks API

    Reply
    Contributor
    karteek.iitm
    Posts: 12
    Registered: ‎02-24-2012

    Hide model items

    189 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.

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 813
    Registered: ‎06-12-2011

    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

    Please use plain text.
    Contributor
    karteek.iitm
    Posts: 12
    Registered: ‎02-24-2012

    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.
    Please use plain text.
    Contributor
    karteek.iitm
    Posts: 12
    Registered: ‎02-24-2012

    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.

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 813
    Registered: ‎06-12-2011

    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

    Please use plain text.
    Contributor
    karteek.iitm
    Posts: 12
    Registered: ‎02-24-2012

    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.

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 813
    Registered: ‎06-12-2011

    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

    Please use plain text.
    Contributor
    karteek.iitm
    Posts: 12
    Registered: ‎02-24-2012

    Re: Hide model items

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

    That helps a lot. Thank you for the information. 

    Please use plain text.
    Active Member
    Posts: 7
    Registered: ‎02-24-2013

    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.

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 813
    Registered: ‎06-12-2011

    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

    Please use plain text.