Skip to content

Commit

Permalink
Fix for Rhino 7
Browse files Browse the repository at this point in the history
  • Loading branch information
kike-garbo committed Dec 18, 2024
1 parent c8f4fe4 commit 9dbb7cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ private struct RunInCommandContextGuard : IDisposable
public RunInCommandContextGuard(GH_Document document)
{
Document = document;
RhinoDocument = document.RhinoDocument;
RhinoDocument = document.RhinoDocument();
DocumentWasModified = document.IsModified;
DocumentWasEnabled = document.Enabled;
SolverWasEnabled = GH_Document.EnableSolutions;
Expand Down Expand Up @@ -403,7 +403,7 @@ ref string message
)
{
if (definition is null) return Result.Failed;
if (definition.RhinoDocument is object && !definition.RhinoDocument.Equals(RhinoDoc.ActiveDoc)) return Result.Failed;
if (definition.RhinoDocument() is RhinoDoc rhinoDocument && rhinoDocument != RhinoDoc.ActiveDoc) return Result.Failed;

try
{
Expand Down
9 changes: 9 additions & 0 deletions src/RhinoInside.Revit.External/Extensions/Grasshopper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ public static bool KeepOpen(this GH_Document document)
return document.Properties.KeepOpen;
#else
return false;
#endif
}

public static Rhino.RhinoDoc RhinoDocument(this GH_Document document)
{
#if RHINO_8
return document.RhinoDocument;
#else
return Rhino.RhinoDoc.ActiveDoc;
#endif
}
}
Expand Down

0 comments on commit 9dbb7cd

Please sign in to comment.