static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheet sheet = null; SolidEdgeFrameworkSupport.TextBoxes textBoxes = null; SolidEdgeFrameworkSupport.TextBox textBox = null; SolidEdgeFrameworkSupport.Leaders leaders = null; SolidEdgeFrameworkSupport.Leader leader = null; SolidEdgeFrameworkSupport.DimStyle dimStyle = 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 documents collection. documents = application.Documents; // Create a new draft document. draftDocument = documents.AddDraftDocument(); // Get a reference to the active sheet. sheet = draftDocument.ActiveSheet; // Get a reference to the TextBoxes collection. textBoxes = (SolidEdgeFrameworkSupport.TextBoxes)sheet.TextBoxes; // Add a new text box. textBox = textBoxes.Add(0.25, 0.25, 0); textBox.TextScale = 1; textBox.VerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextHzAlignVCenter; textBox.Text = "Leader"; // Get a reference to the Leaders collection. leaders = (SolidEdgeFrameworkSupport.Leaders)sheet.Leaders; Console.WriteLine("Creating a new leader. "); // Add a new leader. leader = leaders.Add(0.225, 0.225, 0, 0.25, 0.25, 0); dimStyle = leader.Style; dimStyle.FreeSpaceTerminatorType = SolidEdgeFrameworkSupport.DimTermTypeConstants.igDimStyleTermFilled; } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheet sheet = null; SolidEdgeFrameworkSupport.TextBoxes textBoxes = null; SolidEdgeFrameworkSupport.TextBox textBox = 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 documents collection. documents = application.Documents; // Create a new draft document. draftDocument = documents.AddDraftDocument(); // Get a reference to the active sheet. sheet = draftDocument.ActiveSheet; // Get a reference to the TextBoxes collection. textBoxes = (SolidEdgeFrameworkSupport.TextBoxes)sheet.TextBoxes; // Disable screen updating for performance. application.ScreenUpdating = false; double x = 0; double y = 0; for (int i = 0; i < 10; i++) { x += .05; y = 0; for (int j = 0; j < 50; j++) { y += .01; // Add a new text box. textBox = textBoxes.Add(x, y, 0); textBox.TextScale = 1; textBox.VerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextHzAlignVCenter; textBox.Text = String.Format("[X: {0:0.###} Y: {1:0.###}]", x, y); } } // Turn screen updating back on. application.ScreenUpdating = true; // Fit the view. application.StartCommand(SolidEdgeConstants.DetailCommandConstants.DetailViewFit); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheet sheet = null; SolidEdgeFrameworkSupport.TextBoxes textBoxes = null; SolidEdgeFrameworkSupport.TextBox textBox = null; SolidEdgeFrameworkSupport.Leaders leaders = null; SolidEdgeFrameworkSupport.Leader leader = null; SolidEdgeFrameworkSupport.DimStyle dimStyle = null; try { Console.WriteLine("Registering OleMessageFilter."); // Register with OLE to handle concurrency issues on the current thread. OleMessageFilter.Register(); Console.WriteLine("Connecting to Solid Edge."); // Connect to or start Solid Edge. application = SolidEdgeUtils.Connect(true); // Make sure user can see the GUI. application.Visible = true; // Bring Solid Edge to the foreground. application.Activate(); // Get a reference to the documents collection. documents = application.Documents; // Create a new draft document. draftDocument = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument"); // Get a reference to the active sheet. sheet = draftDocument.ActiveSheet; // Get a reference to the TextBoxes collection. textBoxes = (SolidEdgeFrameworkSupport.TextBoxes)sheet.TextBoxes; Console.WriteLine("Creating a new textbox. "); // Add a new text box. textBox = textBoxes.Add(0.25, 0.25, 0); textBox.TextScale = 1; textBox.VerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextHzAlignVCenter; textBox.Text = "Leader"; // Get a reference to the Leaders collection. leaders = (SolidEdgeFrameworkSupport.Leaders)sheet.Leaders; Console.WriteLine("Creating a new leader. "); // Add a new leader. leader = leaders.Add(0.225, 0.225, 0, 0.25, 0.25, 0); dimStyle = leader.Style; dimStyle.FreeSpaceTerminatorType = SolidEdgeFrameworkSupport.DimTermTypeConstants.igDimStyleTermFilled; } catch (System.Exception ex) { #if DEBUG System.Diagnostics.Debugger.Break(); #endif Console.WriteLine(ex.Message); } }