6 Replies Latest reply on Mar 28, 2016 11:08 PM by Artem Taturevych

    Rename assembly virtual componets outside of solidworks

    Jordan Wigley

      In Solidworks 2008, names of virtual components are not managed after the initial part is created. When new assemblies were created in 2008 by saving one assembly out as a new one, the numbers after the carat would not be updated to match the new assembly so you may end up with some virtual components having a name reflecting the part number of an old assembly used as a reference to create the new assembly. This can create situations where you may have two or more different parts with a prefix of “Part2”, but they are still individual parts because the six digit number after the carat creates uniquely identifiable names for each part.


      picture one.png


      In Solidworks 2014, the second half of the virtual component part names are now managed by Solidworks to keep them synced with the name of the assembly that contains the virtual components. This attempts to avoid conflicts when you open more than one assembly which contain different parts with similar names. However, when we open files such as the one shown above, the parts with identical prefixes now conflict with one another and cause all sorts of chaos because Solidworks has changed the second half of the name producing parts with duplicate names and different geometry.



      picture 2.png


      If we open the assembly in Solidworks 2008 prior to opening it in 2014, we can rename the parts so they all maintain their unique identities and then they will open correctly in Solidworks 2014 without conflicts.


      picture 3.png


      Normally I would just have everyone open the assemblies in 2008, and then run a macro to rename all virtual components to part1, part2, part3 and so on, then open them in 2014. The problem is that we don't want to keep 2008 on peoples computers if it can be helped. We want to avoid people accidentally opening a file in the wrong version of Solidworks and causing compatibility issues. For this reason i have been tasked with trying to fix this issue outside of Solidworks. My first instinct was to use the Document Manager API, but it doesn't allow you to rename virtual components form what i can tell. Since Assemblies are actually zip files, it was suggested to me that it might be possible to access the virtual components by unzipping them, changing the name, and then re-zipping, similar to as shown below.

      picture 4.png


      My problem is i am not sure how to unzip and then re-zip a SLDASM file using a standalone program created in vb or c#, or even if it is possible. If anyone has anyone suggestions on how to do this i would be happy to know, otherwise we might just have to settle with keeping 2008 on select peoples computers. It wouldn't be the end of the world, but a different solution would be preferable.

        • Re: Rename assembly virtual componets outside of solidworks
          Artem Taturevych

          Hi Jordan,


          That's definitely a tricky situation. Are you still planning to use SolidWorks 2008 or you just keeping it for the cases when it is required to fix the described issue? I'm asking because you may probably like to upgrade your legacy files with a macro which will traverse all assemblies and rename all virtual components using SolidWorks API so you do not need to worry about this anymore.


          You are right that you cannot do this via Document Manager. Unzipping and renaming the storage as you mentioned will most likely corrupt the files. The store name should be linked somewhere in the document so just renaming it will break the link. Please also note that SolidWorks has changed the storage type so you cannot unzip your SolidWorks files in version 2015 and newer like you can with older versions.


          Based on the above I would probably suggest you to have a macro which will open all assemblies in the specified folder in SolidWorks 2008 and rename the virtual components following some scheme (like part1, part2, part3). Exactly what you are doing now manually but with one click and potentially you can upgrade all your documents in one go and not use SW 2008 anymore. Please let me know if this may work for you. I might have a ready solution for this.