示例#1
0
        static void AddLineAndDimension(SolidEdgeDraft.DraftDocument draftDocument)
        {
            SolidEdgeDraft.Sheet sheet = null;
            SolidEdgeFrameworkSupport.Lines2d    lines2d    = null;
            SolidEdgeFrameworkSupport.Line2d     line2d     = null;
            SolidEdgeFrameworkSupport.Dimensions dimensions = null;
            SolidEdgeFrameworkSupport.Dimension  dimension  = null;
            SolidEdgeFrameworkSupport.DimStyle   dimStyle   = null;

            // Get a reference to the active sheet.
            sheet = draftDocument.ActiveSheet;

            // Get a reference to the Lines2d collection.
            lines2d = sheet.Lines2d;

            // Draw a new line.
            line2d = lines2d.AddBy2Points(
                x1: 0.2,
                y1: 0.2,
                x2: 0.3,
                y2: 0.2);

            // Get a reference to the Dimensions collection.
            dimensions = (SolidEdgeFrameworkSupport.Dimensions)sheet.Dimensions;

            // Add a dimension to the line.
            dimension = dimensions.AddLength(line2d);

            // Get a reference to the dimension style.
            // DimStyle has a ton of options...
            dimStyle = dimension.Style;
        }
示例#2
0
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application       application   = null;
            SolidEdgeFramework.Documents         documents     = null;
            SolidEdgeDraft.DraftDocument         draftDocument = null;
            SolidEdgeDraft.Sheet                 sheet         = null;
            SolidEdgeFrameworkSupport.Lines2d    lines2d       = null;
            SolidEdgeFrameworkSupport.Line2d     line2d        = null;
            SolidEdgeFrameworkSupport.Dimensions dimensions    = null;
            SolidEdgeFrameworkSupport.Dimension  dimension     = 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 Lines2d collection.
                lines2d = sheet.Lines2d;

                // Draw a new line.
                line2d = lines2d.AddBy2Points(
                    x1: 0.2,
                    y1: 0.2,
                    x2: 0.3,
                    y2: 0.2);

                // Get a reference to the Dimensions collection.
                dimensions = (SolidEdgeFrameworkSupport.Dimensions)sheet.Dimensions;

                // Add a dimension to the line.
                dimension = dimensions.AddLength(line2d);

                // Get a reference to the dimension style.
                // DimStyle has a ton of options...
                dimStyle = dimension.Style;
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                SolidEdgeCommunity.OleMessageFilter.Unregister();
            }
        }
示例#3
0
        static void AddPartViewAndDimension(SolidEdgeDraft.DraftDocument draftDocument)
        {
            SolidEdgeDraft.Sheet        sheet        = null;
            SolidEdgeDraft.ModelLinks   modelLinks   = null;
            SolidEdgeDraft.ModelLink    modelLink    = null;
            SolidEdgeDraft.DrawingViews drawingViews = null;
            SolidEdgeDraft.DrawingView  drawingView  = null;
            DirectoryInfo trainingDirectory          = GetTrainingDirectory();
            string        fileName = Path.Combine(trainingDirectory.FullName, "2holebar.par");

            SolidEdgeDraft.DVLines2d             dvLines2d  = null;
            SolidEdgeDraft.DVLine2d              dvLine2d   = null;
            SolidEdgeFrameworkSupport.Dimensions dimensions = null;
            SolidEdgeFrameworkSupport.Dimension  dimension  = null;
            SolidEdgeFrameworkSupport.DimStyle   dimStyle   = null;

            // Get a reference to the active sheet.
            sheet = draftDocument.ActiveSheet;

            // Get a reference to the ModelLinks collection.
            modelLinks = draftDocument.ModelLinks;

            // Add a new model link.
            modelLink = modelLinks.Add(fileName);

            // Get a reference to the DrawingViews collection.
            drawingViews = sheet.DrawingViews;

            // Add a new part drawing view.
            drawingView = drawingViews.AddPartView(
                From: modelLink,
                Orientation: SolidEdgeDraft.ViewOrientationConstants.igDimetricTopBackLeftView,
                Scale: 5.0,
                x: 0.4,
                y: 0.4,
                ViewType: SolidEdgeDraft.PartDrawingViewTypeConstants.sePartDesignedView);

            // Get a reference to the DVLines2d collection.
            dvLines2d = drawingView.DVLines2d;

            // Get the 1st drawing view 2D line.
            dvLine2d = dvLines2d.Item(1);

            // Get a reference to the Dimensions collection.
            dimensions = (SolidEdgeFrameworkSupport.Dimensions)sheet.Dimensions;

            // Add a dimension to the line.
            dimension = dimensions.AddLength(dvLine2d.Reference);

            // Few changes to make the dimensions look right.
            dimension.ProjectionLineDirection = true;
            dimension.TrackDistance           = 0.02;

            // Get a reference to the dimension style.
            // DimStyle has a ton of options...
            dimStyle = dimension.Style;
        }
示例#4
0
        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();
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application       application   = null;
            SolidEdgeFramework.Documents         documents     = null;
            SolidEdgeDraft.DraftDocument         draftDocument = null;
            SolidEdgeDraft.ModelLinks            modelLinks    = null;
            SolidEdgeDraft.ModelLink             modelLink     = null;
            SolidEdgeDraft.Sheet                 sheet         = null;
            SolidEdgeDraft.DrawingViews          drawingViews  = null;
            SolidEdgeDraft.DrawingView           drawingView   = null;
            SolidEdgeDraft.DVLines2d             dvLines2d     = null;
            SolidEdgeDraft.DVLine2d              dvLine2d      = null;
            SolidEdgeFrameworkSupport.Dimensions dimensions    = null;
            SolidEdgeFrameworkSupport.Dimension  dimension     = null;
            SolidEdgeFrameworkSupport.DimStyle   dimStyle      = null;
            string filename = 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 ModelLinks collection.
                modelLinks = draftDocument.ModelLinks;

                // Build path to part file.
                filename = System.IO.Path.Combine(SolidEdgeCommunity.SolidEdgeUtils.GetTrainingFolderPath(), "2holebar.par");

                // Add a new model link.
                modelLink = modelLinks.Add(filename);

                // Get a reference to the active sheet.
                sheet = draftDocument.ActiveSheet;

                // Get a reference to the DrawingViews collection.
                drawingViews = sheet.DrawingViews;

                // Add a new part drawing view.
                drawingView = drawingViews.AddPartView(
                    From: modelLink,
                    Orientation: SolidEdgeDraft.ViewOrientationConstants.igDimetricTopBackLeftView,
                    Scale: 5.0,
                    x: 0.4,
                    y: 0.4,
                    ViewType: SolidEdgeDraft.PartDrawingViewTypeConstants.sePartDesignedView);

                // Get a reference to the DVLines2d collection.
                dvLines2d = drawingView.DVLines2d;

                // Get the 1st drawing view 2D line.
                dvLine2d = dvLines2d.Item(1);

                // Get a reference to the Dimensions collection.
                dimensions = (SolidEdgeFrameworkSupport.Dimensions)sheet.Dimensions;

                // Add a dimension to the line.
                dimension = dimensions.AddLength(dvLine2d.Reference);

                // Few changes to make the dimensions look right.
                dimension.ProjectionLineDirection = true;
                dimension.TrackDistance           = 0.02;

                // Get a reference to the dimension style.
                // DimStyle has a ton of options...
                dimStyle = dimension.Style;
            }
            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);
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application     application   = null;
            SolidEdgeFramework.Documents       documents     = null;
            SolidEdgeDraft.DraftDocument       draftDocument = null;
            SolidEdgeDraft.Sheet               sheet         = null;
            SolidEdgeFrameworkSupport.Balloons balloons      = null;
            SolidEdgeFrameworkSupport.Balloon  balloon       = null;
            SolidEdgeFrameworkSupport.DimStyle dimStype      = 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 balloons collection.
                balloons = (SolidEdgeFrameworkSupport.Balloons)sheet.Balloons;

                balloon             = balloons.Add(0.05, 0.05, 0);
                balloon.TextScale   = 1.0;
                balloon.BalloonText = "B";
                balloon.Leader      = true;
                balloon.BreakLine   = true;
                balloon.BalloonSize = 3;
                balloon.SetTerminator(balloon, 0, 0, 0, false);
                balloon.BalloonType = SolidEdgeFrameworkSupport.DimBalloonTypeConstants.igDimBalloonCircle;

                dimStype = balloon.Style;
                dimStype.TerminatorType = SolidEdgeFrameworkSupport.DimTermTypeConstants.igDimStyleTermFilled;

                balloon             = balloons.Add(0.1, 0.1, 0);
                balloon.Callout     = 1;
                balloon.TextScale   = 1.0;
                balloon.BalloonText = "This is a callout";
                balloon.Leader      = true;
                balloon.BreakLine   = true;
                balloon.BalloonSize = 3;
                balloon.SetTerminator(balloon, 0, 0, 0, false);
                balloon.BalloonType = SolidEdgeFrameworkSupport.DimBalloonTypeConstants.igDimBalloonCircle;

                dimStype = balloon.Style;
                dimStype.TerminatorType = 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.Balloons balloons      = null;
            SolidEdgeFrameworkSupport.Balloon  balloon       = null;
            SolidEdgeFrameworkSupport.DimStyle dimStype      = 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 balloons collection.
                balloons = (SolidEdgeFrameworkSupport.Balloons)sheet.Balloons;

                balloon             = balloons.Add(0.05, 0.05, 0);
                balloon.TextScale   = 1.0;
                balloon.BalloonText = "B";
                balloon.Leader      = true;
                balloon.BreakLine   = true;
                balloon.BalloonSize = 3;
                balloon.SetTerminator(balloon, 0, 0, 0, false);
                balloon.BalloonType = SolidEdgeFrameworkSupport.DimBalloonTypeConstants.igDimBalloonCircle;

                dimStype = balloon.Style;
                dimStype.TerminatorType = SolidEdgeFrameworkSupport.DimTermTypeConstants.igDimStyleTermFilled;

                balloon             = balloons.Add(0.1, 0.1, 0);
                balloon.Callout     = 1;
                balloon.TextScale   = 1.0;
                balloon.BalloonText = "This is a callout";
                balloon.Leader      = true;
                balloon.BreakLine   = true;
                balloon.BalloonSize = 3;
                balloon.SetTerminator(balloon, 0, 0, 0, false);
                balloon.BalloonType = SolidEdgeFrameworkSupport.DimBalloonTypeConstants.igDimBalloonCircle;

                dimStype = balloon.Style;
                dimStype.TerminatorType = SolidEdgeFrameworkSupport.DimTermTypeConstants.igDimStyleTermFilled;
            }
            catch (System.Exception ex)
            {
#if DEBUG
                System.Diagnostics.Debugger.Break();
#endif
                Console.WriteLine(ex.Message);
            }
        }