Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion ExcelUI_Engine/Compute/ParseEnum.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -39,13 +39,20 @@ public static partial class Compute
/**** Public Methods ****/
/*******************************************/

[Description("Parses a string value to the specified enum type, matching either the enum member name or its description attribute.")]
[Input("value", "The string to parse into an enum value of type T.")]
[Output("enum", "The parsed enum value of type T, or the default value if no match is found.")]
public static T ParseEnum<T>(string value)
{
return (T)ParseEnum(typeof(T), value);
}

/*******************************************/

[Description("Parses a string value to the specified enum type, matching either the enum member name or its description attribute.")]
[Input("enumType", "The enum type to parse the string value into.")]
[Input("value", "The string to parse into an enum value.")]
[Output("enum", "The parsed enum value, or null if no match is found.")]
public static object ParseEnum(Type enumType, string value)
{
if (Enum.IsDefined(enumType, value))
Expand All @@ -69,3 +76,4 @@ public static object ParseEnum(Type enumType, string value)




59 changes: 14 additions & 45 deletions ExcelUI_Engine/ExcelUI_Engine.csproj
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{56039ED6-FBD5-4F45-936B-2116399AEEC3}</ProjectGuid>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BH.Engine.Excel</RootNamespace>
<AssemblyName>ExcelUI_Engine</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Build\</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>..\Build\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AssemblyTitle>ExcelUI_Engine</AssemblyTitle>
<Description>https://github.com/BHoM/Excel_UI</Description>
<Product>BHoM</Product>
<Copyright>Copyright � https://github.com/BHoM</Copyright>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<FileVersion>9.1.0.0</FileVersion>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(TargetPath)&quot; &quot;$(ProgramData)\BHoM\Assemblies&quot; /Y" />
</Target>
<ItemGroup>
<Reference Include="BHoM">
<HintPath>$(ProgramData)\BHoM\Assemblies\BHoM.dll</HintPath>
Expand All @@ -46,23 +31,7 @@
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<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" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="Compute\ParseEnum.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Query\ExcelUIWiki.cs" />
<Compile Include="Query\Explode.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetPath)" "$(ProgramData)\BHoM\Assemblies" /Y</PostBuildEvent>
</PropertyGroup>
</Project>
64 changes: 0 additions & 64 deletions ExcelUI_Engine/Properties/AssemblyInfo.cs

This file was deleted.

3 changes: 2 additions & 1 deletion ExcelUI_Engine/Query/ExcelUIWiki.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -50,3 +50,4 @@ public static string ExcelUIWiki(string page = null)
}
}


3 changes: 2 additions & 1 deletion ExcelUI_Engine/Query/Explode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -140,3 +140,4 @@ private static void GetPropertyDictionary(ref Dictionary<string, object> dict, o




6 changes: 3 additions & 3 deletions Excel_UI.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32126.317
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Excel_UI", "Excel_UI\Excel_UI.csproj", "{0FAF6FEB-80C3-474A-92BB-C886424CCBC8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Excel_UI", "Excel_UI\Excel_UI.csproj", "{0FAF6FEB-80C3-474A-92BB-C886424CCBC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelUI_Engine", "ExcelUI_Engine\ExcelUI_Engine.csproj", "{56039ED6-FBD5-4F45-936B-2116399AEEC3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExcelUI_Engine", "ExcelUI_Engine\ExcelUI_Engine.csproj", "{56039ED6-FBD5-4F45-936B-2116399AEEC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
3 changes: 2 additions & 1 deletion Excel_UI/Addin/AddIn.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -96,3 +96,4 @@ public static CallerFormula InstantiateCaller(string callerName, object selected




9 changes: 5 additions & 4 deletions Excel_UI/Addin/AddIn_BackwardCompatibility.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -77,15 +77,15 @@ private static List<Tuple<string, string>> Old_GetFormulas()
string callerType = "";
try
{
Range cell = row.Cells[1, 2];
Range cell = (Range)row.Cells[1, 2];
callerType = cell.Value.ToString();

int col = 3;
cell = row.Cells[1, col++];
cell = (Range)row.Cells[1, col++];
while (cell.Value != null && cell.Value is string && (cell.Value as string).Length > 0)
{
str += cell.Value;
cell = row.Cells[1, col++];
cell = (Range)row.Cells[1, col++];
}
}
catch { }
Expand All @@ -106,3 +106,4 @@ private static List<Tuple<string, string>> Old_GetFormulas()




3 changes: 2 additions & 1 deletion Excel_UI/Addin/AddIn_Converts.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -177,3 +177,4 @@ public static object[] ToExcel(object[] input)




25 changes: 13 additions & 12 deletions Excel_UI/Addin/AddIn_Formulas.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -104,9 +104,9 @@ public static void RestoreFormulas()
for (int i = 2; i < 10000; i++)
{
// Recover the information about the formula
string formulaName = sheet.Cells[i, 1].Value as string;
string callerJson = sheet.Cells[i, 2].Value as string;
string oldFunction = sheet.Cells[i, 3].Value as string;
string formulaName = ((Range)sheet.Cells[i, 1]).Value as string;
string callerJson = ((Range)sheet.Cells[i, 2]).Value as string;
string oldFunction = ((Range)sheet.Cells[i, 3]).Value as string;
if (formulaName == null || formulaName.Length == 0 || callerJson == null || callerJson.Length == 0)
break;

Expand Down Expand Up @@ -169,13 +169,13 @@ private static void UpdateEnumValues(string collectionName)
{
try
{
string name = choicesSheet.Cells[i, 1].Value as string;
string name = ((Range)choicesSheet.Cells[i, 1]).Value as string;
if (string.IsNullOrEmpty(name))
{
// Need to add the choices here - this should not be needed on loading a sheet, but as a safety net
choicesSheet.Cells[i, 1].Value = collectionName;
((Range)choicesSheet.Cells[i, 1]).Value = collectionName;
for (int j = 0; j < enumChoices.Length; j++)
choicesSheet.Cells[i, j + 2].Value = enumChoices.GetValue(j).ToString();
((Range)choicesSheet.Cells[i, j + 2]).Value = enumChoices.GetValue(j).ToString();
break;
}
else
Expand Down Expand Up @@ -247,11 +247,11 @@ private static void SaveCallerToHiddenSheet(CallerFormula caller)
lock(m_Mutex)
{
// Get teh sheet ID
string sheetId = sheet.Cells[1, 1].Value as string;
string sheetId = ((Range)sheet.Cells[1, 1]).Value as string;
if (sheetId == null)
{
sheetId = ToString(Guid.NewGuid());
sheet.Cells[1, 1].Value = sheetId;
((Range)sheet.Cells[1, 1]).Value = sheetId;
}

// Make sure there is a list of saved callers for this worksheet
Expand All @@ -264,9 +264,9 @@ private static void SaveCallerToHiddenSheet(CallerFormula caller)
m_SavedOnWorkbook[sheetId].Add(caller.Function);
int row = m_SavedOnWorkbook[sheetId].Count + 1;

sheet.Cells[row, 1].Value = caller.Caller.GetType().Name;
sheet.Cells[row, 2].Value = caller.Caller.Write();
sheet.Cells[row, 3].Value = caller.Function;
((Range)sheet.Cells[row, 1]).Value = caller.Caller.GetType().Name;
((Range)sheet.Cells[row, 2]).Value = caller.Caller.Write();
((Range)sheet.Cells[row, 3]).Value = caller.Function;
}
}
});
Expand Down Expand Up @@ -309,3 +309,4 @@ private static void UpgradeCellsFormula(CallerFormula formula, string oldFunctio




3 changes: 2 additions & 1 deletion Excel_UI/Addin/AddIn_GlobalSearch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -96,3 +96,4 @@ protected void GlobalSearch_ItemSelected(object sender, oM.UI.ComponentRequest e




7 changes: 4 additions & 3 deletions Excel_UI/Addin/AddIn_Internalise.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -107,7 +107,7 @@ private static void WriteJsonToSheet(string sheetName, Dictionary<string, object
{
try
{
sheet.Cells[index, 1].Value = json.Substring(i, Math.Min(characterLimit, json.Length - i));
((Range)sheet.Cells[index, 1]).Value = json.Substring(i, Math.Min(characterLimit, json.Length - i));
index++;
}
catch { }
Expand All @@ -129,7 +129,7 @@ private static Dictionary<string, object> ReadJsonFromSheet(string sheetName)
{
try
{
string segment = sheet.Cells[i, 1].Value as string;
string segment = ((Range)sheet.Cells[i, 1]).Value as string;
if (string.IsNullOrEmpty(segment))
break;
else
Expand Down Expand Up @@ -170,3 +170,4 @@ private static Dictionary<string, object> ReadJsonFromSheet(string sheetName)




3 changes: 2 additions & 1 deletion Excel_UI/Addin/AddIn_Objects.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2025, the respective contributors. All rights reserved.
* Copyright (c) 2015 - 2026, the respective contributors. All rights reserved.
*
* Each contributor holds copyright over their respective contributions.
* The project versioning (Git) records all such contribution source information.
Expand Down Expand Up @@ -130,3 +130,4 @@ private static string ToString(Guid id)




Loading