Difference between revisions of "Example of post processing plugin with template update"

From Dynamo
Jump to navigation Jump to search
(Created page with "Here we show a piece of code that illustrates how to create a simple post processing plugin. In this case, we show an example that operates a minimum of functionality of a plu...")
 
Line 1: Line 1:
Here we show a piece of code that illustrates how to create a simple post processing plugin.
+
Here we show a piece of code that illustrates how to create a simple [[post processing plugin]].
 
In this case, we show an example that operates a minimum of functionality of a plugin: operating on the average produced by one iteration, allowing ''Dynamo'' to use a transform of the average as template for the next iteration.
 
In this case, we show an example that operates a minimum of functionality of a plugin: operating on the average produced by one iteration, allowing ''Dynamo'' to use a transform of the average as template for the next iteration.
 
This particular example implements a transform consisting in applying a C2 transfom along all x,y,z axis of the template.
 
This particular example implements a transform consisting in applying a C2 transfom along all x,y,z axis of the template.
Line 7: Line 7:
  
 
==Plugin code==
 
==Plugin code==
 +
A plugin function is a script called <tt>dynamo_plugin_post_<Some identification></tt>. For this example you can just choose any folder in your file system, say <tt><some folder></tt> and edit there a script file called <tt><some folder>/dynamo_plugin_post_<Some identification>.m</tt>
  
  
 
==Activating the plugin inside a project ==     
 
==Activating the plugin inside a project ==     
After writing the script, you need to make your project aware of the fact that during runtime a project will be invoked.
+
After writing the script, you need to make your project aware of the fact that during runtime a project will be invoked:
 
  <tt>dvput ptest plugin_post_r1 1</tt>
 
  <tt>dvput ptest plugin_post_r1 1</tt>
 +
 +
Then, you need to pass the syntax of the plugin script. We don't pass the <tt>dynamo_plugin_post</tt> part.
 
  <tt>dvput ptest plugin_post_order_r1 'example();'</tt>
 
  <tt>dvput ptest plugin_post_order_r1 'example();'</tt>
  
 
== Running a project that calls a plugin ==
 
== Running a project that calls a plugin ==

Revision as of 11:37, 5 October 2016

Here we show a piece of code that illustrates how to create a simple post processing plugin. In this case, we show an example that operates a minimum of functionality of a plugin: operating on the average produced by one iteration, allowing Dynamo to use a transform of the average as template for the next iteration. This particular example implements a transform consisting in applying a C2 transfom along all x,y,z axis of the template.

The plugin is callable through Matlab execution of the project.


Plugin code

A plugin function is a script called dynamo_plugin_post_<Some identification>. For this example you can just choose any folder in your file system, say <some folder> and edit there a script file called <some folder>/dynamo_plugin_post_<Some identification>.m


Activating the plugin inside a project

After writing the script, you need to make your project aware of the fact that during runtime a project will be invoked:

dvput ptest plugin_post_r1 1

Then, you need to pass the syntax of the plugin script. We don't pass the dynamo_plugin_post part.

dvput ptest plugin_post_order_r1 'example();'

Running a project that calls a plugin