static void ProcessSectionSheets(SolidEdgeDraft.SectionSheets sectionSheets)
        {
            SolidEdgeDraft.Sheet sheet = null;

            for (int i = 1; i <= sectionSheets.Count; i++)
            {
                sheet = sectionSheets.Item(i);
                Console.WriteLine("\tSheet.Name: {0}", sheet.Name);
            }
        }
        static void ProcessWorkingSectionDrawingViews(SolidEdgeDraft.Section section)
        {
            Console.WriteLine("--> {0}", System.Reflection.MethodBase.GetCurrentMethod().ToString());

            SolidEdgeDraft.SectionSheets sectionSheets = null;
            SolidEdgeDraft.Sheet         sheet         = null;
            SolidEdgeDraft.DrawingViews  drawingViews  = null;
            SolidEdgeDraft.DrawingView   drawingView   = null;

            if (section.Type == SolidEdgeDraft.SheetSectionTypeConstants.igWorkingSection)
            {
                sectionSheets = section.Sheets;

                for (int i = 1; i <= sectionSheets.Count; i++)
                {
                    sheet = sectionSheets.Item(i);
                    Console.WriteLine("\tSheet.Name: {0}", sheet.Name);

                    drawingViews = sheet.DrawingViews;
                    for (int j = 1; j <= sectionSheets.Count; j++)
                    {
                        drawingView = drawingViews.Item(j);
                        Console.WriteLine("\tDrawingView.Name: {0}", drawingView.Name);

                        ProcessDrawingViewModelLink(drawingView);
                        ProcessDrawingViewModelMembers(drawingView);
                    }
                }
            }
            else
            {
                Console.WriteLine("Section '{0}' is not an igWorkingSection.", section);
            }

            Console.WriteLine("<-- {0}", System.Reflection.MethodBase.GetCurrentMethod().ToString());
        }
Exemple #3
0
        static void CreateDraft()
        {
            //draft = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument", Missing.Value);
            try
            {
                //add a draft document
                documents = application.Documents;
                draft = (SolidEdgeDraft.DraftDocument)documents.Add("SolidEdge.DraftDocument", Missing.Value);

                // Get a reference to the sheets collection
                sheets = draft.Sheets;

                // Add sheets to draft document
                // Loop thru list of wall - to do

                // Add a new sheet
                sheet = sheets.Item(1);
                sheet.Activate();
                sheet.Name = "MUR A";
                // Add wall drawings

                //Insert next wall
                sheet = sheets.AddSheet("MUR B", SheetSectionTypeConstants.igWorkingSection, Missing.Value, Missing.Value);
                sheet.Activate();
                // Add wall drawing

                //Insert next wall
                sheet = sheets.AddSheet("MUR C", SheetSectionTypeConstants.igWorkingSection, Missing.Value, Missing.Value);
                sheet.Activate();
                // Add wall drawings

                //Insert next wall
                sheet = sheets.AddSheet("MUR D", SheetSectionTypeConstants.igWorkingSection, Missing.Value, Missing.Value);
                sheet.Activate();
                // Add wall drawings

                //Insert next wall
                sheet = sheets.AddSheet("CHEVRONS", SheetSectionTypeConstants.igWorkingSection, Missing.Value, Missing.Value);
                sheet.Activate();
                // Add wall drawings

            }

            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                if (sheet != null)
                {
                    Marshal.ReleaseComObject(sheet);
                    sheet = null;
                }
                if (sheets != null)
                {
                    Marshal.ReleaseComObject(sheets);
                    sheets = null;
                }
                if (sectionSheets != null)
                {
                    Marshal.ReleaseComObject(sectionSheets);
                    sectionSheets = null;
                }
                if (section != null)
                {
                    Marshal.ReleaseComObject(section);
                    section = null;
                }
                if (draft != null)
                {
                    Marshal.ReleaseComObject(draft);
                    draft = null;
                }
                if (documents != null)
                {
                    Marshal.ReleaseComObject(documents);
                    documents = null;
                }
                if (application != null)
                {
                    Marshal.ReleaseComObject(application);
                    application = null;
                }

            }
        }