コード例 #1
0
ファイル: CodeBehind.cs プロジェクト: FlyingSlap/MatrixComm
 /// <summary>
 /// Called when the value of an I/O signal value has changed.
 /// </summary>
 /// <param name="component"> Component that owns the changed signal. </param>
 /// <param name="changedSignal"> Changed signal. </param>
 public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
 {
     if (changedSignal.Name.Equals("Activate"))
     {
         if (changedSignal.Value.Equals(1))
         {
             try
             {
                 InitializeSocket((String)component.Properties["IP"].Value, (int)component.Properties["port"].Value);
             }
             catch (SocketException)
             {
                 component.IOSignals["Activate"].Value = false;
             }
             catch (Exception)
             {
                 throw;
             }
         }
         else
         {
             CloseSocket();
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Get a signal value from component.
        /// Function called by Lua Script with 1 parameter:
        ///		(string Signal name)
        ///	Returns number Signal Value
        /// </summary>
        /// <param name="L">Lua State caller</param>
        /// <returns>Number of return parameters</returns>
        static int GetSignal(lua_State L)
        {
            //Get component owner
            lua_getglobal(L, "SmartComponent");
            string compID = lua_tostring(L, -1).ToString();

            SmartComponent myComponent = GetComponent(compID);

            if (myComponent != null)
            {
                string signalName = luaL_checklstring(L, 1).ToString();

                if (myComponent.IOSignals.Contains(signalName))
                {
                    IOSignal ios = myComponent.IOSignals[signalName];

                    lua_pushnumber(L, Convert.ToDouble(ios.Value));
                }
                else
                {
                    Logger.AddMessage("RSLuaScript: Lua Script get Signal value of unknown signal named:" + signalName + ". Check your script file.", LogMessageSeverity.Warning);
                }
            }
            else
            {
                Logger.AddMessage("RSLuaScript: Lua Script get Signal value of unknown component. Closing it.", LogMessageSeverity.Error);
                lua_close(L);
            }

            return(1);            // number of return parameters
        }
コード例 #3
0
        /// <summary>
        /// Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            switch (changedSignal.Name)
            {
            case "GroupInputMSB":
                UpdateOutProp(component);
                break;

            case "GroupInputB3":
                UpdateOutProp(component);
                break;

            case "GroupInputB2":
                UpdateOutProp(component);
                break;

            case "GroupInputLSB":
                UpdateOutProp(component);
                break;

            default:
                Logger.AddMessage(new LogMessage("not recognised IO signal change"));
                break;
            }
            Logger.AddMessage(new LogMessage("finished OnIOSignalValueChanged"));
        }
コード例 #4
0
 //START HERE: IO SIGNAL VALUE CHANGED -> UPDATE SENSOR (COMPONENT)
 public override void OnIOSignalValueChanged(SmartComponent component, IOSignal signal)
 {
     if (signal.Name == "Active")
     {
         UpdateSensor(component);
     }
 }
コード例 #5
0
        /// <summary>
        /// Update GO list depends GO_ByteNumber
        /// </summary>
        /// <param name="component">Component that owns signals. </param>
        /// <param name="oldCount">Old GO count</param>
        private void UpdateGOCount(SmartComponent component, int oldCount)
        {
            int newGOCount = (int)component.Properties["GO_ByteNumber"].Value;

            component.Properties["GO_FirstByteAddress"].UIVisible = (newGOCount > 0);
            if (newGOCount > oldCount)
            {
                for (int i = oldCount; i < newGOCount; i++)
                {
                    string goName = "GO_" + i.ToString();
                    if (!component.IOSignals.Contains(goName))
                    {
                        IOSignal ios = new IOSignal(goName, IOSignalType.DigitalGroupInput);
                        ios.ReadOnly  = true;
                        ios.UIVisible = false;
                        component.IOSignals.Add(ios);
                    }
                }
            }
            else
            {
                for (int i = oldCount - 1; i >= newGOCount; i--)
                {
                    string goName = "GO_" + i.ToString();
                    if (component.IOSignals.Contains(goName))
                    {
                        component.IOSignals.Remove(goName);
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            if (changedSignal.Name == "LoadFile")
            {
                if ((int)changedSignal.Value == 1)
                {
                    string initialDir = component.ContainingProject?.FileInfo?.DirectoryName ?? "";

                    // First look at Example file
                    if (!string.IsNullOrEmpty(initialDir))
                    {
                        if (!System.IO.File.Exists(initialDir + "\\RSLuaScript.lua"))
                        {
                            if (component.Assets.TryGetAsset("RSLuaScript.lua", out Asset asset))
                            {
                                System.IO.File.WriteAllBytes(initialDir + "\\RSLuaScript.lua", asset.GetData());
                            }
                        }
                    }

                    System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog
                    {
                        Title            = "Open Lua Script File",
                        InitialDirectory = initialDir,
                        Filter           = "Lua files (*.lua)|*.lua|All files (*.*)|*.*",
                        RestoreDirectory = true,
                        FileName         = (string)component.Properties["LuaFile"].Value
                    };

                    if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        if ((string)component.Properties["LuaFile"].Value == openFileDialog.FileName)
                        {
                            if (System.Windows.Forms.MessageBox.Show("Do you want to reopen this file, then execute main script once more?"
                                                                     , "Same file reopened"
                                                                     , System.Windows.Forms.MessageBoxButtons.YesNo
                                                                     , System.Windows.Forms.MessageBoxIcon.Question
                                                                     ) == System.Windows.Forms.DialogResult.Yes)
                            {
                                component.Properties["LuaFile"].Value = "";                                 //To raise OnPropertyValueChanged
                            }
                        }
                        component.Properties["LuaFile"].Value = openFileDialog.FileName;
                        component.Properties["Status"].Value  = "Lua File Loaded";
                    }
                }
            }
            else
            {
                if (changedSignal.SignalType == IOSignalType.AnalogInput ||
                    changedSignal.SignalType == IOSignalType.DigitalGroupInput ||
                    changedSignal.SignalType == IOSignalType.DigitalInput)
                {
                    UpdateScriptIOSignals(component, changedSignal.Name, Convert.ToDouble(changedSignal.Value));
                }
            }

            UpdateComponentList(component);
        }
コード例 #7
0
 /// <summary>
 /// Called when the value of an I/O signal value has changed.
 /// </summary>
 /// <param name="component"> Component that owns the changed signal. </param>
 /// <param name="changedSignal"> Changed signal. </param>
 public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
 {
     for (int i = 0; i <= 6; i++)
     {
         if (changedSignal.Name == "SourceSelector" + i.ToString())
         {
             ChangeComp(component, i);
         }
     }
 }
コード例 #8
0
        /// <summary>
        /// Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            if (changedSignal.Name == "Connect")
            {
                //Mark sure client is initialized before connect.
                CheckClientAndValues(component);

                if (((int)changedSignal.Value != 0) && bCanConnect)
                {
                    Connect(component);
                }
                else
                {
                    Disconnect(component);
                }
            }
            if ((changedSignal.Name == "Read") && ((int)changedSignal.Value != 0))
            {
                Read(component);
            }
            if (changedSignal.Name.Contains("GO_"))
            {
                if (client.Connected)
                {
                    int offset = -1;
                    int.TryParse(Right(changedSignal.Name, changedSignal.Name.Length - 3), out offset);
                    if (offset >= 0)
                    {
                        S7Client.S7DataItem item = new S7Client.S7DataItem();
                        if (GetS7DataItem((string)component.Properties["GO_FirstByteAddress"].Value, ref item))
                        {
                            item.Start += offset;
                            byte[] b = new byte[1];
                            byte.TryParse((string)changedSignal.Value.ToString(), out b[0]);
                            int result = 0x01700000;                            // S7Consts.errCliInvalidBlockType
                            switch (item.Area)
                            {
                            case 0x81: result = client.EBWrite(item.Start, 1, b);                                     //S7Consts.S7AreaPE
                                break;

                            case 0x83: result = client.MBWrite(item.Start, 1, b);                                     //S7Consts.S7AreaMK
                                break;

                            case 0x84: result = client.DBWrite(item.DBNumber, item.Start, 1, b);                                     //S7Consts.S7AreaDB
                                break;
                            }
                            ShowResult(component, result);
                        }
                    }
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// Add a new signal to component.
        /// Function called by Lua Script with 2 parameters:
        ///		(string Signal name, string Signal type)
        ///	Returns Nothing
        /// </summary>
        /// <param name="L">Lua State caller</param>
        /// <returns>Number of return parameters</returns>
        static int AddSignal(lua_State L)
        {
            //Get component owner
            lua_getglobal(L, "SmartComponent");
            string compID = lua_tostring(L, -1).ToString();

            SmartComponent myComponent = GetComponent(compID);

            if (myComponent != null)
            {
                string       newSignalName = luaL_checklstring(L, 1).ToString();
                string       newSignalType = luaL_checklstring(L, 2).ToString();
                IOSignalType signalType    = IOSignalType.DigitalInput;
                switch (newSignalType.ToLower())
                {
                case "analoginput": { signalType = IOSignalType.AnalogInput; break; }

                case "analogoutput": { signalType = IOSignalType.AnalogOutput; break; }

                case "digitalgroupinput": { signalType = IOSignalType.DigitalGroupInput; break; }

                case "digitalgroupoutput": { signalType = IOSignalType.DigitalGroupOutput; break; }

                case "digitalinput": { signalType = IOSignalType.DigitalInput; break; }

                case "digitaloutput": { signalType = IOSignalType.DigitalOutput; break; }
                }

                if (!myComponent.IOSignals.Contains(newSignalName))
                {
                    IOSignal ios = new IOSignal(newSignalName, signalType)
                    {
                        ReadOnly = true,
                    };
                    myComponent.IOSignals.Add(ios);
                    Logger.AddMessage("RSLuaScript: Lua Script adding Signal " + newSignalName + " to " + myComponent.Name, LogMessageSeverity.Information);
                }
                else
                {
                    Logger.AddMessage("RSLuaScript: Lua Script want to add already existing Signal " + newSignalName + " to " + myComponent.Name + ". Check your lua script file.", LogMessageSeverity.Information);
                }

                myComponent.Properties["Status"].Value = "Signal Added";
            }
            else
            {
                Logger.AddMessage("RSLuaScript: Lua Script adding Signal of unknown component. Closing it.", LogMessageSeverity.Error);
                lua_close(L);
            }

            return(0);            // number of return parameters
        }
コード例 #10
0
        /// <summary>
        /// Update DO list depends DO_Number
        /// </summary>
        /// <param name="component">Component that owns signals. </param>
        /// <param name="oldCount">Old DO count</param>
        private void UpdateDOCount(SmartComponent component, int oldCount)
        {
            int newDOCount = (int)component.Properties["DO_Number"].Value;

            if (newDOCount > oldCount)
            {
                Array.Resize(ref bDO_AddressIsValid, newDOCount);
                for (int i = oldCount; i < newDOCount; i++)
                {
                    string doName = "DO_" + i.ToString();
                    if (!component.IOSignals.Contains(doName))
                    {
                        IOSignal ios = new IOSignal(doName, IOSignalType.DigitalInput);
                        ios.ReadOnly  = true;
                        ios.UIVisible = false;
                        component.IOSignals.Add(ios);
                    }
                    string doAddress = "DO_Address_" + i.ToString();
                    if (!component.Properties.Contains(doAddress))
                    {
                        DynamicProperty idp = new DynamicProperty(doAddress, "System.String");
                        idp.Value     = "M0.0";
                        idp.ReadOnly  = false;
                        idp.UIVisible = true;
                        idp.Attributes["AutoApply"]        = "true";
                        idp.Attributes["CustomValidation"] = "true";
                        component.Properties.Add(idp);
                        bDO_AddressIsValid[i] = false;
                    }
                }
            }
            else
            {
                for (int i = oldCount - 1; i >= newDOCount; i--)
                {
                    string doName = "DO_" + i.ToString();
                    if (component.IOSignals.Contains(doName))
                    {
                        component.IOSignals.Remove(doName);
                    }
                    string doAddress = "DO_Address_" + i.ToString();
                    if (component.Properties.Contains(doAddress))
                    {
                        component.Properties.Remove(doAddress);
                    }
                }
                Array.Resize(ref bDO_AddressIsValid, newDOCount);
            }
        }
コード例 #11
0
ファイル: RSMoveMecha.cs プロジェクト: DenisFR/RSMoveMecha
        /// <summary>
        /// Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            if (changedSignal.Name == "Update")
            {
                if ((int)changedSignal.Value == 1)
                {
                    if (GetController(component) != null)
                    {
                        component.Properties["Status"].Value = "Updated";
                    }
                }
            }

            UpdateComponentList(component);
        }
コード例 #12
0
        /// <summary>
        /// Set a signal value from component.
        /// Function called by Lua Script with 2 parameters:
        ///		(string Signal name, number Signal value)
        ///	Returns Nothing
        /// </summary>
        /// <param name="L">Lua State caller</param>
        /// <returns>Number of return parameters</returns>
        static int SetSignal(lua_State L)
        {
            //Parameters have to be get before
            string signalName     = luaL_checklstring(L, 1).ToString();
            double signalNewValue = luaL_checknumber(L, 2);

            //Get component owner
            lua_getglobal(L, "SmartComponent");
            string compID = lua_tostring(L, -1).ToString();

            SmartComponent myComponent = GetComponent(compID);

            if (myComponent != null)
            {
                if (myComponent.IOSignals.Contains(signalName))
                {
                    IOSignal ios = myComponent.IOSignals[signalName];

                    switch (ios.SignalType)
                    {
                    case IOSignalType.DigitalOutput:
                    case IOSignalType.DigitalInput:
                        ios.Value = (signalNewValue != 0) ? 1 : 0;
                        break;

                    case IOSignalType.DigitalGroupOutput:
                    case IOSignalType.DigitalGroupInput:
                        ios.Value = Convert.ToInt32(signalNewValue);
                        break;

                    default:
                        ios.Value = signalNewValue;
                        break;
                    }
                }
                else
                {
                    Logger.AddMessage("RSLuaScript: Lua Script set Signal value of unknown signal named:" + signalName + ". Check your script file.", LogMessageSeverity.Warning);
                }
            }
            else
            {
                Logger.AddMessage("RSLuaScript: Lua Script set Signal value of unknown component. Closing it.", LogMessageSeverity.Error);
                lua_close(L);
            }

            return(0);            // number of return parameters
        }
コード例 #13
0
        /// <summary>
        /// Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            if (changedSignal.Name == "Connect")
            {
                //Make sure client is initialized before connect.
                CheckClientAndValues(component);

                if (((int)changedSignal.Value != 0) && bCanConnect)
                {
                    Connect(component);
                }
                else
                {
                    Disconnect(component);
                }
            }
            if ((changedSignal.Name == "Read") && ((int)changedSignal.Value != 0))
            {
                Read(component);
            }
            if (changedSignal.Name.Contains("DO_"))
            {
                if (client.Connected)
                {
                    int doNumber = -1;
                    int.TryParse(Right(changedSignal.Name, changedSignal.Name.Length - 3), out doNumber);
                    if (doNumber >= 0)
                    {
                        S7Client.S7DataItem item = new S7Client.S7DataItem();
                        if (GetS7DataItem((string)component.Properties["DO_Address_" + doNumber.ToString()].Value, ref item))
                        {
                            byte[] b = new byte[1];
                            byte.TryParse(changedSignal.Value.ToString(), out b[0]);
                            int result = 0x01700000;                            // S7Consts.errCliInvalidBlockType
                            result = client.WriteArea(item.Area, item.DBNumber, item.Start, item.Amount, item.WordLen, b);
                            ShowResult(component, result);
                        }
                    }
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            switch (changedSignal.Name)
            {
            case "InputGroup":
                component.IOSignals["OutputByte3"].Value = ((int)changedSignal.Value & 0xFF000000) >> 24;
                component.IOSignals["OutputByte2"].Value = ((int)changedSignal.Value & 0x00FF0000) >> 16;
                component.IOSignals["OutputByte1"].Value = ((int)changedSignal.Value & 0x0000FF00) >> 8;
                component.IOSignals["OutputByte0"].Value = ((int)changedSignal.Value & 0x000000FF);
                break;

            case "InputByte3":
            case "InputByte2":
            case "InputByte1":
            case "InputByte0":
                component.IOSignals["OutputGroup"].Value = (int)component.IOSignals["InputByte0"].Value + ((int)component.IOSignals["InputByte1"].Value << 8) + ((int)component.IOSignals["InputByte2"].Value << 16) + ((int)component.IOSignals["InputByte3"].Value << 24);
                break;

            default:
                Logger.AddMessage(new LogMessage("not recognised IO signal change"));
                break;
            }
        }
コード例 #15
0
        /// <summary>
        /// Update DIO list depends DIO_Number
        /// </summary>
        /// <param name="component">Component that owns signals. </param>
        /// <param name="oldCount">Old DIO count</param>
        private void UpdateIOCount(SmartComponent component, int oldCount, IO io)
        {
            String       prefix       = "";
            IOSignalType iOSignalType = IOSignalType.DigitalInput;

            if (io == IO.Input)
            {
                prefix = "DI";
            }
            else
            {
                prefix       = "DO";
                iOSignalType = IOSignalType.DigitalOutput;
            }

            int newIOCount = (int)component.Properties[prefix + "_Number"].Value;

            if (newIOCount > oldCount)
            {
                Array.Resize(ref bDIO_AddressIsValid[(int)io], newIOCount);
                for (int i = oldCount; i < newIOCount; i++)
                {
                    string dioName = prefix + "_" + i.ToString();
                    if (!component.IOSignals.Contains(dioName))
                    {
                        IOSignal ios = new IOSignal(dioName, iOSignalType)
                        {
                            ReadOnly  = true,
                            UIVisible = false
                        };
                        component.IOSignals.Add(ios);
                    }
                    string dioAddress = prefix + "_Address_" + i.ToString();
                    if (!component.Properties.Contains(dioAddress))
                    {
                        DynamicProperty idp = new DynamicProperty(dioAddress, "System.String")
                        {
                            Value     = "M0.0",
                            ReadOnly  = false,
                            UIVisible = true
                        };
                        idp.Attributes["AutoApply"]        = "true";
                        idp.Attributes["CustomValidation"] = "true";
                        component.Properties.Add(idp);
                        bDIO_AddressIsValid[(int)io][i] = false;
                    }
                }
            }
            else
            {
                for (int i = oldCount - 1; i >= newIOCount; i--)
                {
                    string dioName = prefix + "_" + i.ToString();
                    if (component.IOSignals.Contains(dioName))
                    {
                        component.IOSignals.Remove(dioName);
                    }
                    string dioAddress = prefix + "_Address_" + i.ToString();
                    if (component.Properties.Contains(dioAddress))
                    {
                        component.Properties.Remove(dioAddress);
                    }
                }
                Array.Resize(ref bDIO_AddressIsValid[(int)io], newIOCount);
            }
        }
コード例 #16
0
        /// <summary>
        ///   Called when the value of an I/O signal value has changed.
        /// </summary>
        /// <param name="component"> Component that owns the changed signal. </param>
        /// <param name="changedSignal"> Changed signal. </param>
        public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
        {
            if (changedSignal.Name == "Open" && (int)changedSignal.Value == 1)
            {
                Single min = Single.MaxValue, max = Single.MinValue;
                Dictionary <int, Dictionary <int, Single> > points_1 = OpenFile(component, "FileName_1", ref min, ref max);
                if (points_1 != null)
                {
                    Dictionary <int, Dictionary <int, Single> > points_2 = OpenFile(component, "FileName_2", ref min, ref max);
                    if (points_2 != null)
                    {
                        Single amplitude = max - min;

                        //Now create CloudOfPoint
                        PointCloud p = new PointCloud
                        {
                            PointSize = 2,                                                     // size of the points
                            Visible   = (bool)component.Properties["Visible"].Value,           // visibility of points
                        };
                        p.Transform.Matrix = (Matrix4)component.Properties["Transform"].Value; // transformation of points

                        Double epsilon = (Double)component.Properties["Epsilon"].Value;
                        //Use List as we cannot know how many point differs now.
                        List <Vector3> points = new List <Vector3>();
                        List <Color>   colors = new List <Color>();

                        //Search for all X values of File1 if get something in File2
                        foreach (KeyValuePair <int, Dictionary <int, Single> > listY_1 in points_1)
                        {
                            if (points_2.TryGetValue(listY_1.Key, out Dictionary <int, Single> listY_2))
                            {
                                //If X_1 is on File2, scan all Y_1
                                foreach (KeyValuePair <int, Single> z_1 in listY_1.Value)
                                {
                                    if (listY_2.TryGetValue(z_1.Key, out Single z_2))
                                    {
                                        //Get same point, compare it and create it in middle, color it depends delta
                                        Single delta = z_2 - z_1.Value;
                                        int    color = (int)((Math.Abs(delta) / amplitude) * 255);
                                        points.Add(new Vector3(listY_1.Key * epsilon, z_1.Key * epsilon, z_1.Value + delta / 2));                                         // place the point
                                        colors.Add(Color.FromArgb(255, color, 255 - color, 0));
                                    }
                                    else
                                    {
                                        //Point is not in File2, add it in gray
                                        points.Add(new Vector3(listY_1.Key * epsilon, z_1.Key * epsilon, z_1.Value));                                         // place the point
                                        colors.Add(Color.FromArgb(255, 127, 127, 127));
                                    }
                                }
                            }
                            else
                            {
                                //If X_1 is not on File2, add all of them in gray
                                foreach (KeyValuePair <int, Single> z in listY_1.Value)
                                {
                                    points.Add(new Vector3(listY_1.Key * epsilon, z.Key * epsilon, z.Value));                                     // place the point
                                    colors.Add(Color.FromArgb(255, 127, 127, 127));
                                }
                            }
                        }

                        //Now Search for all X values of File2 if get something in File1
                        foreach (KeyValuePair <int, Dictionary <int, Single> > listY_2 in points_2)
                        {
                            if (points_1.TryGetValue(listY_2.Key, out Dictionary <int, Single> listY_1))
                            {
                                //If X_2 is on File1, scan all Y_2
                                foreach (KeyValuePair <int, Single> z_2 in listY_2.Value)
                                {
                                    if (listY_1.TryGetValue(z_2.Key, out Single z_1))
                                    {
                                        //Get same point, already done before
                                    }
                                    else
                                    {
                                        //Point is not in File1, add it in gray blue
                                        points.Add(new Vector3(listY_2.Key * epsilon, z_2.Key * epsilon, z_2.Value));                                         // place the point
                                        colors.Add(Color.FromArgb(255, 127, 127, 255));
                                    }
                                }
                            }
                            else
                            {
                                //If X_1 is not on File2, add all of them in gray blue
                                foreach (KeyValuePair <int, Single> z in listY_2.Value)
                                {
                                    points.Add(new Vector3(listY_2.Key * epsilon, z.Key * epsilon, z.Value));                                     // place the point
                                    colors.Add(Color.FromArgb(255, 127, 127, 255));
                                }
                            }
                        }

                        p.Points = points.ToArray();
                        p.Colors = colors.ToArray();
                        p.Name   = component.UniqueId;

                        Station station = Project.ActiveProject as Station;
                        //Remove last cloud
                        for (int i = 0; i < station.PointClouds.Count; ++i)
                        {
                            if (station.PointClouds[i].Name == component.UniqueId)
                            {
                                station.PointClouds.RemoveAt(i);
                            }
                        }

                        station.PointClouds.Add(p);                         // Add the pointCloud
                    }
                }
                component.IOSignals["Open"].Value = false;
            }
            if (changedSignal.Name == "Delete" && (int)changedSignal.Value == 1)
            {
                Station station = Project.ActiveProject as Station;
                //Remove last cloud
                for (int i = 0; i < station.PointClouds.Count; ++i)
                {
                    if (station.PointClouds[i].Name == component.UniqueId)
                    {
                        station.PointClouds.RemoveAt(i);
                    }
                }

                component.IOSignals["Delete"].Value = false;
            }
        }
コード例 #17
0
 public override void OnIOSignalValueChanged(SmartComponent component, IOSignal changedSignal)
 {
 }