Files
speckle-sharp-connectors/Sdk/Speckle.Connectors.Common/HostApplications.cs
T
Mucahit Bilal GOKER a1f392a33b
.NET Build and Publish / build-connectors (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
feat: plant 3d connector (#1344)
* wip

* feat: data extraction from db

* Fallback conversions

* Fix line segments

* Fix: do not skip empty values

* Remove claude generated receive boilerplates and civil related extractor

* Fix compile errors and custom assembly resolver

* Guids for bundle

* Nuget

* Use TagValue as object name

* add plant3d to slnx (#1347)

* add plant3d to slnx

* format

* and the local (#1348)

* Resolve comments

* final comments

* lockfiles

* don't swallow image exception

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
2026-04-02 16:20:49 +01:00

108 lines
3.0 KiB
C#

using System.Text.RegularExpressions;
using Speckle.Sdk;
namespace Speckle.Connectors.Common;
public static class HostApplications
{
public static string GetVersion(HostAppVersion version) => version.ToString().TrimStart('v');
public static readonly Application Rhino = new("Rhino", "rhino"),
Grasshopper = new("Grasshopper", "grasshopper"),
Revit = new("Revit", "revit"),
Dynamo = new("Dynamo", "dynamo"),
Unity = new("Unity", "unity"),
GSA = new("GSA", "gsa"),
Civil = new("Civil 3D", "civil3d"),
Civil3D = new("Civil 3D", "civil3d"),
AutoCAD = new("AutoCAD", "autocad"),
Plant3D = new("Plant 3D", "plant3d"),
MicroStation = new("MicroStation", "microstation"),
OpenRoads = new("OpenRoads", "openroads"),
OpenRail = new("OpenRail", "openrail"),
OpenBuildings = new("OpenBuildings", "openbuildings"),
ETABS = new("ETABS", "etabs"),
SAP2000 = new("SAP2000", "sap2000"),
CSiBridge = new("CSiBridge", "csibridge"),
SAFE = new("SAFE", "safe"),
TeklaStructures = new("Tekla Structures", "teklastructures"),
Dxf = new("DXF Converter", "dxf"),
Excel = new("Excel", "excel"),
Unreal = new("Unreal", "unreal"),
PowerBI = new("Power BI", "powerbi"),
Blender = new("Blender", "blender"),
QGIS = new("QGIS", "qgis"),
ArcGIS = new("ArcGIS", "arcgis"),
SketchUp = new("SketchUp", "sketchup"),
Archicad = new("Archicad", "archicad"),
TopSolid = new("TopSolid", "topsolid"),
Python = new("Python", "python"),
NET = new(".NET", "net"),
Navisworks = new("Navisworks", "navisworks"),
AdvanceSteel = new("Advance Steel", "advancesteel"),
Other = new("Other", "other");
/// <summary>
/// Gets a slug from a host application name and version.
/// </summary>
/// <param name="appName">Application name with its version, e.g., "Rhino 7", "Revit 2024".</param>
/// <remarks>This function is soon to be needed only for backwards compatibility</remarks>
/// <returns>Slug string.</returns>
public static string GetSlugFromHostAppNameAndVersion(string appName)
{
if (string.IsNullOrWhiteSpace(appName))
{
return "other";
}
// Remove whitespace and convert to lowercase
appName = Regex.Replace(appName.ToLowerInvariant(), @"\s+", "");
var keywords = new List<string>
{
"dynamo",
"revit",
"autocad",
"civil",
"rhino",
"grasshopper",
"unity",
"gsa",
"microstation",
"openroads",
"openrail",
"openbuildings",
"etabs",
"sap",
"csibridge",
"safe",
"teklastructures",
"dxf",
"excel",
"unreal",
"powerbi",
"blender",
"qgis",
"arcgis",
"sketchup",
"archicad",
"topsolid",
"python",
"net",
"navisworks",
"advancesteel",
"fileImport",
};
foreach (var keyword in keywords)
{
if (appName.Contains(keyword))
{
return keyword;
}
}
return appName;
}
}