-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
grasshopper/cs/GrasshopperWatcherExample/AssemblyPriority.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Grasshopper; | ||
|
||
namespace GrasshopperWatcherExample | ||
{ | ||
public class AssemblyPriority : Grasshopper.Kernel.GH_AssemblyPriority | ||
{ | ||
public override Grasshopper.Kernel.GH_LoadingInstruction PriorityLoad() | ||
{ | ||
// https://developer.rhino3d.com/api/grasshopper/html/M_Grasshopper_Kernel_GH_AssemblyPriority_PriorityLoad.htm | ||
|
||
Instances.CanvasCreated += Instances_CanvasCreated; | ||
|
||
return Grasshopper.Kernel.GH_LoadingInstruction.Proceed; | ||
} | ||
|
||
private void Instances_CanvasCreated(Grasshopper.GUI.Canvas.GH_Canvas canvas) | ||
{ | ||
Instances.ActiveCanvas.Document_ObjectsAdded += ActiveCanvas_Document_ObjectsAdded; | ||
|
||
Instances.CanvasCreated -= Instances_CanvasCreated; | ||
} | ||
|
||
private void ActiveCanvas_Document_ObjectsAdded(Grasshopper.Kernel.GH_Document sender, Grasshopper.Kernel.GH_DocObjectEventArgs e) | ||
{ | ||
foreach (var obj in e.Objects) | ||
{ | ||
var msg = $"{obj.InstanceGuid}: {obj.Category} / {obj.SubCategory} / {obj.Name} ({obj.ComponentGuid})"; | ||
Rhino.RhinoApp.WriteLine(msg); | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
grasshopper/cs/GrasshopperWatcherExample/GrasshopperWatcherExample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
<Version>1.0</Version> | ||
<Title>GrasshopperWatcherExample</Title> | ||
<Description>Description of GrasshopperWatcherExample</Description> | ||
<TargetExt>.gha</TargetExt> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Grasshopper" Version="7.13.21348.13001" IncludeAssets="compile;build" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition="$(Configuration) == 'Debug' AND $([MSBuild]::IsOSPlatform(Windows))"> | ||
<StartProgram>C:\Program Files\Rhino 7\System\Rhino.exe</StartProgram> | ||
<StartArguments></StartArguments> | ||
<StartAction>Program</StartAction> | ||
</PropertyGroup> | ||
|
||
</Project> |
25 changes: 25 additions & 0 deletions
25
grasshopper/cs/GrasshopperWatcherExample/GrasshopperWatcherExample.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.4.33122.133 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrasshopperWatcherExample", "GrasshopperWatcherExample.csproj", "{0F025773-CB69-42E4-B342-A1E1FF06CAC1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0F025773-CB69-42E4-B342-A1E1FF06CAC1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0F025773-CB69-42E4-B342-A1E1FF06CAC1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0F025773-CB69-42E4-B342-A1E1FF06CAC1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0F025773-CB69-42E4-B342-A1E1FF06CAC1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {38B02F4D-FCA6-4864-A877-2D61982D7DF2} | ||
EndGlobalSection | ||
EndGlobal |
26 changes: 26 additions & 0 deletions
26
grasshopper/cs/GrasshopperWatcherExample/GrasshopperWatcherExampleInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Grasshopper; | ||
using Grasshopper.Kernel; | ||
using System; | ||
using System.Drawing; | ||
|
||
namespace GrasshopperWatcherExample | ||
{ | ||
public class GrasshopperWatcherExampleInfo : GH_AssemblyInfo | ||
{ | ||
public override string Name => "GrasshopperWatcherExample"; | ||
|
||
//Return a 24x24 pixel bitmap to represent this GHA library. | ||
public override Bitmap Icon => null; | ||
|
||
//Return a short string describing the purpose of this GHA library. | ||
public override string Description => ""; | ||
|
||
public override Guid Id => new Guid("0c77fef1-bd0e-4332-baf9-f9b5b4122c4c"); | ||
|
||
//Return a string identifying you or your company. | ||
public override string AuthorName => ""; | ||
|
||
//Return a string representing your preferred contact details. | ||
public override string AuthorContact => ""; | ||
} | ||
} |