Exemplo n.º 1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string type = "";

            if (!DA.GetData(0, ref type))
            {
                return;
            }

            Machina.MotionType t = Machina.MotionType.Linear;

            type = type.ToLower();
            if (type.Equals("linear"))
            {
                t = Machina.MotionType.Linear;
            }
            else if (type.Equals("joint"))
            {
                t = Machina.MotionType.Joint;
            }

            //if (t == null)
            //{
            //    base.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid motion type: please input \"linear\" or \"joint\" as String.");
            //    return;
            //}

            DA.SetData(0, new ActionMotion(t));
        }
Exemplo n.º 2
0
        internal void UpdateRobotStatus()
        {
            if (bot == null)
            {
                ResetRobotStatus();
                return;
            }

            uiContext.Post(x =>
            {
                Machina.Vector pos = bot.GetCurrentPosition();
                string posStr      = pos?.ToString(true) ?? "-";
                lbl_Status_TCP_Position_Value.Content = posStr;

                Machina.Orientation ori = bot.GetCurrentRotation();
                string oriStr           = ori?.ToString(true) ?? "-";
                lbl_Status_TCP_Orientation_Value.Content = oriStr;

                Machina.Joints axes           = bot.GetCurrentAxes();
                string axesStr                = axes?.ToString(true) ?? "-";
                lbl_Status_Axes_Value.Content = axesStr;

                Machina.ExternalAxes extax = bot.GetCurrentExternalAxes();
                bool nullext = true;
                if (extax != null)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        if (extax[i] != null)
                        {
                            nullext = false;
                            break;
                        }
                    }
                }
                lbl_Status_Ext_Axes_Value.Content = nullext ? "-" : extax.ToString(true);

                double speed    = bot.GetCurrentSpeed();
                double acc      = bot.GetCurrentAcceleration();
                string speedacc = Math.Round(speed, Machina.Geometry.STRING_ROUND_DECIMALS_MM) + " mm/s / " + Math.Round(acc, Machina.Geometry.STRING_ROUND_DECIMALS_MM) + " mm/s^2";
                lbl_Status_SpeedAcceleration_Value.Content = speedacc;

                double precision = bot.GetCurrentPrecision();
                lbl_Status_Precision_Value.Content =
                    Math.Round(precision, Machina.Geometry.STRING_ROUND_DECIMALS_MM) + " mm";

                Machina.MotionType mtype            = bot.GetCurrentMotionMode();
                lbl_Status_MotionMode_Value.Content = mtype.ToString();

                lbl_Status_Tool_Value.Content = bot.GetCurrentTool()?.name ?? "(no tool)";
            }, null);
        }