# SolidWorks: Replace Components Without Mate Errors

Let’s take a look at a common problem:  You have an assembly that you’re feverishly working on to meet a deadline.  You look into the Feature Tree and suddenly realize:  you’ve used a wrong component (perhaps a mounting bracket or plate) and need to swap it out for a different part.

Not concerned, you right-click on the wrong component, select Replace Components, and load in the correct part file.  And then it hits you:

Missing Mate References and Rebuild Errors: The bane of your existence

So what really happened here?  The answer can be found by looking at your mate references, and how Solidworks keeps track of them.

Let’s take a look at a simpler example:  Imagine a simple plate with a hole in it.  The plate is 5mm thick, 50mm wide and 65mm long, with a 15mm diameter hole in the center.  The bottom face of the plate is coincident with the Top Plane, while the part is symmetrical about the Front Plane and Right Plane.

In other words: This

If you asked four different engineers to create that plate, you might get four different models all built in slightly different ways.  There are many variables:  which plane was used for the base extrude sketch, how was that profile sketched, what sketch features were used and what order were they put in there, how was the hole added to the part.

Even with such a simple part, four engineers could conceivably come up with four different solutions, all of them geometrically identical, right down to the symmetry and orientation.  There are surprisingly quite a few combinations and permutations that can lead to the same geometric result.  One could subjectively argue over which technique is best, but you could also objectively say that each technique is correct.

So what happens when these different plate part files are built in different ways?  What is SolidWorks doing in the background that can cause a mate error if you replace one plate with another in an assembly?

When you create a part in SolidWorks, the software assigns IDs to your geometry in the background.  These IDs show up as “Face<1>” or “Edge<2>” in your selection box when you use them for a reference for a mate (or for a dimension, or a sketch relation), but in the software, they are saved with very specific ID tags that are controlled by the software, not the user.  Even if you used the same features in your model, something as simple as adding sketch entities in a different order can impact what your surface IDs are on the final part.

When an assembly rebuilds or when you are replacing a component, SolidWorks looks for the IDs referenced in each mate.  If the part was built geometrically identical, but in a way that it has different geometry ID tags, SolidWorks will not be able to find those references.  And that is how we end up with missing mate references and rebuild errors.

This same process also explains dangling references in part files:  if you delete and redraw all of your sketch entities in your base extrude sketch, you will have many dangling references later on in your model.

So why is this happening?  What is the cause of the mate errors and how can we control them?  Let me tell you…

What’s happening here is that in order to rebuild a mate, SolidWorks has to know which faces or edges are being referenced by the mate.  To do that, the software creates IDs for each surface and edge as you build your model.  These IDs are very difficult to control, and can vary by something as simple as adding sketch features in a different order.  If the software cannot find the correct reference (such as when we replace components or delete features that are used for mating), that’s when we get the rebuild error.

We can help prevent this problem using one of the following three techniques:

1. Don’t create replacement components from scratch.  When you need to make a “replacement” component, do a “Save As” or “Save As Copy” of your original component.  Saving a copy of your original file will maintain the original geometry IDs in your new copy.  Careful editing of your new component will allow you to maintain the same IDs on references you want to mate to.  Thus, when you swap the components in assemblies later on, you will avoid the errors.  The challenge is to avoid deleting/re-creating sketch entities or features that are used in your mates.
2. Use Datum Geometry (Planes or Axes… NOT Temporary Axes) for your mates.  When a datum feature is referenced in an assembly mate, SolidWorks does not use geometry IDs to track the reference.  Instead, the name of the datum geometry is used.  So, if your replacement component contains a datum with the same name as a corresponding datum on the original, SolidWorks will use that datum to resolve any mates that referred to it’s counterpart in the original component.  This is why mates that refer to one of your primary datum planes (Front Plane, Right Plane or Top Plane) never fail when you replace components.
3. Use Named Entities.   Personally, this is my favorite technique.  SolidWorks automatically assigns names to surface and edge IDs when you create the model, but you do have a way to manually write in your own reference names:- Right-click on a surface or edge in the graphics window.
– Expand on the menu to find “Face Properties” or “Edge Properties”.
– You will see this dialog box pop up on your screen:

– Whatever you enter in this box will become the name of your surface or edge.

When you replace components that have Named Entities that are referred to in assembly mates (such as a named surface “Hole” that’s used in a concentric mate), SolidWorks will be able to find references and resolve the mates.  The only caveat, just like with datum geometry, is that the Named Entity in the original and the replacment component must both have the same name.

For an example, I’ve prepared an assembly (Plate Assembly.sldasm) with a smaller plate (Plate1.sldprt) mated to a larger plate (Other Plate.sldprt).  Download Plate Assembly.

I’ve also made four different alternative versions of the smaller plate (Plate2.sldprt, Plate3.sldprt, Plate4.sldprt and Plate5.sldprt).  Download Replacement Plates

Since the replacement plates are all created in slightly different ways, despite their geometric similarities, we can see the mate errors that happen when we swap one component for another.

To demonstrate the “Save As” technique, I created Plate5 by doing a Save As of Plate1.  I then deleted and recreated the extruded cut for the hole.  When I try to replace Plate1 with Plate5, you can see that all of my mate references are replaced, except for the concentric mate, which refers to the hole I re-created.

Click on Image for Full-Size Version

For the Datum Plane technique, edit the “Coincident2” mate in the assembly to refer to the “Mating Plane” datum plane in Plate1 instead of the surface on the bottom of the model.  Plate2 has an identical datum plane, and despite the different surface IDs, that coincident mate will be resolved when you swap.

Click on Image for Full-Size Version

The Named Entity technique can be seen when you swap Plate1 for Plate3.  Both of those plates have had their hole surfaces renamed as “Hole”, and you can see in the screen shot below that SolidWorks was able to find both “Hole” faces to resolve the mate.  Not only that, but instead of the reference being referred to as “Face of Plate3”, it is noted as “Hole of Plate3”.

Click on Image for Full-Size Version

Using these techniques should hopefully help to alleviate a LOT of headaches when it comes time to replace components in assemblies.  (DriveWorks users… I’m looking at you…)

***

Dave Mandl is an Applications Engineer at Graphics Systems, a SolidWorks Value Added Reseller with locations across Wisconsin and Illinois. He is a regular contributor to the Graphics Systems’ blog: SolidNotes.com, your source for SolidWorks, Simulation, Data Management, & Product Communication Tips & Tricks.

#### Graphics Systems

Headquartered in Milwaukee, WI with offices in Chicago, IL, Freeport, IL, Madison, WI, and Green Bay, WI, Graphics Systems Corporation is "Your Source for 3D Engineering Capabilities."