mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-08-16 18:44:03 +00:00
integrate Revit 2025 SDK
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
// (C) Copyright 2003-2023 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
@@ -65,24 +65,25 @@ namespace Revit.SDK.Samples.EnergyAnalysisModel.CS
|
||||
Transaction trans = new Transaction(commandData.Application.ActiveUIDocument.Document, "Revit.SDK.Samples.EnergyAnalysisModel");
|
||||
trans.Start();
|
||||
// Create an object that is responsible for collecting users inputs and getting analysis data of current model.
|
||||
EnergyAnalysisModel analysisModel = new EnergyAnalysisModel(commandData.Application.ActiveUIDocument.Document);
|
||||
|
||||
// Create the UI for users inputs options and view analysis models.
|
||||
using (OptionsAndAnalysisForm form = new OptionsAndAnalysisForm(analysisModel))
|
||||
using (EnergyAnalysisModel analysisModel = new EnergyAnalysisModel(commandData.Application.ActiveUIDocument.Document))
|
||||
{
|
||||
// make analysis data ready
|
||||
analysisModel.Initialize();
|
||||
// show dialog to browser analysis model
|
||||
if (DialogResult.OK != form.ShowDialog())
|
||||
{
|
||||
trans.RollBack();
|
||||
return Result.Cancelled;
|
||||
}
|
||||
// Create the UI for users inputs options and view analysis models.
|
||||
using (OptionsAndAnalysisForm form = new OptionsAndAnalysisForm(analysisModel))
|
||||
{
|
||||
// make analysis data ready
|
||||
analysisModel.Initialize();
|
||||
// show dialog to browser analysis model
|
||||
if (DialogResult.OK != form.ShowDialog())
|
||||
{
|
||||
trans.RollBack();
|
||||
return Result.Cancelled;
|
||||
}
|
||||
}
|
||||
trans.Commit();
|
||||
return Result.Succeeded;
|
||||
}
|
||||
trans.Commit();
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// (C) Copyright 2003-2019 by Autodesk, Inc.
|
||||
// (C) Copyright 2003-2023 by Autodesk, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, and distribute this software in
|
||||
// object code form for any purpose and without fee is hereby granted,
|
||||
@@ -32,27 +32,18 @@ using Autodesk.Revit.DB.Structure;
|
||||
|
||||
namespace Revit.SDK.Samples.EnergyAnalysisModel.CS
|
||||
{
|
||||
public class EnergyAnalysisModel
|
||||
public class EnergyAnalysisModel : IDisposable
|
||||
{
|
||||
// An EnergyAnalysisDetailModel member that can get all analysis data includes surfaces, spaces and openings.
|
||||
private EnergyAnalysisDetailModel m_energyAnalysisDetailModel;
|
||||
|
||||
// Options for Energy Analysis process
|
||||
private EnergyAnalysisDetailModelOptions m_options;
|
||||
public EnergyAnalysisDetailModelOptions m_options;
|
||||
|
||||
// revit document
|
||||
private Document RevitDoc;
|
||||
|
||||
// Options Property
|
||||
public EnergyAnalysisDetailModelOptions Options
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_options;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_options = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool disposedValue;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
@@ -61,7 +52,7 @@ namespace Revit.SDK.Samples.EnergyAnalysisModel.CS
|
||||
public EnergyAnalysisModel(Document doc)
|
||||
{
|
||||
RevitDoc = doc;
|
||||
m_options = new EnergyAnalysisDetailModelOptions();
|
||||
this.m_options = new EnergyAnalysisDetailModelOptions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -231,13 +222,33 @@ namespace Revit.SDK.Samples.EnergyAnalysisModel.CS
|
||||
m_options.Tier = EnergyAnalysisDetailModelTier.NotComputed;
|
||||
break;
|
||||
case "SecondLevelBoundaries":
|
||||
m_options.Tier = Autodesk.Revit.DB.Analysis.EnergyAnalysisDetailModelTier.SecondLevelBoundaries;
|
||||
m_options.Tier = EnergyAnalysisDetailModelTier.SecondLevelBoundaries;
|
||||
break;
|
||||
// the default Tier is SecondLevelBoundaries
|
||||
default:
|
||||
m_options.Tier = Autodesk.Revit.DB.Analysis.EnergyAnalysisDetailModelTier.SecondLevelBoundaries;
|
||||
m_options.Tier = EnergyAnalysisDetailModelTier.SecondLevelBoundaries;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
m_options?.Dispose();
|
||||
m_energyAnalysisDetailModel?.Dispose();
|
||||
}
|
||||
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,96 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project Sdk="">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{028B7EED-3CAE-4D38-9254-82B2F7083CA4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>EnergyAnalysisModel</RootNamespace>
|
||||
<AssemblyName>EnergyAnalysisModel</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>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.Sdk.props" />
|
||||
<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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Command.cs" />
|
||||
<Compile Include="EnergyAnalysisModel.cs" />
|
||||
<Compile Include="OptionsAndAnalysisForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="OptionsAndAnalysisForm.Designer.cs">
|
||||
<DependentUpon>OptionsAndAnalysisForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="OptionsAndAnalysisForm.resx">
|
||||
<DependentUpon>OptionsAndAnalysisForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.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>
|
||||
-->
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.Sdk.targets" />
|
||||
<PropertyGroup>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Revit.SDK.Samples.EnergyAnalysisModel.CS
|
||||
{
|
||||
public partial class OptionsAndAnalysisForm : Form
|
||||
{
|
||||
EnergyAnalysisModel m_model = null;
|
||||
EnergyAnalysisModel m_model;
|
||||
public OptionsAndAnalysisForm(EnergyAnalysisModel analysisModel)
|
||||
{
|
||||
m_model = analysisModel;
|
||||
@@ -45,9 +45,9 @@ namespace Revit.SDK.Samples.EnergyAnalysisModel.CS
|
||||
{
|
||||
// get UI input of options
|
||||
m_model.SetTier(this.comboBoxTier.SelectedText);
|
||||
m_model.Options.ExportMullions = this.checkBoxExportMullions.Checked;
|
||||
m_model.Options.IncludeShadingSurfaces = this.checkBoxIncludeShadingSurfaces.Checked;
|
||||
m_model.Options.SimplifyCurtainSystems = this.checkBoxSimplifyCurtainSystems.Checked;
|
||||
m_model.m_options.ExportMullions = this.checkBoxExportMullions.Checked;
|
||||
m_model.m_options.IncludeShadingSurfaces = this.checkBoxIncludeShadingSurfaces.Checked;
|
||||
m_model.m_options.SimplifyCurtainSystems = this.checkBoxSimplifyCurtainSystems.Checked;
|
||||
|
||||
m_model.Initialize();
|
||||
m_model.RefreshAnalysisData(treeViewAnalyticalData);
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Autodesk, Inc.")]
|
||||
[assembly: AssemblyProduct("EnergyAnalysisModel")]
|
||||
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2011")]
|
||||
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -34,3 +34,5 @@ using System.Runtime.InteropServices;
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
[assembly: System.Runtime.Versioning.SupportedOSPlatformAttribute("windows7.0")]
|
||||
|
||||
Reference in New Issue
Block a user