1 Reply Latest reply on Aug 16, 2013 11:21 AM by Daniel Plucinski

    Sheet.TitleBlock returns null when there is a TitleBlock in the drawing

    Daniel Plucinski

      I'm trying to retrieve the highlighted cell from my drawing's TitleBlock as seen in the attached image. However, whenver I attempt to get the TitleBlock it returns null.

       

      Here's the part of my code(C#):

       

       

      swDraw = (DrawingDoc)swDoc;

      Sheet swSheet;

      swSheet = (Sheet)swDraw.GetCurrentSheet();

      swTitleBlock = (TitleBlock)swSheet.TitleBlock;

       

      swSheet.GetName() returns sheet1 as expected, but swSheet.Titleblock return null.

       

      I have no clue why this is. If anyone has any idea or has an alternative method to retrieving the information I need please let me know.

        • Re: Sheet.TitleBlock returns null when there is a TitleBlock in the drawing
          Daniel Plucinski

          I found a workaround.

           

                          SolidWorks.Interop.sldworks.View swView;

                          Note swNote;

                          swView = swDraw.GetFirstView();

                          swNote = swView.GetFirstNote();

                          while (swNote != null)

                          {

                              if (swNote.GetText() == "Pipe Color")

                              {

                                  swNote = swNote.GetNext();

                                  pipeColor = " - " + swNote.GetText();

                                  break;

                              }

                              swNote = swNote.GetNext();

           

           

                          }