GitHub - tumcms/TUM.CMS.VPLControl: TUM.CMS.VplControl is a WPF based Visual Programming Control for .Net. (original) (raw)

TUM.CMS.VplControl 0.4#

TUM.CMS.VplControl is a WPF based Visual Programming Language Control for .Net. A visual programming language can aid non-programmers to write simple programs or processes, without the knowledge of how they are internally built. The control allows simple visual programming (assignments, boolean expressions, math expressions, and scripting) from scratch. Further nodes for your purposes can be added easily. The development of this VPL framework was mainly influenced by the well known VPL tools Dynamo and Grasshopper.


overview.PNG


multiplePorts.PNG


radialselectionMenu.PNG


Watch3D.PNG


Watch3D.PNG


Get Started

Download or clone this repository and run the test project in visual studio.

Give it a try:

Features

ToDo


Using TUM.CMS.VplControl in your project

  <Application x:Class="KBEControlCenter2.App"  
       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
       StartupUri="MainWindow.xaml">  
    
      <Application.Resources>  
        
          <ResourceDictionary>  
              <ResourceDictionary.MergedDictionaries>  
                  <ResourceDictionary Source="/TUM.CMS.VplControl;component/Themes/Generic.xaml" />  
              </ResourceDictionary.MergedDictionaries>  
          </ResourceDictionary>  
        
      </Application.Resources>  
  </Application>  
  <Window  
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
      xmlns:VplControl="clr-namespace:TUM.CMS.VplControl;assembly=TUM.CMS.VplControl"  
      x:Class="TUM.CMS.VplControl.Test.MainWindow"  
      Title="MainWindow" WindowStartupLocation="CenterScreen" WindowState="Maximized">  
    
          <Grid>  
          	<VplControl:VplControl Name="VplControl" />  
          </Grid>  
  </Window>  
  KeyDown += VplControl.VplControl_KeyDown;  
  KeyUp += VplControl.VplControl_KeyUp;  

###Create custom nodes###

You find a TemplateNode.cs file in the test project:

using System.Windows.Controls;
using TUM.CMS.VplControl.Nodes;

namespace TUM.CMS.VplControl.Test.Nodes
{
    public class TemplateNode : Node
    {
        public TemplateNode(VplControl hostCanvas)
            : base(hostCanvas)
        {
            AddInputPortToNode("Test", typeof (object));
            AddOutputPortToNode("Test", typeof (object));
            
            AddControlToNode(new Label {Content = "TemplateNode"});
        }
            
        public override void Calculate()
        {
        	OutputPorts[0].Data = InputPorts[0].Data;
        }
            
        public override void SerializeNetwork(XmlWriter xmlWriter)
        {
            base.SerializeNetwork(xmlWriter);

            // add your xml serialization methods here
        }

        public override void DeserializeNetwork(XmlReader xmlReader)
        {
            base.DeserializeNetwork(xmlReader);

            // add your xml deserialization methods here
        }

        public override Node Clone()
        {
        	return new TemplateNode(HostCanvas)
            {
            Top = Top,
            Left = Left
            };
        }
    }
}

This TemplateNode consists of a Input- and OutputPort and a label. Use the Calculate() method to implement your tasks.

Add your custom nodes to the ExternalNodeTypes Property of the VplControl and set the NodeTypeMode to All or OnlyExternal:

VplControl.ExternalNodeTypes.AddRange(
    ClassUtility.GetTypesInNamespace(Assembly.GetExecutingAssembly(), "TUM.CMS.VplControl.Test.Nodes")
        .ToList());

VplControl.NodeTypeMode = NodeTypeModes.All;

Contact

Dominic Singer

dominic.singer@tum.de

09th August 2016