Exemplo n.º 1
0
        //create3Dline--------------------------------------------
        private void button5_Click(object sender, EventArgs e)
        {
            // object[] HpCrd1 = new object[3];
            // object[] HpCrd2 = new object[3];

            try
            {
                sel           = catia.ActiveDocument.Selection;
                HyShpPtCoord1 = (HybridShapeTypeLib.Point)sel.FindObject("CATIAHybridShapePoint");
                //sel = catia.ActiveDocument.Selection;
                HyShpPtCoord2 = (HybridShapeTypeLib.Point)sel.FindObject("CATIAHybridShapePoint");

                //HyShpPtCoord1.GetCoordinates(HpCrd1);
                //HyShpPtCoord1.GetCoordinates(HpCrd2);

                PartDocument       prtDoc = (PartDocument)catia.ActiveDocument;
                Part               prt    = prtDoc.Part;
                HybridBody         hbdy   = prt.HybridBodies.Item(1);
                HybridShapeFactory hfac   = (HybridShapeFactory)prt.HybridShapeFactory;

                INFITF.Reference ref1 = prt.CreateReferenceFromGeometry(HyShpPtCoord1);
                INFITF.Reference ref2 = prt.CreateReferenceFromGeometry(HyShpPtCoord2);

                HybridShapeTypeLib.Line lin = hfac.AddNewLinePtPt(ref1, ref2);
                hbdy.AppendHybridShape(lin);

                prt.Update();
            }
            catch (Exception)
            {
                MessageBox.Show("선택된 정보가 없습니다.");
                return;
            }
        }
Exemplo n.º 2
0
        //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();
        }
Exemplo n.º 3
0
 //line 가져오기-------------------------------------
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         sel           = catia.ActiveDocument.Selection;
         lin           = (Line2D)sel.FindObject("CATIALine2D");
         textBox3.Text = lin.get_Name();
     }
     catch (Exception)
     {
         MessageBox.Show("선택한 정보가 없습니다.");
         return;
     }
 }
Exemplo n.º 4
0
        //point2 가져오기------------------------------------
        private void button2_Click(object sender, EventArgs e)
        {
            // object[] arrCoord = new object[2];

            try
            {
                sel = catia.ActiveDocument.Selection;
                p2  = (Point2D)sel.FindObject("CATIAPoint2D");

                p2.GetCoordinates(arrCoord2);
                textBox2.Text = p2.get_Name() + " ( " + arrCoord2[0] + " , " + arrCoord2[1] + " )";
            }
            catch (Exception)
            {
                MessageBox.Show("선택한 정보가 없습니다.");
                return;
            }
        }