Ejemplo n.º 1
0
        //int mCircsize;
        public ctlMCXY()
        {
            InitializeComponent();
            mArches = new Image[4];
            mArchesSel = new Image[4];
            mOffsets = new Rectangle[4];
            mArchTxtPos = new PointF[4];
            mLevelVals = new float[] { 0.1f, 1, 10, 100 };
            DoubleBuffered = true;
            mSelAxis = 0;
            mSelLevel = 0;
            mCircWidth = 256;
            Height = mCircWidth;
            Width = mCircWidth;
            mInRad = 35;
            mButtRad = mCircWidth / 2;
            mArchWidth = 20;
            mCenter = mCircWidth / 2;
            mButMin = mCenter - 60;
            mButMax = mCenter - 10;
            mButHomePos = 25;
            mArrowPos = (int)(mCenter + mInRad) / 2;

            Font = new Font("Arial", (float)(mArchWidth * 0.75), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
            UpdateOffsets(mCircWidth);
            FrameColor = Color.RoyalBlue;
            mUnit = "mm";
            //UpdateBitmaps();
        }
Ejemplo n.º 2
0
 public ctlMCZ()
 {
     InitializeComponent();
     mSteps         = new Image[4];
     mStepsSel      = new Image[4];
     mOffsets       = new Rectangle[8];
     mLevelVals     = new float[] { 0.1f, 1, 10, 50 };
     DoubleBuffered = true;
     mSelLevel      = 0;
     mCtlHeight     = 256;
     mCtlWidth      = 70;
     Height         = mCtlHeight;
     Width          = mCtlWidth;
     mStepStart     = 10;
     mStepHeight    = 20;
     mCenterY       = (mCtlHeight + mStepHeight) / 2;
     mCenterX       = mCtlWidth / 2;
     mArrowPos      = mStepStart + (mStepHeight * 7) / 2;
     Font           = new Font("Arial", (float)(mStepHeight * 0.75), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
     FrameColor     = Color.RoyalBlue;
     UpdateOffsets();
     mAxisSign     = (DesignMode) ? "Z" : ((DesignMode) ? "Z" :UVDLPApp.Instance().resman.GetString("Z", UVDLPApp.Instance().cul));
     mUnit         = "Mm";
     mHasHome      = true;
     mAxis         = MachineControlAxis.Z;
     mLastSelLevel = 0;
 }
Ejemplo n.º 3
0
 public ctlMCZ()
 {
     InitializeComponent();
     mSteps = new Image[4];
     mStepsSel = new Image[4];
     mOffsets = new Rectangle[8];
     mLevelVals = new float[] { 0.1f, 1, 10, 100 };
     DoubleBuffered = true;
     mSelLevel = 0;
     mCtlHeight = 256;
     mCtlWidth = 70;
     Height = mCtlHeight;
     Width = mCtlWidth;
     mStepStart = 10;
     mStepHeight = 20;
     mCenterY = (mCtlHeight + mStepHeight) / 2;
     mCenterX = mCtlWidth / 2;
     mArrowPos = mStepStart + (mStepHeight * 7) / 2;
     Font = new Font("Arial", (float)(mStepHeight * 0.75), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
     FrameColor = Color.RoyalBlue;
     UpdateOffsets();
     mAxisSign = "Z";
     mUnit = "mm";
     mHasHome = true;
     mAxis = MachineControlAxis.Z;
     mLastSelLevel = 0;
 }
Ejemplo n.º 4
0
        //int mCircsize;
        public ctlMCXY()
        {
            InitializeComponent();
            mArches        = new Image[4];
            mArchesSel     = new Image[4];
            mOffsets       = new Rectangle[4];
            mArchTxtPos    = new PointF[4];
            mLevelVals     = new float[] { 0.1f, 1, 10, 100 };
            DoubleBuffered = true;
            mSelAxis       = 0;
            mSelLevel      = 0;
            mCircWidth     = 256;
            Height         = mCircWidth;
            Width          = mCircWidth;
            mInRad         = 35;
            mButtRad       = mCircWidth / 2;
            mArchWidth     = 20;
            mCenter        = mCircWidth / 2;
            mButMin        = mCenter - 60;
            mButMax        = mCenter - 10;
            mButHomePos    = 25;
            mArrowPos      = (int)(mCenter + mInRad) / 2;

            Font = new Font("Arial", (float)(mArchWidth * 0.75), System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
            UpdateOffsets(mCircWidth);
            FrameColor = Color.RoyalBlue;
            mUnit      = "mm";
            //UpdateBitmaps();
        }
Ejemplo n.º 5
0
 // return correct arched image based on axis and level:
 // axis: 0=X 1=Y
 // level: 1 to 4 and -1 to -4: selected arch level where 1 and -1 are closer to the center
 Image GetArchImage(MachineControlAxis axis, int level)
 {
     if ((mSelAxis == axis) && (mSelLevel == level))
     {
         return(mArchesSel[4 - Math.Abs(level)]);
     }
     return(mArches[4 - Math.Abs(level)]);
 }
Ejemplo n.º 6
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            MachineControlAxis axis;
            int level = GetSelection(e.X, e.Y, out axis);

            if ((level != mSelLevel) || (axis != mSelAxis))
            {
                mSelAxis  = axis;
                mSelLevel = level;
                Invalidate();
            }
        }
Ejemplo n.º 7
0
        private void cMCXY_MotorHome(object sender, MachineControlAxis axis)
        {
            switch (axis)
            {
            case MachineControlAxis.X:
            case MachineControlAxis.Tilt:
                Callback.Activate("MCCmdXHome", this, null);
                break;

            case MachineControlAxis.Y:
                Callback.Activate("MCCmdYHome", this, null);
                break;

            case MachineControlAxis.Z:
                Callback.Activate("MCCmdZHome", this, null);
                break;

            case MachineControlAxis.All:
                Callback.Activate("MCCmdAllHome", this, null);
                break;
            }
        }
Ejemplo n.º 8
0
        private void cMCXY_MotorMove(object sender, MachineControlAxis axis, float val)
        {
            switch (axis)
            {
            case MachineControlAxis.X:
            case MachineControlAxis.Tilt:
                Callback.Activate("MCCmdMoveX", this, (double)val);
                break;

            case MachineControlAxis.Y:
                Callback.Activate("MCCmdMoveY", this, (double)val);
                break;

            case MachineControlAxis.Z:
                Callback.Activate("MCCmdMoveZ", this, (double)val);
                break;

            case MachineControlAxis.Extruder:
                Callback.Activate("MCCmdExtrude", this, (double)val);
                break;
            }
        }
Ejemplo n.º 9
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     MachineControlAxis axis;
     int level = GetSelection(e.X, e.Y, out axis);
     if ((level != mSelLevel) || (axis != mSelAxis))
     {
         mSelAxis = axis;
         mSelLevel = level;
         Invalidate();
     }
 }
Ejemplo n.º 10
0
        protected int  GetSelection(int x, int y, out MachineControlAxis axis)
        {
            // first test corner buttons
            axis = MachineControlAxis.X;
            if (HitBitmap(x, y, mXHomeImg, 0, 0))
                return 5;
            axis = MachineControlAxis.Y;
            if (HitBitmap(x, y, mYHomeImg, mCircWidth - mYHomeImg.Width, 0))
                return 5;
            axis = MachineControlAxis.All;
            if (HitBitmap(x, y, mAllHomeImg, mCircWidth - mAllHomeImg.Width, mCircWidth - mAllHomeImg.Height))
                return 5;

            // test for arches
            int level;
            axis = mSelAxis;
            x = x - mCenter;
            y = mCenter - y;
            double rad = Math.Sqrt(x * x + y * y);
            rad = (rad - mInRad) / mArchWidth;
            if (rad < 0)
                return 0;
            level = (int)rad + 1;
            if (level > 4)
                return 0;

            // test angle to find quad
            double angle = Math.Atan2(y, x) * 180.0 / Math.PI + 45.0;
            if (angle < 0)
                angle += 360.0;
            int quad = (int)(angle / 90);
            angle = angle - quad * 90;
            if ((angle < 5) || (angle > 85))
                return 0;
            switch (quad)
            {
                case 0: axis = MachineControlAxis.X; break;
                case 1: axis = MachineControlAxis.Y; break;
                case 2: axis = MachineControlAxis.X; level = -level; break;
                case 3: axis = MachineControlAxis.Y; level = -level; break;
            }
            return level;
        }
Ejemplo n.º 11
0
 // return correct arched image based on axis and level:
 // axis: 0=X 1=Y
 // level: 1 to 4 and -1 to -4: selected arch level where 1 and -1 are closer to the center
 Image GetArchImage(MachineControlAxis axis, int level)
 {
     if ((mSelAxis == axis) && (mSelLevel == level))
         return mArchesSel[4-Math.Abs(level)];
     return mArches[4-Math.Abs(level)];
 }
 private void cMCXY_MotorMove(object sender, MachineControlAxis axis, float val)
 {
     switch (axis)
     {
         case MachineControlAxis.X:
         case MachineControlAxis.Tilt:
             Callback.Activate("MCCmdMoveX", this, (double)val);
             break;
         case MachineControlAxis.Y:
             Callback.Activate("MCCmdMoveY", this, (double)val);
             break;
         case MachineControlAxis.Z:
             Callback.Activate("MCCmdMoveZ", this, (double)val);
             break;
         case MachineControlAxis.Extruder:
             Callback.Activate("MCCmdExtrude", this, (double)val);
             break;
     }
 }
 private void cMCXY_MotorHome(object sender, MachineControlAxis axis)
 {
     switch (axis)
     {
         case MachineControlAxis.X:
         case MachineControlAxis.Tilt:
             Callback.Activate("MCCmdXHome", this, null);
             break;
         case MachineControlAxis.Y:
             Callback.Activate("MCCmdYHome", this, null);
             break;
         case MachineControlAxis.Z:
             Callback.Activate("MCCmdZHome", this, null);
             break;
         case MachineControlAxis.All:
             Callback.Activate("MCCmdAllHome", this, null);
             break;
     }
 }
Ejemplo n.º 14
0
        protected int  GetSelection(int x, int y, out MachineControlAxis axis)
        {
            // first test corner buttons
            axis = MachineControlAxis.X;
            if (HitBitmap(x, y, mXHomeImg, 0, 0))
            {
                return(5);
            }
            axis = MachineControlAxis.Y;
            if (HitBitmap(x, y, mYHomeImg, mCircWidth - mYHomeImg.Width, 0))
            {
                return(5);
            }
            axis = MachineControlAxis.All;
            if (HitBitmap(x, y, mAllHomeImg, mCircWidth - mAllHomeImg.Width, mCircWidth - mAllHomeImg.Height))
            {
                return(5);
            }

            // test for arches
            int level;

            axis = mSelAxis;
            x    = x - mCenter;
            y    = mCenter - y;
            double rad = Math.Sqrt(x * x + y * y);

            rad = (rad - mInRad) / mArchWidth;
            if (rad < 0)
            {
                return(0);
            }
            level = (int)rad + 1;
            if (level > 4)
            {
                return(0);
            }

            // test angle to find quad
            double angle = Math.Atan2(y, x) * 180.0 / Math.PI + 45.0;

            if (angle < 0)
            {
                angle += 360.0;
            }
            int quad = (int)(angle / 90);

            angle = angle - quad * 90;
            if ((angle < 5) || (angle > 85))
            {
                return(0);
            }
            switch (quad)
            {
            case 0: axis = MachineControlAxis.X; break;

            case 1: axis = MachineControlAxis.Y; break;

            case 2: axis = MachineControlAxis.X; level = -level; break;

            case 3: axis = MachineControlAxis.Y; level = -level; break;
            }
            return(level);
        }