3 Replies Latest reply on Jan 17, 2017 7:02 PM by テ ソ ン キ ム

    Can i get original text from linkedtext?

    テ ソ ン キ ム

      Hi all.

      I have a problem.

       

      The label's text which created with section view was text in Solidworks2013.

       

      That is example.

      If i make Section View in Solidworks2013, That "C-C" was set text.

      But in Solidworks2015, C-C was set LinkedText.

       

      So, This is my problem.

      I have a program, it get label's text from draw then attach number to text.

      And, To attach number have many condition. For instance don't attach number if label's text is "B-B"

      But, I couldn't get text from linkedtext with solidworks api.

       

      I used this Api methods.

      "SolidWorks.Interop.sldworks.Note.GetText()"

      But GetText() never get text from linkedtext.

      So i tried to use "SolidWorks.Interop.sldworks.Note.PropertyLinkedText"

      But that also couldn't get original text value, just could get like "<VLNAME><VLLABEL>"

       

      I have an idea, I want you to go over this.

       

      If i check that, text is been not linked text but text.

      I want to know that changing default setting is possible.

       

      Please teach me If you have any idea about this problem.

      I want to hear all idea Not only changing setting but also solution with program if you know.

       

      Thank you.

        • Re: Can i get original text from linkedtext?
          Amen Allah Jlili

          Can you someone explain this to me? I can barely understand the question.

          • Re: Can i get original text from linkedtext?
            Nilesh Patel

            Hi,

             

            If you are only dealing with Section Views then, get IDrSection Interface using 'IView.Type = swDrawingSectionView'. Then get the label text using IDrSection.GetLabel method. (e.g. for Section B-B, it will return 'B'). Then check you conditions and attach number.

             

            If you want update text of the label below the view and the arrow then you can use IDrSection.SetLabel2 method. But if you only want to update the text of the label below the view then use INote.PropertyLinkedText method and add your number to the text.

             

            Have a look at the following example for 'IDrSection.SetLabel2 ': Create Section View and Get Some Data Example (VBA)

             

            Hope this helps.

             

            Regards,

            • Re: Can i get original text from linkedtext?
              テ ソ ン キ ム

              Hi.

              Sorry to check comment was late.

               

              I solved this how to use" DisplayData.DisplayText" like this.

               

              Annotation swAnn1;

              ~~skip to explain about creating instance of Annotation~~

              DisplayData swDispData = (SolidWorks.Interop.sldworks.DisplayData)swAnn1.GetDisplayData();

              String displayText = "";

              for (int index = 0; index <= swDispData.GetTextCount() - 1; index++)

              {

                    if (index >= 1)

                   {

                          displayText = displayText + "\r\n";

                   }

                   displayText = displayText + swDispData.GetTextAtIndex(index);

              }

               

              If we have a lable like this, and want to get "A-A".

              we never can get text with Note.GetText();

              Also, If we use Note.PropertyLinkedText that is return just <VLANME><VLLABE>

               

              So, I have used Annotation.GetDiplayData() finally i could get "A-A".

               

              And, Thanks Amen Allah Jlili, Nilesh Patel  for your kindness.

               

              Thank you.