private void button3_Click(object sender, EventArgs e) { if (PtStart == null) { return; } if (PtEnd == null) { return; } MECMOD.PartDocument PrtDoc = (MECMOD.PartDocument)Catia.ActiveDocument; MECMOD.Part prt = PrtDoc.Part; MECMOD.HybridBodies HBs = prt.HybridBodies; MECMOD.HybridBody HyBody = HBs.Add(); HybridShapeTypeLib.HybridShapeFactory HSFac = (HybridShapeTypeLib.HybridShapeFactory)prt.HybridShapeFactory; HybridShapeTypeLib.HybridShapeLinePtPt Lineptpt = null; Lineptpt = HSFac.AddNewLinePtPt((INFITF.Reference)PtStart, (INFITF.Reference)PtEnd); HyBody.AppendHybridShape(Lineptpt); prt.Update(); }
private void button2_Click(object sender, EventArgs e) { if (catia == null) { MessageBox.Show("Please run CATIA"); return; } try { prtDoc = (MECMOD.PartDocument)catia.ActiveDocument; } catch (Exception) { MessageBox.Show("please open a document."); return; } //2.Gs 생성 MECMOD.HybridBody hbdy = prtDoc.Part.HybridBodies.Add(); hbdy.set_Name("PointForDraeingGS"); //3.add points HybridShapeTypeLib.HybridShapeFactory hfac = (HybridShapeTypeLib.HybridShapeFactory)prtDoc.Part.HybridShapeFactory; pt1 = hfac.AddNewPointCoord(0, 0, 0); pt2 = hfac.AddNewPointCoord(-250, 100, -300); pt3 = hfac.AddNewPointCoord(90, -250, 60); pt1.set_Name("PT-1"); pt2.set_Name("PT-2"); pt3.set_Name("PT-3"); hbdy.AppendHybridShape(pt1); hbdy.AppendHybridShape(pt2); hbdy.AppendHybridShape(pt3); prtDoc.Part.Update(); }