Beispiel #1
0
        public bool RelMoveTo(string entityName, double x, double y)
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return(false);
            }
            else
            {
                double center_x, center_y;
                double min_x, min_y, max_x, max_y;
                min_x    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 0);
                min_y    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 1);
                max_x    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 3);
                max_y    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 4);
                center_x = (min_x + max_x) / 2;
                center_y = (min_y + max_y) / 2;

                double disx = x; // +center_x;// Convert.ToDouble(edtTargetX.Text) - Convert.ToDouble(edt_cenX.Text);
                double disy = y; // +center_y;// Convert.ToDouble(edtTargetY.Text) - Convert.ToDouble(edt_cenY.Text);
                axScSamlightClientCtrl1.ScTranslateEntity(entityName, disx, disy, 0);
                return(true);
            }
        }
Beispiel #2
0
        public int mark_entity(String entity_name_to_mark)
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                return(0);
            }

            Set_Output(3, true);

            long mark_flags = 0x4;//0x0;

            axScSamlightClientCtrl1.ScSetMarkFlags((int)mark_flags);

            axScSamlightClientCtrl1.ScMarkEntityByName(entity_name_to_mark, 0);

            int i = 0;

            while (true)
            {
                i++;
                Application.DoEvents();
                if (i % 10 == 0)
                {
                    if (axScSamlightClientCtrl1.ScIsMarking() == 0)
                    {
                        break;
                    }
                }
            }
            axScSamlightClientCtrl1.ScStopMarking();

            Set_Output(3, false);
            return(1);
        }
Beispiel #3
0
 public void NewJob()
 {
     if (axScSamlightClientCtrl1.ScIsRunning() == 0)
     {
         MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
         //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
         return;
     }
     axScSamlightClientCtrl1.ScExecCommand(3);
 }
Beispiel #4
0
 public void LoadjobSamlight(string filename, int load_entities, int overwrite_entities, int load_materials)  //载入文件函数
 {
     if (axScSamlightClientCtrl1.ScIsRunning() == 0)
     {
         MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
         //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
         return;
     }
     axScSamlightClientCtrl1.ScLoadJob(filename, load_entities, overwrite_entities, load_materials);
 }
Beispiel #5
0
        //文件内所有实体均打标
        //public void MarkAllEntity()
        //{
        //    if (axScSamlightClientCtrl1.ScIsRunning() == 0)
        //    {
        //        MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
        //        return;
        //    }

        //    mark_entity("");
        //}

        public void StopSamlight()  //停止打标
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }
            axScSamlightClientCtrl1.ScStopMarking();
        }
Beispiel #6
0
 //public String TestConnectSamlight() //测试客户端连接Samlight服务器端
 //{
 //    if (axScSamlightClientCtrl1.ScIsRunning() == 0)
 //    {
 //        MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
 //        return "SAMLight not found";
 //    }
 //    //弹出“hello from samlight"对话框说明连接成功
 //    long t=0;
 //    t= axScSamlightClientCtrl1.ScExecCommand(1);
 //    return "";
 //}
 public bool TestConnectSamlight() //测试客户端连接Samlight服务器端
 {
     if (axScSamlightClientCtrl1.ScIsRunning() == 0)
     {
         MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
         //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
         return(false);
     }
     //弹出“hello from samlight"对话框说明连接成功
     return(true);
 }
Beispiel #7
0
        public void MarkAllSamlight()//打标函数(打标所有的)
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }

            mark_entity("");
        }
Beispiel #8
0
        public void WriteBarcode(string filename, string barcodetext)
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }
            axScSamlightClientCtrl1.ScChangeTextByName(filename, barcodetext);

            //axScSamlightClientCtrl1.ScSetPen(
        }
Beispiel #9
0
 public bool ScaleSize(string entityName, double ScaleX, double ScaleY)
 {
     if (axScSamlightClientCtrl1.ScIsRunning() == 0)
     {
         MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
         //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         axScSamlightClientCtrl1.ScScaleEntity(entityName, ScaleX, ScaleY, 0);
         return(true);
     }
 }
Beispiel #10
0
 public bool MarkSamlight(string edtmarkName) //打标函数(打指定的)
 {
     if (axScSamlightClientCtrl1.ScIsRunning() == 0)
     {
         MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
         //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
         return(false);
     }
     else
     {
         mark_entity(edtmarkName);
         return(true);
     }
 }
Beispiel #11
0
        public void ImportImage(string FilePath, float DitherSteps)
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }

            //flags = ( int )ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlImportFlagKeepOrder |
            //        ( int )ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlImportFlagReadPenInfo |
            //        ( int )ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlImportFlagCenterToField |
            //        ( int )ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlImportFlagCreateOneGroup;
            long flags = 0;

            axScSamlightClientCtrl1.ScImport("", FilePath, "jpg", 1, (int)flags);

            ScaleSize("", Para.SWImgToSamlightXScale, Para.SWImgToSamlightYScale);

            axScSamlightClientCtrl1.ScSetEntityDoubleData("", (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlDoubleDataIdBitmapDitherstep, Math.Round(DitherSteps, 3));
            //axScSamlightClientCtrl1.ScSetEntityLongData("", (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapMode, 49);


            if (Para.SMBitmapInverted)
            {
                flags = (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeInvert |
                        (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeShowScanner |
                        (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeShowBitmap;
            }
            else
            {
                flags = //(int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeInvert |
                        (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeShowScanner |
                        (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeShowBitmap;
            }

            if (Para.SamlightGreyScale)
            {
                //if (true)
                flags = flags | (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapModeGreyscale;
            }

            axScSamlightClientCtrl1.ScSetEntityLongData("", (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlLongDataIdBitmapMode, (int)flags);

            AbsMoveTo("", 0 + Para.SMCenterToActualCenterX, 0 + Para.SMCenterToActualCenterY);

            //Rotate("",45);
        }
Beispiel #12
0
        public void ShowRedPointer()
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }
            axScSamlightClientCtrl1.ScSetLongValue((int)65, 2);

            axScSamlightClientCtrl1.ScExecCommand(( int )SAMLIGHT_CLIENT_CTRL_OCXLib.ScComSAMLightClientCtrlExecCommandConstants.scComSAMLightClientCtrlExecCommandRedPointerStart);            
            //axScSamlightClientCtrl1.ScExecCommand( ( int )SAMLIGHT_CLIENT_CTRL_OCXLib.ScComSAMLightClientCtrlExecCommandConstants.scComSAMLightClientCtrlExecCommandRedPointerStop ); 
            //axScSamlightClientCtrl1.ScExecCommand( ( int )SAMLIGHT_CLIENT_CTRL_OCXLib.ScComSAMLightClientCtrlExecCommandConstants.scComSAMLightClientCtrlExecCommandCloseMarkDialog );
            ////scComSAMLightClientCtrlLongValueTypeRedpointerMode
                isRedPointerShown = true;
        }
Beispiel #13
0
        public void GetSizeXYSamlight(string edtEntityName, out double sizeX, out double sizeY)  //获取某个实体的中心坐标X,y
        {
            sizeX = 0;
            sizeY = 0;
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }

            double min_x, min_y, max_x, max_y;

            min_x = axScSamlightClientCtrl1.ScGetEntityOutline(edtEntityName, 0);
            min_y = axScSamlightClientCtrl1.ScGetEntityOutline(edtEntityName, 1);
            max_x = axScSamlightClientCtrl1.ScGetEntityOutline(edtEntityName, 3);
            max_y = axScSamlightClientCtrl1.ScGetEntityOutline(edtEntityName, 4);
            sizeX = (max_x - min_x);
            sizeY = (max_y - min_y);
            //GetCenterX = center_x;
            //GetCenterY = center_y;
        }
Beispiel #14
0
        public bool Rotate(string entityName, double angle)
        {
            if (axScSamlightClientCtrl1.ScIsRunning() == 0)
            {
                MessageBox.Show(MultiLanguage.GeSamlightNotFoundString(), MultiLanguage.GeSamlightWarningString(), MessageBoxButtons.OK);
                //MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return(false);
            }
            else
            {
                double center_x, center_y;
                double min_x, min_y, max_x, max_y;
                min_x    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 0);
                min_y    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 1);
                max_x    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 3);
                max_y    = axScSamlightClientCtrl1.ScGetEntityOutline(entityName, 4);
                center_x = (min_x + max_x) / 2;
                center_y = (min_y + max_y) / 2;

                axScSamlightClientCtrl1.ScRotateEntity(entityName, center_x, center_y, angle);
                return(true);
            }
        }