Skip to content

Commit

Permalink
Support Navis 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed Feb 18, 2022
1 parent 6804445 commit 66a450a
Show file tree
Hide file tree
Showing 15 changed files with 308 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ dlldata.c
*.pidb
*.svclog
*.scc

*.dll
# Chutzpah Test files
_Chutzpah*

Expand Down
14 changes: 12 additions & 2 deletions NwLookup.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.1.32203.90
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NwLookup.v18", "NwLookup.v18\NwLookup.v18.csproj", "{B0C56007-B6E4-4A89-8E61-D37D2AFE8BE0}"
EndProject
Expand All @@ -22,6 +22,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NwLookup.v20", "NwLookup.v2
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "NwLookup_Setup", "NwLookup_Setup\NwLookup_Setup.wixproj", "{0CEA8009-A942-43B4-8E1D-22610289F902}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NwLookup.v22", "NwLookup.v22\NwLookup.v22.csproj", "{E514F1FF-F68C-4996-A55D-90C297C5A999}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -73,6 +75,14 @@ Global
{0CEA8009-A942-43B4-8E1D-22610289F902}.Release|x64.Build.0 = Release|x86
{0CEA8009-A942-43B4-8E1D-22610289F902}.Release|x86.ActiveCfg = Release|x86
{0CEA8009-A942-43B4-8E1D-22610289F902}.Release|x86.Build.0 = Release|x86
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Debug|x64.ActiveCfg = Debug|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Debug|x64.Build.0 = Debug|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Debug|x86.ActiveCfg = Debug|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Debug|x86.Build.0 = Debug|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Release|x64.ActiveCfg = Release|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Release|x64.Build.0 = Release|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Release|x86.ActiveCfg = Release|x64
{E514F1FF-F68C-4996-A55D-90C297C5A999}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
63 changes: 63 additions & 0 deletions NwLookup.v22/Application.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
using NwLookup.Snoop.Datas;
using NwLookup.v22.Snoop.Collectors;
using ComApi = Autodesk.Navisworks.Api.Interop.ComApi;

namespace NwLookup.v22
{
[Plugin("NwLookup.v22.Application", "AMCC", DisplayName = "Snoop")]
[Strings("NwLookupDefinitions.txt")]
[RibbonLayout("NwLookupLayout.xaml")]
[RibbonTab("ID_NWLOOKUP_TAB")]
[Command("NWLOOKUP_SNOOP_COMMAND",
Icon = "resources\\mg_16x16.ico",
LargeIcon = "resources\\mg_32x32.ico",
CallCanExecute = CallCanExecute.Always,
CanToggle = true,
LoadForCanExecute = true)]
public class Application : CommandHandlerPlugin
{
public override int ExecuteCommand(string name, params string[] parameters)
{
switch (name)
{
case "NWLOOKUP_SNOOP_COMMAND":
NwLookupCommand();
break;
default:
break;
}

return 0;
}

public override CommandState CanExecuteCommand(string name)
{
switch (name)
{
case "NWLOOKUP_SNOOP_COMMAND":
return new CommandState(true);
default:
throw new NotImplementedException(
string.Format("Command with name {0} is not implemented", name)
);
}
}

private void NwLookupCommand()
{
// Force loading of the Interop.ComApi assembly so that it will be included when
// the 'Types' call is made in reflection utils
GC.KeepAlive(typeof(ComApi.InwBase));
Document document = Autodesk.Navisworks.Api.Application.ActiveDocument;
Data data;
if (document.CurrentSelection.SelectedItems.IsEmpty)
data = DataFactory.Create(document);
else
data = DataFactory.Create(document.CurrentSelection.SelectedItems);
data.Snoop(new CustomCollector());
}
}
}
103 changes: 103 additions & 0 deletions NwLookup.v22/NwLookup.v22.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<ProjectGuid>{E514F1FF-F68C-4996-A55D-90C297C5A999}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NwLookup.v22</RootNamespace>
<AssemblyName>NwLookup.v22</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetYear>2022</TargetYear>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autodesk.Navisworks.Api">
<HintPath>lib\Autodesk.Navisworks.Api.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Autodesk.Navisworks.ComApi">
<HintPath>lib\Autodesk.Navisworks.ComApi.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
<Private>False</Private>
</Reference>
<Reference Include="Autodesk.Navisworks.Interop.ComApi">
<HintPath>lib\Autodesk.Navisworks.Interop.ComApi.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Application.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Snoop\Collectors\CustomCollector.cs" />
<Compile Include="Snoop\Collectors\ModelItemStreamPass.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NwLookup\NwLookup.csproj">
<Project>{875544e5-cd02-4e38-8e32-3016edf47027}</Project>
<Name>NwLookup</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="en-US\NwLookupDefinitions.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="en-US\NwLookupLayout.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="resources\mg_16x16.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="resources\mg_32x32.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\Tools\ExtraCleanup.targets" />
<Import Project="$(SolutionDir)\Tools\Build.events" />
</Project>
36 changes: 36 additions & 0 deletions NwLookup.v22/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NwLookup.v22")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AMCC")]
[assembly: AssemblyProduct("NwLookup.v22")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("AF42C1C1-044A-421A-A39F-4A6115B6572E")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2022.0.0.0")]
[assembly: AssemblyFileVersion("2022.0.0.0")]
14 changes: 14 additions & 0 deletions NwLookup.v22/Snoop/Collectors/CustomCollector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.Generic;
using NwLookup.Snoop.Collectors;

namespace NwLookup.v22.Snoop.Collectors
{
public class CustomCollector : Collector
{
public CustomCollector()
: base(new List<IStreamPass>{
new DefaultStreamPass(),
new ModelItemStreamPass()
}) { }
}
}
21 changes: 21 additions & 0 deletions NwLookup.v22/Snoop/Collectors/ModelItemStreamPass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections.Generic;
using Autodesk.Navisworks.Api;
using NwLookup.Snoop.Collectors;
using NwLookup.Snoop.Datas;
using ComApi = Autodesk.Navisworks.Api.Interop.ComApi;
using ComBridge = Autodesk.Navisworks.Api.ComApi.ComApiBridge;

namespace NwLookup.v22.Snoop.Collectors
{
public class ModelItemStreamPass : StreamPassBase
{
public override bool CanRun(object obj)
=> obj is ModelItem;

public override void Stream(IList<Data> datas, object obj)
{
ComApi.InwOaPath path = ComBridge.ToInwOaPath((ModelItem)obj);
StreamInternal(datas, path);
}
}
}
6 changes: 6 additions & 0 deletions NwLookup.v22/en-US/NwLookupDefinitions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Local names for ribbon tab, panel, and controls
$utf8

ID_NWLOOKUP_TAB.DisplayName=NwLookup

NWLOOKUP_SNOOP_COMMAND.DisplayName=Snoop
16 changes: 16 additions & 0 deletions NwLookup.v22/en-US/NwLookupLayout.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RibbonControl x:Uid="UID_NWLOOKUP_RIBBON_CONTROL"
xmlns="clr-namespace:Autodesk.Windows;assembly=AdWindows"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:nvw="clr-namespace:Autodesk.Navisworks.Gui.Roamer.AIRLook;assembly=navisworks.gui.roamer">
<RibbonTab Id="ID_NWLOOKUP_TAB" Title="NwLookup">
<RibbonPanel x:Uid="UID_SNOOP_PANEL">
<RibbonPanelSource x:Uid="UID_NWLOOKUP_TAB_SNOOP_PANEL_SOURCE" Title="Snoop">
<nvw:NWRibbonButton x:Uid="UID_NWLOOKUP_TAB_SNOOP_PANEL_SNOOP_BUTTON" Id="NWLOOKUP_SNOOP_COMMAND"
Size="Large"
ShowText="True"
Orientation = "Vertical"/>
</RibbonPanelSource>
</RibbonPanel>
</RibbonTab>
</RibbonControl>
Binary file added NwLookup.v22/resources/mg_16x16.ico
Binary file not shown.
Binary file added NwLookup.v22/resources/mg_32x32.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions NwLookup_Setup/Directories.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<Directory Id="D_2021_Resources" Name="resources" />
<Directory Id="D_2021_enUS" Name="en-US" />
</Directory>
<Directory Id="D_2022" Name="2022">
<Directory Id="D_2022_Resources" Name="resources" />
<Directory Id="D_2022_enUS" Name="en-US" />
</Directory>
</Directory>
</Directory>
</Directory>
Expand Down
25 changes: 25 additions & 0 deletions NwLookup_Setup/Files.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,30 @@
<File Id="F_NwLookupLayout21" Name="NwLookupLayout.xaml" />
</Component>
</DirectoryRef>
<!--2022-->
<ComponentGroup Id="CG_2022">
<ComponentRef Id="CF_Main22" />
<ComponentRef Id="CF_Resources22" />
<ComponentRef Id="CF_enUS22" />
</ComponentGroup>
<DirectoryRef Id="D_2022" FileSource="..\NwLookup.v22\bin\x64\Release\">
<Component Id="CF_Main22" Guid="105E3C57-D2A8-441D-B175-3D03DB76176C" KeyPath="yes">
<File Id="F_NwLookup22" Name="NwLookup.dll" />
<File Id="F_NwLookup_v22" Name="NwLookup.v22.dll" />
<File Id="F_System.ValueTuple22" Name="System.ValueTuple.dll" />
</Component>
</DirectoryRef>
<DirectoryRef Id="D_2022_Resources" FileSource="..\NwLookup.v22\bin\x64\Release\resources\">
<Component Id="CF_Resources22" Guid="842FAA3E-5404-406E-9894-B18949513758" KeyPath="yes">
<File Id="F_mg_16x16_22" Name="mg_16x16.ico" />
<File Id="F_mg_32x32_22" Name="mg_32x32.ico" />
</Component>
</DirectoryRef>
<DirectoryRef Id="D_2022_enUS" FileSource="..\NwLookup.v22\bin\x64\Release\en-US\">
<Component Id="CF_enUS22" Guid="AF42C1C1-044A-421A-A39F-4A6115B6572E" KeyPath="yes">
<File Id="F_NwLookupDefinitions22" Name="NwLookupDefinitions.txt" />
<File Id="F_NwLookupLayout22" Name="NwLookupLayout.xaml" />
</Component>
</DirectoryRef>
</Fragment>
</Wix>
3 changes: 3 additions & 0 deletions NwLookup_Setup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<Feature Id="F_Lookup_Plugin_21" Title="Navisworks Manage 2021" Level="1">
<ComponentGroupRef Id="CG_2021" />
</Feature>
<Feature Id="F_Lookup_Plugin_22" Title="Navisworks Manage 2022" Level="1">
<ComponentGroupRef Id="CG_2022" />
</Feature>
<Feature Id="F_Lookup_xml" Absent="disallow" Display="hidden" Level="1">
<ComponentGroupRef Id="CG_xml" />
</Feature>
Expand Down
4 changes: 4 additions & 0 deletions PackageContents.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@
<RuntimeRequirements OS="Win64" Platform="NAVMAN" SeriesMin="Nw18" SeriesMax="Nw18" />
<ComponentEntry AppName="NwLookup" AppType="ManagedPlugin" ModuleName="./Contents/2021/NwLookup.v21.dll" />
</Components>
<Components Description="Navisworks 2022 parts">
<RuntimeRequirements OS="Win64" Platform="NAVMAN" SeriesMin="Nw19" SeriesMax="Nw19" />
<ComponentEntry AppName="NwLookup" AppType="ManagedPlugin" ModuleName="./Contents/2022/NwLookup.v22.dll" />
</Components>
</ApplicationPackage>

0 comments on commit 66a450a

Please sign in to comment.