FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DynamoSamples/src/SampleExtension/Extension.cs at master · DynamoDS/DynamoSamples · GitHub
DynamoDS
DynamoSamples
Repository navigation
Code
Issues
Pull requests
2
(2)
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
DynamoSamples
/
src
/
SampleExtension
/
Extension.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
73 lines (63 loc) · 2 KB
Breadcrumbs
DynamoSamples
/
src
/
SampleExtension
/
Extension.cs
Copy path
File metadata and controls
73 lines (63 loc) · 2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using
Dynamo
.
Extensions
;
using
Dynamo
.
Graph
.
Nodes
;
using
Dynamo
.
Models
;
using
System
;
using
System
.
Collections
.
Generic
;
using
System
.
Linq
;
using
System
.
Text
;
namespace
SampleExtension
{
/// <summary>
/// The Extension framework for Dynamo allows you to extend
/// Dynamo by loading your own classes that can interact with Dynamo's API.
/// An Extension has two components, an assembly containing your class and
/// an xml manifest file telling Dynamo where to find your assembly. Extension
/// manifests are loaded from the Dynamo/Extensions folder or from package/extra
/// folders.
///
/// This sample demonstrates a simple IExtension which tracks nodes added to the workspace.
/// </summary>
public
class
Extension
:
IExtension
{
public
List
<
NodeModel
>
nodes
=
new
List
<
NodeModel
>
(
)
;
public
bool
readyCalled
=
false
;
public
string
Name
{
get
{
return
"testExtension"
;
}
}
public
string
UniqueId
{
get
{
return
"49fee64a-4505-4f03-a6b6-0667a793f19a"
;
}
}
public
void
Dispose
(
)
{
}
/// <summary>
/// Ready is called when the DynamoModel is finished being built, or when the extension is installed
/// sometime after the DynamoModel is already built. ReadyParams provide access to references like the
/// CurrentWorkspace.
/// </summary>
/// <param name="sp"></param>
public
void
Ready
(
ReadyParams
sp
)
{
sp
.
CurrentWorkspaceModel
.
NodeAdded
+=
CurrentWorkspaceModel_NodeAdded
;
this
.
readyCalled
=
true
;
}
private
void
CurrentWorkspaceModel_NodeAdded
(
Dynamo
.
Graph
.
Nodes
.
NodeModel
obj
)
{
this
.
nodes
.
Add
(
obj
)
;
}
public
void
Shutdown
(
)
{
}
public
void
Startup
(
StartupParams
sp
)
{
}
}
}
Back
|
FazBrowse Home
|
New Git URL