//point select private void button1_Click(object sender, EventArgs e) { selOb = null; //기본의 초기화!! textBox1.Text = ""; IsRunCatDoc(); // //catia 가 실행되어 있는지, 황성되어 있는 document가 있는지 sel = catia.ActiveDocument.Selection; object[] inputObjectType = { "Point" }; string Status; sel.Clear(); Status = sel.SelectElement2(inputObjectType, "Select a Point", true); if (Status != "Normal" || sel.Count < 1) { MessageBox.Show("선택한 point가 없습니다."); return; } INFITF.SelectedElement selItem; selItem = sel.Item(1); textBox1.Text = ((INFITF.AnyObject)selItem.Value).get_Name(); selOb = (INFITF.AnyObject)selItem.Value; }
//line 선택하기--------------------------------------------------------- private void button1_Click(object sender, EventArgs e) { sel = null; //action 시작할때 초기화할것! if (catia == null) { MessageBox.Show("Pleace run the CATIA"); return; //이게 없으면 오류난다. } if (catia.ActiveDocument == null) { MessageBox.Show("활성된 문서가 없습니다."); return; //이게 없으면 오류난다. } //line 선택 sel = catia.ActiveDocument.Selection; /////??? object[] inputObTyp = { "Line" }; sel.Clear(); string status = sel.SelectElement2(inputObTyp, "Select a line", true); if (status != "Normal") { MessageBox.Show("선택한 Line이 없습니다. "); return; } if (sel.Count < 1) { MessageBox.Show("line를 선택해주세요"); return; } //line 이름을 표시한다 textBox1.Text = ((INFITF.AnyObject)sel.Item(1).Value).get_Name(); }
//select a plan--------------------------------------- private void bselPlt_Click(object sender, EventArgs e) { IsRunCatDoc(); selOb = null; //기본의 초기화!! textBox3.Text = ""; sel = catia.ActiveDocument.Selection; object[] inputObjectType = { "Plane" }; string Status; sel.Clear(); Status = sel.SelectElement2(inputObjectType, "Select a Plane", true); if (Status != "Normal" || sel.Count < 1) { MessageBox.Show("선택한 Plane가 없습니다."); return; } INFITF.SelectedElement selItem; selItem = sel.Item(1); textBox3.Text = ((INFITF.AnyObject)selItem.Value).get_Name(); selOb = (INFITF.AnyObject)selItem.Value; }
private void textBox1_MouseClick(object sender, MouseEventArgs e) { // 카티아가 실행중? if (Catia == null) { //MessageBox.Show("Please run CATIA"); label3.Text = "Please run CATIA"; return; } // 활성 문서가 있는가? if (Catia.ActiveDocument == null) { //MessageBox.Show("활성 문서가 없습니다"); label3.Text = "활성 문서가 없습니다"; } // 선택 기능 실행 Sel = Catia.ActiveDocument.Selection; Object[] InputObjectType = { "HybridBody" }; string Status; Sel.Clear(); Status = Sel.SelectElement2(InputObjectType, "Select a Geometrical Set", false); if (Status != "Normal") { label3.Text = "취소"; return; } if (Sel.Count < 1) { label3.Text = "선택"; return; } SelGS = (HybridBody)Sel.Item(1).Value; textBox1.Text = SelGS.get_Name(); int ptCount = 0; for (int i = 1; i <= SelGS.HybridShapes.Count; i++) { ptCount++; Pts.Add(SelGS.HybridShapes.Item(i)); } label4.Text = ptCount + ""; }
//select an end point private void button2_Click(object sender, EventArgs e) { //obj = null; sel = catia.ActiveDocument.Selection; sel.Clear(); object[] inputObjType = { "Point" }; string status = sel.SelectElement2(inputObjType, "Select a end point", false); if (status != "Normal" || sel.Count < 1) { MessageBox.Show("Select a start point."); return; } ptEnd = sel.Item(1).Reference; }
private void button2_Click(object sender, EventArgs e) { // 카티아가 실행중? if (Catia == null) { //MessageBox.Show("Please run CATIA"); label1.Text = "Please run CATIA"; return; } // 활성 문서가 있는가? if (Catia.ActiveDocument == null) { //MessageBox.Show("활성 문서가 없습니다"); label1.Text = "활성 문서가 없습니다"; } // Point 선택 기능 실행 INFITF.Selection Sel = null; Sel = Catia.ActiveDocument.Selection; Object[] InputObjectType = { "Line" }; string Status; Sel.Clear(); Status = Sel.SelectElement2(InputObjectType, "Select an Line", false); if (Status != "Normal") { label1.Text = "취소됨"; return; } if (Sel.Count < 1) { label1.Text = "선택했나"; return; } //INFITF.SelectedElement SelObj = null; // 아이템 생성 SelObj = (INFITF.AnyObject)Sel.Item(1).Value; textBox2.Text = SelObj.get_Name(); }
//1.Gs 선택----------------------------------------------------------- private void button2_Click(object sender, EventArgs e) { // 카티아가 실행중? if (catia == null) { MessageBox.Show("Please run the CATIA"); return; } // 활성 문서가 있는가? if (catia.ActiveDocument == null) { MessageBox.Show("document를 열어주세요."); return; } try { // 선택 기능 실행 sel = catia.ActiveDocument.Selection; //Gs만 선택해주라~~ Object[] intype = { "HybridBody" }; //sel.Clear(); string status = sel.SelectElement2(intype, "Select a Geometrical set", true); /*The state of the selection command once SelectElement2 returns. * It can be either "Normal" (the selection has succeeded), * "Cancel" (the user wants to cancel the VB command, * which must exit immediately), "Undo" or "Redo". */ if (status != "Normal") { MessageBox.Show("Cancel"); return; } if (sel.Count < 1) { MessageBox.Show("GS를 선택해주세요"); return; } // GS이름 표시한다--- hbdy = (HybridBody)sel.Item(1).Value; textBox1.Text = hbdy.get_Name(); //point 수 표시한다--- int ptCount = 0; for (int i = 1; i <= hbdy.HybridShapes.Count; i++) //i=1부타 시작~~ { ptCount++; Pts.Add(hbdy.HybridShapes.Item(i)); } textBox2.Text = ptCount + ""; } catch (Exception) { MessageBox.Show("선택된 정보가 없습니다."); return; } }