<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Hide items? in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315215#M7717</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Odd. Swear I tried to add those earlier and no dice... But added them just now and it's recognising the InwOpSelection classes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not happy with moState and moSelection though. How should I create these?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2012 08:35:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-02-02T08:35:09Z</dc:date>
    <item>
      <title>Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3313411#M7713</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Coding a plugin under C#. Have code in place to nicely find and select an object, but now I want to hide all the objects in the model that aren't the one I'm looking at.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to do this? Essentially I want to trigger the hideUnselected option in the menubar, but can't find a way to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on how to make the camera jump to a selected item would also be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;-Stuart&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2012 06:17:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3313411#M7713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-01T06:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3313921#M7714</link>
      <description>&lt;P&gt;Approach 1 : Get a copy of the CurrentSelection, which holds the item you selected. Invert it, so it contains the entire model except the actually selected item.&lt;/P&gt;&lt;PRE&gt;InwOpState10 myState = Autodesk.Navisworks.Api.ComApi.ComApiBridge.State;
mySelection = (InwOpSelection2)moState.ObjectFactory(Autodesk.Navisworks.Api.Interop.ComApi.nwEObjectType.eObjectType_nwOpSelection, null, null);
mySelection.SelectAll();
mySelection.SubtractContents(moState.CurrentSelection);
myState.set_SelectionHidden(moSelection, true);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Approach 2&amp;nbsp;:Create a InwOpSelection object, use the SelectAll method and then remove the selected item.&lt;/P&gt;&lt;PRE&gt;InwOpState10 myState = Autodesk.Navisworks.Api.ComApi.ComApiBridge;moSelection = (InwOpSelection2)
mySelection = (InwOpSelection) myState.ObjectFactory(Autodesk.Navisworks.Api.Interop.ComApi.nwEObjectType.eObjectType_nwOpSelection, null, null);
moSelection.SelectAll();
moSelection.SubtractContents(moState.CurrentSelection);
moState.set_SelectionHidden(moSelection, true);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;And zoom the camera:&lt;/P&gt;&lt;PRE&gt;moState.ZoomInCurViewOnSel();
// or zoom on Selection containing the selected item
moState.ZoomInCurViewOnSel(mySelectedItemSelection);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Hope this works in plugins as well, I have written only one plugin to see if it works. And it was a long time ago, so I am not sure what API is available in plugins.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2012 14:43:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3313921#M7714</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-01T14:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3314977#M7715</link>
      <description>&lt;P&gt;Unfortunately it doesn't look like I have access to InwOpState10 when developing a plugin. Will continue to play around with it in case I'm missing something....&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2012 00:34:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3314977#M7715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-02T00:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315159#M7716</link>
      <description>&lt;P&gt;Add reference to other assemblies like&amp;nbsp;&lt;FONT face="courier new,courier"&gt;Autodesk.Navisworks.Interop.CompApi&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;Autodesk.Navisworks.Api&lt;/FONT&gt; etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also the examples in &lt;FONT face="courier new,courier"&gt;C:\Program Files\Autodesk\Navisworks Simulate 2011\api\net\examples\PlugIns &lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;may be of a great help. But I think you are aware of these.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Good luck.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2012 07:38:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315159#M7716</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-02T07:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315215#M7717</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Odd. Swear I tried to add those earlier and no dice... But added them just now and it's recognising the InwOpSelection classes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not happy with moState and moSelection though. How should I create these?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2012 08:35:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315215#M7717</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-02T08:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315437#M7718</link>
      <description>&lt;P&gt;It is not happy with those &lt;FONT face="courier new,courier"&gt;moState&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;moSelection&lt;/FONT&gt; because I have mistyped them. They should be &lt;FONT face="courier new,courier"&gt;myState&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;mySelection&lt;/FONT&gt;. And I have made another mistake. But I have just created a small plugin and tested it so I can confirm the functionality of following code. I have Simulate 2011 x86.&lt;/P&gt;&lt;PRE&gt;    // Get a hold of the state object (it is a singleton)
InwOpState10 myState = Autodesk.Navisworks.Api.ComApi.ComApiBridge.State;
    // Create a copy of current selection
InwOpSelection2 myCurrentSelection = myState.CurrentSelection.Copy() as InwOpSelection2;
    // Create a new empty selection
InwOpSelection2 myRestOfModel = myState.ObjectFactory(nwEObjectType.eObjectType_nwOpSelection, null, null) as InwOpSelection2;
    // Get the new selection to contain the entire model
myRestOfModel.SelectAll();
    // Subtract the current selection, so it contains the unselected part of model
myRestOfModel.SubtractContents(myCurrentSelection);
    // Make the unselected part of model invisible
myState.set_SelectionHidden(myRestOfModel, true);
    // Zoom on the currently selected part of model
myState.ZoomInCurViewOnCurSel();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I included a sample Visual Studio Project. In the zip you will also find a &lt;FONT face="courier new,courier"&gt;Plugin01.dll&lt;/FONT&gt; which you may copy to a a &lt;FONT face="courier new,courier"&gt;Plugins\Plugin01&lt;/FONT&gt; subdirectory of the Simulate 2011 directory, which in my case means&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;C:\Program Files\Autodesk\Navisworks Simulate 2011\Plugins\Plugin01&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Run the program and the plugin to make the unselected part of the model invisible and zoom on the selected part.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Enjoy.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2012 12:59:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315437#M7718</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-02T12:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315753#M7719</link>
      <description>&lt;P&gt;Hi Dude&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did this 2 weeks ago,&amp;nbsp; i hope help you....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Create hidden collection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelItemCollection hidden = new ModelItemCollection();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //create a store for the visible items&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelItemCollection visible = new ModelItemCollection();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add all the items that are visible to the visible collection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ModelItem item in Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.SelectedItems)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.AncestorsAndSelf != null)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; visible.AddRange(item.AncestorsAndSelf);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.Descendants != null)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; visible.AddRange(item.Descendants);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //mark as invisible all the siblings of the visible items as well as the visible items&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ModelItem toShow in visible)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (toShow.Parent != null)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hidden.AddRange(toShow.Parent.Children);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //remove the visible items from the collection&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ModelItem toShow in visible)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hidden.Remove(toShow);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //hide the remaining items&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Autodesk.Navisworks.Api.Application.ActiveDocument.Models.SetHidden(hidden, true);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hide the unselected items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sergio&amp;nbsp; Franco.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:34:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3315753#M7719</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-02T15:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Hide items?</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3316561#M7720</link>
      <description>&lt;P&gt;Sergio, Warran, you are both amazing. Thank you very, very much.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2012 00:09:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/hide-items/m-p/3316561#M7720</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-03T00:09:31Z</dc:date>
    </item>
  </channel>
</rss>

