static void UpdateAllViewsInAllSheets(SolidEdgeDraft.Sheets sheets) { SolidEdgeDraft.Sheet sheet = null; SolidEdgeDraft.DrawingViews drawingViews = null; SolidEdgeDraft.DrawingView drawingView = null; for (int i = 1; i < sheets.Count; i++) { sheet = sheets.Item(i); Console.WriteLine("Processing Sheet '{0}'.", sheet.Name); drawingViews = sheet.DrawingViews; for (int j = 1; j < drawingViews.Count; j++) { drawingView = drawingViews.Item(j); Console.WriteLine("Updating DrawingView '{0} - {1}'.", drawingView.Name, drawingView.Caption); // Updates an out-of-date drawing view. drawingView.Update(); // Updates the drawing view even if it is not out-of-date. //drawingView.ForceUpdate(); } } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheets sheets = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the active document. draftDocument = application.GetActiveDocument <SolidEdgeDraft.DraftDocument>(false); // Make sure we have a document. if (draftDocument != null) { // Get a reference to the sheets collection. sheets = draftDocument.Sheets; foreach (var sheet in sheets.OfType <SolidEdgeDraft.Sheet>()) { Console.WriteLine("Name: {0}", sheet.Name); Console.WriteLine("Index: {0}", sheet.Index); Console.WriteLine("Number: {0}", sheet.Number); Console.WriteLine("SectionType: {0}", sheet.SectionType); Console.WriteLine(); } } else { throw new System.Exception("No active document."); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheets sheets = null; SolidEdgeDraft.Sheet sheet = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(false); // Get a reference to the active draft document. draftDocument = application.GetActiveDocument <SolidEdgeDraft.DraftDocument>(false); if (draftDocument != null) { // Get a reference to the Sheets collection. sheets = draftDocument.Sheets; // Add a new sheet. sheet = sheets.AddSheet(); // Make the new sheet the active sheet. sheet.Activate(); } else { throw new System.Exception("No active documet."); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }