“Bad” objects in Rhino are ones that either violate certain NURBs rules, or have a structural problem. In theory, Rhino is not supposed to produce bad objects, but in practice, it is possible and does happen periodically. Once you know how to deal with them, they don’t usually take too much to fix. Most often, the bad objects are surfaces, but bad curves also happen occasionally as well.
The simplest way to find bad objects is to use the command SelBadObjects (Analyze > Diagnostics > Select Bad Objects). All objects considered as invalid will be selected. However, a polysurface may be “bad” because it contains only one bad surface. You can figure out which one by using the command ExtractBadSrf (not in the menus), which will extract the bad surfaces and select them. There is a very useful command in Rhino called CheckNewObjects, which turns on checking in the background and checks all objects as they are created or imported. This way you know immediately when there’s a problem.
Well, there are many technical explanations. With surface objects, often it is the structure of the trim curve that is bad – it can have one or more segments that are microscopic and this causes problems. Other times a surface can be bad because it has either two or more rows of control points on top of each other, or has a zero length in one direction (a “collapsed edge”). This situation is easy to produce in Rhino V3 – make a vertical plane or line and then project it to the Cplane from the Top View. The object now has zero length in one direction and will be considered bad. In Rhino V4, this type of operation has been “disallowed” in certain cases, so that you will not get a bad object, the command will simply fail and you will get an error message. However, it is still possible to produce bad objects in V4.
Why might a surface trim curve be bad? You probably didn’t intentionally make it so. Bad objects often show up after using Join (or some other command that also joins objects, like Booleans). In the process of joining objects, Rhino often needs to split edges and adjust trim curves. In certain situations parts of these split edges can end up being microscopic or the adjustment of the trim curve goes wrong and all of a sudden Bing!! you will have a bad object. (By the way, when I say “microscopic” I mean smaller than your absolute tolerance – objects that are smaller than that generally have no business in your file and will cause problems.)
Importing geometry from other programs can also produce bad objects. If you are running CheckNewObjects, while a file is importing you will get a message if and when an invalid object has been created. You need to click OK to acknowledge each one. If there are many, this can be annoying, you can turn the command off and restart it after the import is done.
It is important to understand that the imported objects were likely not considered “bad” in the originating program. Every program has its own way of creating and checking geometry, and those may not be the same as how Rhino goes about it. On top of that, exchanging data between programs that have different formats requires at least one translation and sometimes two (via a “neutral” format such as IGES), there can translation problems that will cause bad objects, depending on the quality of the import/export functions. Rhino will also produce objects that it does not consider as “bad”, but are flagged as “bad” by other programs.
Why can't I see my bad object?
Occasionally, Rhino produces surfaces that are bad, but you can't see them. Literally, they are invisible! (they are invisible because no render mesh was able to be produced to display them) They are sometimes referred to as “phantom” surfaces. Phantom surfaces can cause files to act oddly, for example a ZoomExtents that doesn't work correctly because the invisible surface is out in space and the Zoom command is taking it into account.
These can usually be selected with SelBadObjects, and the best thing is to simply use Delete to get rid of them - often they can't be fixed. Sometimes, Delete won't work, if that happens, try Ctrl+X to cut them from the file. If you cannot select them in any other way, you can also try this: Zoom extents, window select everything and use Hide. Then try a Ctrl+A. Usually this selects everything in the file, even objects that are unselectable any other way. If you see on the command line that an object is selected, use What to verify that it is indeed your bad object (it will say “invalid”), then just delete it and show all again.
If a polygon mesh object rings up as bad, use CheckMesh to see a more detailed report of what is wrong with it- this command will tell you a good deal about what can be fixed, and you my well find the commands you need among the offerings in the Mesh menu, under mesh Edit tools and mesh repair tools. Some useful commands are:
Bad polycurves are most often fixed by just exploding and re-joining. Otherwise, look for microscopic segments included in the curve and eliminate those. If that still doesn't fix things, it may be that something may really be wrong with the NURBs knot structure of the curve, and will require more advanced investigation and/or reconstruction.
My strategy for dealing with bad surfaces due to trim curves is as follows - before starting, determine which are the bad surfaces and hide everything else temporarily (you may need to run ExtractBadSrf as above).
1. First I usually run the command RebuildEdges on all bad objects. This may fix some. It more or less restores the edges of a surface to the state they were before joining. However it also means that the surface might no longer join up to its neighbors, or that joining might make it go bad again. But it does work OK in some cases. If some surfaces are fixed (use SelBadObjects/Invert), hide those. Sometimes running ShrinkSrf on bad surfaces also helps.
2. Use the Untrim command with the “keep trim objects” option selected (otherwise known as DetachTrim) on the first bad surface, then, while the trim curve is still selected, use Trim to re-trim the surface. Check to see if this has fixed the surface. If so, good, hide it, if not, leave it and run the same procedure on all other bad surfaces one at a time. Hide all that go good.
3. If any bad objects are left, run DetachTrim on them again. Explode the resulting trim curve and look for micro segments in the curve somewhere. This is the most common case of bad trims. Look at how many component curves the trim curve has. Often there will be a suspicious number, i.e. what looks like it should be a rectangle says 5 curves not 4. Somewhere in there is a micro curve that is messing things up. Often it's near a corner, try window selecting near the ends of your trim curve segments. Or, use the command SelShortCrv and set a small value. If you find some microsegments, delete them and rejoin the trim curves into a closed loop. Re-trim the surface with it. This usually fixes pretty much everything that isn’t fixed by other methods.
4. Last, try unhiding everything (Show), and see if you can join all up without having objects go bad again. If all joins up well and no bad objects, great! If not, then it’s generally because Join is trying to force things together that don’t fit correctly. In that case you’re going to have to analyze the surfaces that are going bad and the relation with their neighbors to try and find out what doesn’t fit and why. This can sometimes take some pretty close looking and head scratching…
Note: The above methodology is for dealing with surfaces with bad trim curves. It won’t help surfaces with collapsed edges or stacked rows of control points. Those need to be dealt with by other methods such as knot removal or just plain reconstruction. Surfaces with collapsed edges are easy to spot – the display looks like a curve, but in Properties it says it’s a surface. In general just delete these.