添加项目文件。

This commit is contained in:
GG Z
2026-02-23 16:57:09 +08:00
parent 63b7094528
commit ebf06999d0
109 changed files with 7194 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.Attributes;
using System.Diagnostics;
using Autodesk.Windows;
namespace DotNet.Revit.InvokeCommand
{
[Transaction(TransactionMode.Manual)]
public class CmdInvoke : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
// 调用Look up Snoop Db
// Look up Snoop Db 命令Id通过下方执行下方命令CmdInvokeTest控制台输出查询。
InvokeHelper.Invoke("CustomCtrl_%CustomCtrl_%CustomCtrl_%Add-Ins%Revit Lookup%Options%Snoop Db..");
/* 调用右键菜单 - 区域放大
右键菜单的 命令Id 可在Revit日志内进行查询..*/
InvokeHelper.Invoke("ID_ZOOM_IN");
return Result.Succeeded;
}
}
[Transaction(TransactionMode.Manual)]
public class CmdInvokeTest : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
// 当命令控件点击执行后触发事件...
ComponentManager.ItemExecuted += ComponentManager_ItemExecuted;
return Result.Succeeded;
}
void ComponentManager_ItemExecuted(object sender, Autodesk.Internal.Windows.RibbonItemExecutedEventArgs e)
{
if (e.Item == null)
return;
// 获取命令Id
var id = UIFramework.ControlHelper.GetCommandId(e.Item);
Debug.WriteLine(string.Format("Text: {0} ID: {1}", e.Item.Text, id));
}
}
}

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F40BCA44-2737-4530-866C-B8ECB07696BE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DotNet.Revit.InvokeCommand</RootNamespace>
<AssemblyName>DotNet.Revit.InvokeCommand</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AdWindows">
<HintPath>..\..\..\..\CYBIM\CYCommons\References\Revit\16\AdWindows.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="RevitAPI">
<HintPath>..\..\..\..\CYBIM\CYCommons\References\Revit\16\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>..\..\..\..\CYBIM\CYCommons\References\Revit\16\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UIFramework">
<HintPath>..\..\..\..\CYBIM\CYCommons\References\Revit\16\UIFramework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UIFrameworkServices">
<HintPath>..\..\..\..\CYBIM\CYCommons\References\Revit\16\UIFrameworkServices.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="CmdInvoke.cs" />
<Compile Include="InvokeHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,40 @@
using Autodesk.Windows;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UIFramework;
using UIFrameworkServices;
namespace DotNet.Revit.InvokeCommand
{
public static class InvokeHelper
{
/// <summary>
/// 指定一个命令Id调用命令.
/// </summary>
/// <param name="id">命令控件的Id值</param>
/// <returns></returns>
public static bool Invoke(string cmdId)
{
if (ExternalCommandHelper.CanExecute(cmdId))
{
ExternalCommandHelper.executeExternalCommand(cmdId);
return true;
}
else if (CommandHandlerService.canExecute(cmdId))
{
CommandHandlerService.invokeCommandHandler(cmdId);
return true;
}
else
{
return false;
}
}
}
}

View File

@@ -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("DotNet.Revit.InvokeCommand")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DotNet.Revit.InvokeCommand")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[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("e719e43a-c846-4d27-a870-d984878f9615")]
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]