Exemple #1
0
        private void BUTTON_ROTATE_TEST_Click(object sender, EventArgs e)
        {
            if (m_samlight.ScIsRunning() == 0)
            {
                MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }
            double min_x, min_y, max_x, max_y;
            double center_x, center_y;
            double ang_inc;
            double act_angle;
            long   save_mark_flags;
            String entity_name = EDIT_ENTITY_NAME.Text;

            // first we calculate the center of the entity

            min_x    = m_samlight.ScGetEntityOutline(entity_name, 0);
            min_y    = m_samlight.ScGetEntityOutline(entity_name, 1);
            max_x    = m_samlight.ScGetEntityOutline(entity_name, 3);
            max_y    = m_samlight.ScGetEntityOutline(entity_name, 4);
            center_x = (min_x + max_x) / 2.0;
            center_y = (min_y + max_y) / 2.0;

            save_mark_flags = m_samlight.ScGetMarkFlags();
            m_samlight.ScSetMarkFlags(( int )save_mark_flags | 0x4);
            // here we do the loop

            ang_inc   = (360.0 / 20.0) * Math.PI / 180.0;
            act_angle = 0.0;
            for (int i = 0; i < 20; i++)
            {
                m_samlight.ScOpticMatrixReset();
                m_samlight.ScOpticMatrixRotate(center_x, center_y, act_angle);
                //		m_samlight.ScOpticMatrixTranslate(0,0,5*i);
                m_samlight.ScMarkEntityByName(entity_name, 1);
                act_angle = act_angle + ang_inc;
            }
            m_samlight.ScOpticMatrixReset();
            m_samlight.ScSetMarkFlags(( int )save_mark_flags);
        }
Exemple #2
0
        private void BUTTON_GET_OUTLINE_Click(object sender, EventArgs e)
        {
            if (m_samlight.ScIsRunning() == 0)
            {
                MessageBox.Show("SAMLight not found", "Warning", MessageBoxButtons.OK);
                return;
            }

            // here we calc the outline
            EDIT_OUTLINE_MIN_X.Text = Convert.ToString(m_samlight.ScGetEntityOutline(EDIT_ENTITY_NAME.Text, 0), CultureInfo.InvariantCulture);
            EDIT_OUTLINE_MIN_Y.Text = Convert.ToString(m_samlight.ScGetEntityOutline(EDIT_ENTITY_NAME.Text, 1), CultureInfo.InvariantCulture);
            EDIT_OUTLINE_MIN_Z.Text = Convert.ToString(m_samlight.ScGetEntityOutline(EDIT_ENTITY_NAME.Text, 2), CultureInfo.InvariantCulture);
            EDIT_OUTLINE_MAX_X.Text = Convert.ToString(m_samlight.ScGetEntityOutline(EDIT_ENTITY_NAME.Text, 3), CultureInfo.InvariantCulture);
            EDIT_OUTLINE_MAX_Y.Text = Convert.ToString(m_samlight.ScGetEntityOutline(EDIT_ENTITY_NAME.Text, 4), CultureInfo.InvariantCulture);
            EDIT_OUTLINE_MAX_Z.Text = Convert.ToString(m_samlight.ScGetEntityOutline(EDIT_ENTITY_NAME.Text, 5), CultureInfo.InvariantCulture);
        }
Exemple #3
0
        public void GetCenterXYSamlight(string edtEntityName, out double center_x, out double center_y)  //获取某个实体的中心坐标X,y
        {
            center_x = 0;
            center_y = 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);
            center_x = (min_x + max_x) / 2;
            center_y = (min_y + max_y) / 2;
            //GetCenterX = center_x;
            //GetCenterY = center_y;
        }