forked from chuongmep/NwLookup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
308 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ dlldata.c | |
*.pidb | ||
*.svclog | ||
*.scc | ||
|
||
*.dll | ||
# Chutzpah Test files | ||
_Chutzpah* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters