AnsweredAssumed Answered

Rename assembly virtual componets outside of solidworks

Question asked by Jordan Wigley on Feb 1, 2016
Latest reply on Mar 28, 2016 by Artem Taturevych

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.