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); }
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); }