SolidWorks assembly mates are a powerful 3D design capability, but they are often take for granted. Designers expect them to work every time, all the time, even when mating information isn’t 100% clear to the software. If you’re using SolidWorks assembly mates in a design automation scenario, and you’re experiencing some frustration with SolidWorks’ behavior, read on.
Having DriveWorks, or your own custom code, generate new versions of your solid models provides the ultimate freedom and flexibility in design automation. But there are times when you may not have control over your parts because they’re purchased, or when significant benefits can be achieved by reusing existing components. In these cases, you can replace components within an assembly, letting your implementation select the correct design, rather than recreating it.
The most challenging part of replacing components within SolidWorks (yes, it’s a SolidWorks issue, not an issue with your automation) involves resolving mates between two different components. If SolidWorks cannot find corresponding faces, edges, or reference geometry in the new component, your mates will dangle and your assembly will not only show errors, but the assembly will most likely not be put together properly. Even if SolidWorks is able to find corresponding entities, the possibility exists that differing geometries or alignment conditions (i.e. aligned or anti-aligned) can cause your assembly to go into an undesirable state (whether that means just becoming overdefined, or being assembled incorrectly).
Replacement components come in two main varieties, those you can modify, and those you can’t touch. Models may be “untouchable” for a number of reasons: they may part of an existing library and changing them could break other assemblies, they may belong to SolidWorks Toolbox, or they may have been provided by a third party who prevents you from changing them. In many cases though, you can change these files. Even if there are a considerable number of them, it may be quite worthwhile to do this.
The easiest replacement involves two identical components, or at least two components whose mating references are identical. This is perfectly achievable and easy to do if you take one of two shortcuts. First, you could use your default datum planes and/or origin to create your mating conditions. Since every SolidWorks model has these identical features, this means that you are guaranteed to have your references update every time. The other bulletproof method is to create a start part that has all of the mating references, then do FILE, SAVE AS and add your more specific geometry to get all of the replacement components. In this case as well, since all models start from the same place, they are guaranteed to have identical references.
Another technique is to introduce a new assembly level and create a series of subassemblies with your replacement parts assembled into them. This way, you can mate the subassembly into your top-level assembly using reference geometry as described above, then insert your replacement part into that subassembly so that you can locate and orient your part appropriately with respect to those references. To clarify, you would have a new subassembly for each replacement part. So if you have trouble replacing part bracket.sldprt with parts 1234.sldprt and 6789.sldprt, then you would create bracket.sldasm and replace it with 1234.sldasm or 6789.sldasm.
Right about now you might be thinking, “If this guy knew SolidWorks, he would know that you can just use matching names on the referenced geometry to get mates to reattach properly.” Absolutely, and that does work…sometimes. By all means, try it. If it works for you, great. But make sure that you test every combination first. We’ve had multiple projects in the recent past where that method just didn’t work. With 20 years of SolidWorks experience under our belt, we can’t explain why it doesn’t follow the theory – so we just chalk it up to gremlins and move on.
So if you need bulletproof replacements, you need to guarantee that the mating references are identical. And that means that you use the same features, not just features which are defined or named the same. This could be default datum planes or geometry that is created and passed down with a FILE, SAVE AS. But the most important thing is to test as many combinations as possible. Oh, and as always, saving frequently and backing up are incredibly important as well.
If you have more questions, or want us to have a look at your technique for swapping components in design automation, please contact us. We haven’t met a problem yet in design automation that we couldn’t tackle, or at least offer an opinion on.