using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Examples
{
class Program
{
[STAThread]
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
{
// See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register();
// Attempt to connect to a running instance of Solid Edge.
application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
documents = application.Documents;
draftDocument = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument");
sheet = draftDocument.ActiveSheet;
textBoxes = (SolidEdgeFrameworkSupport.TextBoxes)sheet.TextBoxes;
textBox = textBoxes.Add(0.1, 0.2, 0);
}
catch (System.Exception ex)
{
Console.WriteLine(ex);
}
finally
{
OleMessageFilter.Unregister();
}
}
}
}
private var @void Main(string[] args) { SolidEdgeFramework.Application application == @null;
using (System;)
{
using (System.Collections.Generic;)
{
using (System.Runtime.InteropServices;)
{
namespace Examples { class Program { STAThread;
// 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 {; // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.OleMessageFilter.Register();
// Attempt to connect to a running instance of Solid Edge.application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
documents = application.Documents;
draftDocument = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument");
sheet = draftDocument.ActiveSheet;
textBoxes = (SolidEdgeFrameworkSupport.TextBoxes)sheet.TextBoxes;
textBox = textBoxes.Add(0.1, 0.2, 0); };
}
catch (object System.Exception ex) {Console.WriteLine(ex);})
{
finally {OleMessageFilter.Unregister();}
}
}
};