0 Replies Latest reply on May 23, 2016 10:38 AM by Samantha Szkirpan

    change feature name using selectedfeatureproperties method

    Samantha Szkirpan

      Hello,

      I'm using a VBA macro to change the name of linear pattern features in Solidworks

      when using the selectedfeatureproperties command, I'm running into an issue. The command will execute properly when given an exact string value for the name, but will not execute properly when given a predetermined variable for the name. Examples being:

      boolstatus = part.selectedfeatureproperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "Jingles")

      WILL rename the selected pattern to Jingles, but

       

      Dim PartName as string

      PartName = "Jingles"

       

      boolstatus = part.selectedfeatureproperties(0, 0, 0, 0, 0, 0, 0, 1, 0, PartName)

      WILL NOT rename the selected pattern at all, and after the variable PartName has been declared

       

      boolstatus = part.selectedfeatureproperties(0, 0, 0, 0, 0, 0, 0, 1, 0, " " & PartName)

      WILL rename the selected pattern to  Jingles(with the added space in front of the word), but

       

      boolstatus = part.selectedfeatureproperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "" & PartName)

      WILL NOT rename the selected pattern at all

       

      To an extent the added space in front of the part name won't matter at first, but it may become a problem later when others are using this assembly file to search for parts which is why I would prefer to find a way to rename the pattern without needing that extra space.

      Any help would be great, thanks.