//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;
        }
        //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;
        }
        //point만 선택한다--------------------------------
        private void button1_Click(object sender, EventArgs e)
        {
            selob = null;

            if (catia == null)
            {
                MessageBox.Show("catia를 실행 해주세요.");
                return; +
            }
            if (catia.ActiveDocument == null)
            {
                MessageBox.Show("활성 document가 없습니다.");
                return;
            }
            object[] intype = { "Point" };
            //catia.ActiveDocument.Selection.SelectElement2(intype,"Select a Point",true); //esc  -> cancel

            string status;

            sel.Clear();
            status = sel.SelectElement2(intype, "Select a Point", true);

            if (status != "Normal" || sel.)
            {
                MessageBox.Show("선택한 정보가 없습니다.");
                return;
            }

            //textBox1.Text = sel.get_Name();
            //sel = catia.ActiveDocument.Selection;
            // string name = textBox1.Text;
            // HybridShapeTypeLib.Point p = (HybridShapeTypeLib.Point)sel.FindObject("Point");
            // sel.set_Name(name);
        }
        //point remane
        private void button4_Click(object sender, EventArgs e)
        {
            if (catia == null)
            {
                MessageBox.Show("catia를 실행 해주세요.");
                return;
            }
            if (catia.ActiveDocument == null)
            {
                MessageBox.Show("활성 document가 없습니다.");
                return;
            }
            try
            {
                sel = catia.ActiveDocument.Selection;
                // HybridShapeTypeLib.Point p = (HybridShapeTypeLib.Point)sel.FindObject("Point");
                INFITF.AnyObject p = sel.FindObject("Point");

                textBox1.Text = p.get_Name();

                //string name = textBox1.Text;
            }
            catch (Exception ex)
            {
                MessageBox.Show("선택한 정보가 없습니다.\n" + ex.Message);
                return;
            }

            // p.set_Name();
        }
        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();
        }
Exemple #6
0
 private MECMOD.Constraint createCnst(Part prt, Sketch skt, CatConstraintType cnstType, INFITF.AnyObject ob1, INFITF.AnyObject ob2)
 {
     INFITF.Reference  ref1 = prt.CreateReferenceFromGeometry(ob1);
     INFITF.Reference  ref2 = prt.CreateReferenceFromGeometry(ob2);
     MECMOD.Constraint cnst = skt.Constraints.AddBiEltCst(cnstType, ref1, ref2);
     return(cnst);
 }
Exemple #7
0
        // CreateCnst overloading-------------
        private static Constraint CreateCnst(Part prt, Sketch skt, CatConstraintType cntype, INFITF.AnyObject ob)
        {
            INFITF.Reference r   = prt.CreateReferenceFromGeometry(ob);
            Constraint       cnt = skt.Constraints.AddMonoEltCst(cntype, r); //1객체를 구속시킨다.

            return(cnt);
        }
Exemple #8
0
        //구속조건을 주는 method--------------------------------------------
        private static Constraint CreateCnst(Part prt, Sketch skt, CatConstraintType cntype, INFITF.AnyObject ob1, INFITF.AnyObject ob2)
        {
            INFITF.Reference r1  = prt.CreateReferenceFromGeometry(ob1);
            INFITF.Reference r2  = prt.CreateReferenceFromGeometry(ob2);
            Constraint       cnt = skt.Constraints.AddBiEltCst(cntype, r1, r2); //2객체 사이의 구속조건을 준다.

            return(cnt);
        }