private void button3_Click(object sender, EventArgs e) { // Connect to or start Solid Edge. YCC_solidedge.getEdgeApplication(ref SEApp, true); SolidEdgeAssembly.AssemblyDocument asydoc = (SolidEdgeAssembly.AssemblyDocument)SEApp.ActiveDocument; SolidEdgeAssembly.Occurrences occs = (SolidEdgeAssembly.Occurrences)asydoc.Occurrences; SolidEdgeAssembly.Occurrence occ = (SolidEdgeAssembly.Occurrence)occs.Item(2); Array MinRangePoint = Array.CreateInstance(typeof(double), 0); Array MaxRangePoint = Array.CreateInstance(typeof(double), 0); //object[] w = new object[3]; occ.GetRangeBox(ref MinRangePoint, ref MaxRangePoint); SolidEdgePart.PartDocument ps = (SolidEdgePart.PartDocument)occ.OccurrenceDocument; //SolidEdgePart.Models ms = (SolidEdgePart.Models)ps.Models.Item[1]; SolidEdgePart.Model m = (SolidEdgePart.Model)ps.Models.Item(1); SolidEdgeGeometry.Body b = (SolidEdgeGeometry.Body)m.Body; SolidEdgeGeometry.Edges ees = (SolidEdgeGeometry.Edges)b.Edges[SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll]; SolidEdgeGeometry.Edge ee = (SolidEdgeGeometry.Edge)ees.Item(1); //ee.GetRange(ref MinRangePoint, ref MaxRangePoint); b.GetRange(ref MinRangePoint, ref MaxRangePoint); }
static bool OpenFileFromTC(string strItemIn, string strRevision, string strExtension) { bool bSuccess = false; try { object outResult; int nPropCount; string strSEFilePath = ""; string strCachePath = ""; string FileRevisionRule = null; object[,] temp = new object[1, 1]; // Connect to or start Solid Edge. YCC_solidedge.getEdgeApplication(ref SEApp, true); // Get SEEC handle objTCE = SEApp.SolidEdgeTCE; if (null == objTCE) { return(false); } // Turn TC mode on objTCE.SetTeamCenterMode(true); // Obtain list of files. objTCE.GetListOfFilesFromTeamcenterServer(strItemIn, strRevision, out outResult, out nPropCount); // get cache path objTCE.GetPDMCachePath(out strCachePath); object[] result = outResult as object[]; //conversion object to object array foreach (object file in result) { MessageBox.Show(file.ToString()); string currfile = file.ToString(); objTCE.DownladDocumentsFromServerWithOptions(strItemIn, strRevision, currfile, FileRevisionRule, "", true, false, (uint)SolidEdgeConstants.TCDownloadOptions.COImplicit, temp); // Download complete. if (null != temp) { strSEFilePath = strCachePath + "\\" + currfile; object objOutDoc = SEApp.Documents.Open(strSEFilePath); if (objOutDoc != null) { return(true); } } } return(bSuccess); } catch (System.Exception ex) { return(bSuccess); } finally { } }
private void button4_Click(object sender, EventArgs e) { YCC_solidedge.getEdgeApplication(ref SEApp, true); partDoc = (SolidEdgePart.PartDocument)SEApp.ActiveDocument; SolidEdgePart.Model md = partDoc.Models.Item(1); SolidEdgeGeometry.Body by = (SolidEdgeGeometry.Body)md.Body; SolidEdgeGeometry.Edges ed = (SolidEdgeGeometry.Edges)by.Edges[SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryStraight]; List <SolidEdgeGeometry.Edge> ListExceptionEdge = new List <SolidEdgeGeometry.Edge>(); int Count = 0; foreach (SolidEdgeGeometry.Edge _e in ed) { if (ListExceptionEdge.Contains(_e)) { continue; } SEEdge newpoint = new SEEdge(_e); if (newpoint.Len == 23.09 || newpoint.Len == 11.55) { POP newPOP = new POP(newpoint); Count = Count + 1; if (newPOP.ListHexagonEdge.Count == 6) { foreach (SolidEdgeGeometry.Edge _edge in newPOP.ListHexagonEdge) { ListExceptionEdge.Add(_edge); } foreach (SolidEdgeGeometry.Edge _edge in newPOP.ListHoleEdge) { ListExceptionEdge.Add(_edge); } foreach (SolidEdgeGeometry.Edge _edge in newPOP.ListOtherHexagonEdge) { ListExceptionEdge.Add(_edge); } } } } //bool done = true; //int count = 0; //while (done) //{ // foreach (SEEdge _p in point23) // { // if (www(ref point23, _p)) // { // count++; // break; // } // if (_p == point23[point23.Count() - 1]) done = false; // } // if (point23.Count == 0) done = false; //} }