5 Replies Latest reply on Jan 31, 2017 6:29 PM by N. Ritchey

    manually overriding assembly references

    N. Ritchey

      is there a way to manually change an assembly part file reference? for context, here's what happened:


      joining a new project, the only model data we have is conceptual from the design phase.


      now we are assigning part numbers and organizing our data. so i used the solidworks shell extension to rename files (right click in windows > solidworks > rename... this launches a SW applet that will change the filename and correct references)


      i used this to rename all the files to use their part numbers as their file names.


      UNFORTUNATELY, i accidentally renamed one of the files omitting the "." between the P/N and "SLDASM". resulting in one file being named NNNNSLDASM (no windows file extension)


      this seems to have confused the top level assembly. when it searches for the document, it's looking for a DRAWING (.SLDDRW) and not an assembly. if i manually point to the assembly file, it tells me the file is "invalid or incompatible"


      the icon in the assembly is different as well. instead of a typical part of assembly icon (the tetris block), it's a small capital L.


      this tells me that i messed something up when i accidentally replaced the reference for a .SLDASM part to one with no extension.


      NOW when i open the top level assembly i'm prompted to locate the file. again, it wants me to find a SLDDRW file and won't accept the SLDASM. whenever i try to run the Replace Component command solidworks instantly crashes.


      i've used the SolidWorks shell extension to try and rename this file back to its "NNNNSLDASM" (no extension). curiously enough, when i run the SW shell renamer, it no longer sees the association with the top level assembly like it used to.


      my references are screwed up. is there any way i can manually override this reference without using the Replace Component command? i'm trying to avoid re-mating dozens of parts and subassemblies.


      i tried examining the files in SW Explorer. the problem subassembly (NNNNNSLDASM no extension) shows no association in the "where used?" inquiry. the top level assembly lists "NNNNNSLDASM (no extension)" as a referenced part. the icon is that of an image file. when i right click on this link the options for "move" and "rename" and "replace" are grayed out.


      it really also doesn't help that this is the first subassembly in the top level assembly. it serves as a grounding mate for every other component and subassembly.






      in the open dialog you can click on "References..." to manually view and update references. here, solidworks is telling me that i cannot replace the file with one of a different type (parts to assemblies, assemblies to drawings, etc.) but solidworks already changed that automatically and now won't let me change it back.

        • Re: manually overriding assembly references
          Rick McDonald

          Do you have the original files before you started to change names and associations?

          Before doing any changes of this type I would always have backups of all the information before you start.


          I would backup - or save what you have now - copying it to another location (different disk drive) - with SWX CLOSED.  Just to have a backup of where you are not so you can at least get back to this point if something gets worse.


          I have not tried any of the things I am about to suggest so they may not work:

          First, close the SolidWorks application.

          Try to rename the file that was named wrong using Windows Explorer.

          It should allow you to rename the file back to what it used to be.

          This should at least get it back so it sees it as a SolidWorks file.

          Then start SWX and try to open the assembly again.


          If you are lucky it will say it can't find the correct file and let you point to it. Then see if you can re-associate it and then rename it as your were doing.

            • Re: manually overriding assembly references
              Tom Gagnon

              That's about what I was going to suggest also.

              I'd suggest copying that file to a new location, renaming it (not in SWx Explorer) to include extension, and then copying the renamed file back to the original location. There should be both copies present there, the new correct one and the extension-less wrong one.


              Note when doing this in Windows, you need to be able to see and edit the file extension, which is by default turned off since either Vista or Windows 7. You toggle this option through Windows Explorer (in Windows 7 UI context here) by:

              Tools (ALT+T) > Folder options > View tab > Deselect [_] Hide extensions for known file types


              Once you have the correctly named assembly file back where it should be, you should be able to perform a Replace Component command to select the new fixed component. It has not changed at all, or should not have, so therefore FrontPlane is still FrontPlane, Long_Axis2 is still Long_Axis2, D5@Sketch3 is still D5@Sketch3, and Face1872 is still Face1872. What this means is your component will replace all its mates automatically without re-choosing or redefining, because it finds exactly what it seeks exactly as and where it should be. It's replacing a thing with the same thing.


              What I can't wrap my head around at all, and have no ideas how to fix, is that it's asking for a SLDDRW file when it originally had a SLDASM file. I'm hoping that Replace Component will be useful for you as applied properly. I use it commonly enough that it's been added to my Assembly ribbon tab, along with Copy with Mates.

            • Re: manually overriding assembly references
              Vladimir Urazhdin

              If the link to part in assembly is non repairable, the only reliable (and painful too) way to fix assembly may be:

              1. Delete suppressed part and all mates, break all references.

              2. Rename part.

              3. Insert part w/new name.

              4. Rebuild links and references.

              • Re: manually overriding assembly references
                N. Ritchey

                sorry for late reply but thanks for the responses. i actually spoke to our SW vendor's tech support line and it was something they had never seen before either so i found that kind of interesting.


                here's the weird thing about it --- due to my fat fingers solidworks renamed the file "PART." no extension. under windows, it's IMPOSSIBLE to name a file ending with a ".", windows simply removes the ".". thus there was no way to name a file in windows that SW would recognize.


                fun times. oh and yes i backed everything up beforehand. eventually i just did the entire rename process over again and didn't mess it up this time