1 Reply Latest reply on Dec 9, 2016 1:22 AM by テ ソ ン キ ム

    Can't Note.GetText from Annotation In SolidWorks2015

    テ ソ ン キ ム

      Hi all.

       

      I have a SolidWorks AddIn Program.

      It first get all annotations from draw file which opened .

      And Next get texts from annotations with SolidWorks.Interop.sldworks.Note.GetText() method.

       

      But, have a case what get text just "" even though the object have text.

      Now, I explain you this phenomenon, But i'm using Japanese version, So I don't know that menu's name is what in English Version.

      So I attach some image pleases refer this.

       

      If i make detail view or section view, API can't get text which wrote with detail view or section view.

      This don't occur in Solidworks2013.

       

      I attach simple source part of my program.

       

      ArrayList listDimAll = new ArrayList();

      AnnoDimStruct annoDim = new AnnoDimStruct();

      SolidWorks.Interop.sldworks.View swView = (SolidWorks.Interop.sldworks.View)swDraw.GetFirstView()

      while (swView != null)

      {

           SolidWorks.Interop.sldworks.Annotation swAnn1;

           while (swAnn1 != null)

           {

                listDimAll = CustSetCountNote(swAnn1, annoDim, listDimAll, viewNum);

           }

            swAnn1 = swAnn1.GetNext3();

      }

       

      And This is part of CustSetCountNote() method.

      ArrayList CustSetCountNote(Annotation swAnn1, AnnoDimStruct annoDim, ArrayList listDim, int viewNum)

      {

           SolidWorks.Interop.sldworks.Note swNote = (SolidWorks.Interop.sldworks.Note)swAnn1.GetSpecificAnnotation();

           annoDim.postText = swNote.GetText();

           ~~~~

      }

       

      I think this is may bug.

      Please teach me about this phenomenon or solution if you know.