Skip to content

Commit

Permalink
fix(rhino): disable Speckle when using Rhino.Inside.Revit, attempt #2 (
Browse files Browse the repository at this point in the history
  • Loading branch information
teocomi authored Sep 23, 2022
1 parent 1904e9c commit 5b60500
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using DesktopUI2.ViewModels;
using Rhino;
using Rhino.PlugIns;
using Rhino.Runtime;
using Speckle.Core.Api;

namespace SpeckleRhino
Expand Down Expand Up @@ -96,11 +97,16 @@ private void RhinoDoc_BeginOpenDocument(object sender, DocumentOpenEventArgs e)
/// </summary>
protected override LoadReturnCode OnLoad(ref string errorMessage)
{
// The user is probably using Rhino Inside and Avalonia was already initialized there
if (App.Current != null)
string processName = "";
System.Version processVersion = null;
HostUtils.GetCurrentProcessInfo(out processName, out processVersion);

// The user is probably using Rhino Inside and Avalonia was already initialized there or will be initialized later and will throw an error
// https://speckle.community/t/revit-command-failure-for-external-command/3489/27
if (!processName.Equals("rhino", StringComparison.InvariantCultureIgnoreCase))
{

errorMessage = "Speckle cannot be loaded in multiple application at the same time.";
errorMessage = "Speckle does not currently support Rhino.Inside";
RhinoApp.CommandLineOut.WriteLine(errorMessage);
return LoadReturnCode.ErrorNoDialog;
}
Expand Down

0 comments on commit 5b60500

Please sign in to comment.