Monday, May 05, 2008

STS #1 - Why Curve Trimming Sucks

The first area where I am really going to need a convincing argument is in sketching. My opinion is this: Trimming sketch curves sucks big, fat, hairy, donkey balls. It is a woefully outdated, old-school 2D drafting paradigm, and I'm truly shocked it still exists in modern CAD programs.


What is curve trimming? Well, to illustrate it best, I'm going to use an example of bad technique. Let's say you're a sloppy designer, and when you intend to extrude a rectangular shape into a block, you draw it like this:

No, I'm not playing tic-tac-toe. What I have is a basic shape; clearly there is a rectangle in the middle of that mess. It's the dangling lines that extend beyond the rectangle that are the problem. Most CAD programs really don't want them to be there. So you have to remove them by any number of means, but the general term (and often command name) is trim. I'll trim a couple lines to give an example:

So gradually we clear away everything that isn't a rectangle, and then proceed to the extrude command.


Aside from hyper-anal-retentive types, I don't think anybody actually wants or likes to trim curves. It is done because the CAD programs don't know how to handle the dangling lines, or multiple sketch regions. So a software limitation gets pushed back on the user to work around. That's about as much of a "pro" as I can think of on this topic.

Reasons not to trim are many. For one thing, trimming takes time. In the previous example, trim is used mostly just to clean up the sketch. However, with more complicated shapes, trimming is just a speed bump along the way from your sketch to your extrude. We all want faster, faster, faster, and they advertise faster, faster, faster; but trimming is a washboarded gravel stretch on the otherwise nicely paved highway.

Not to mention that trimming actually causes problems. You remove very important design intent from your sketch when you trim. Consider this example:

Triangle and a circle, nothing fancy. And for anyone reading that isn't familiar with SolidWorks, black lines indicate fully constrained. There is some design intent here: the midpoint of the hypotenuse is on the origin, and the circle is on the midpoint of the line. But I can't extrude this shape as is, because it has overlapping regions. So I must trim:

Now I will grant that if trimming must be done, SW's power trim tool is pretty cool. But it still blows. Note what happened. Blue lines indicate that they are not fully constrained anymore. So it turns out I was mistaken: the circle was actually attached to the origin and not the line. Otherwise, the entire triangle has lost design intent information. So now in order to make the software happy, I have to change my mind about the design intent, and do additional work to repair the sketch.

To summarize, I had to spend additional effort to trim the curves, and then I had to spend even more time repairing the damage to my design intent. Awesome!


The I-DEAS developers came up with an alternative to trimming a very long time ago. SW developed their own alternative more recently. Let's take a quick look at I-DEAS, then look at what SW has to offer.

I-DEAS doesn't care what you do with the sketch curves. The literal curves themselves are not what gets passed on to the extrude command. Instead, you create an entity called a section that basically is an overlay on top of the sketches. It is the section that gets passed on to the extrude command. So out of your mess of curves, you choose the ones you want, and proceed. Here's an example:

In this case, it was just as handy for me to draw a rectangle, then add a diagonal line, but that's not really important. The point is I have extra sketch geometry. No problem, I pick the ones I want to use to define the section, and then extrude the section. No design intent was harmed in the making of this example. Oh, and because nothing has been lost, I can go back and reroute the section if I change my mind:

Now let's take a look at the SolidWorks alternative, called Contour Select. I don't know how long it has existed in the software, but I gather it is relatively new. It is automatically invoked whenever a "make solid" command (extrude, revolve, etc.) is attempted against a sketch that either has dangling lines, or involves multiple overlapping regions. You are prompted to pick a "contour":

You can pick as many as you want. I have three possible regions here. I could pick all three, any two, or any one. I'll pick them all:

At this point, I-DEAS and SolidWorks are roughly equivalent. I'm picking curves to define a section in I-DEAS, I'm picking regions to define the extrude in SolidWorks. Same sketch in either case. I might even give a slight edge to SW, because it will accomplish in a single extrude operation some shapes that would require multiple extrudes in I-DEAS to avoid self-intersecting sections. So, thus armed with knowledge, let's try some real parts.

Here's an extrusion I designed a few years ago, and what the sketch looks like in I-DEAS:

Roughly 36 clicks are required to define the section. If I was going for a record, I could change the sketch up a bit to reduce the number of intersections, but for the most part, it's just fine. Now let's try it in SolidWorks, same sketch, using Contour Select.

28 regions here, so 28 clicks. From a purely number of clicks standpoint, edge to SolidWorks. From a usability standpoint, I'm going to call it wash. The feedback that I-DEAS provides during section creation is pretty useful, while SolidWorks has nothing to go on, so it provides no help at all. I also felt like I was panning and zooming a lot more in SW.

But then things got interesting. I noticed that SW took forever to generate the actual extrusion. This caught my attention primarily because from what I've seen, for the most part, SW is pretty darned quick. I'm also running on spiffy new hardware, so I have high expectations.

Then I remembered that SolidWorks has some nifty diagnostic tools, in this case Feature Statistics. Let's take a look:

Playing a hunch, I decided to copy this part and trim everything. This of course defeated much of my design intent, but that's already been established. After trimming, I changed the extrude inputs so that it was no longer using contours, just using the sketch as-is. The results are quite interesting:

I think it is safe to say that the code handling Contour Select needs some optimization. We go from an extrude time of 0.02 seconds to a snoring 7.33 seconds. I might be a little off on the math, but that looks to me like ~36000% slower. And that's not just the initial creation, mind you. If you want to edit the feature, you are again met with a several-second delay waiting for the options to appear. Ridiculous.

I-DEAS doesn't have the handy diagnostics, but it appears to require roughly 1 second to generate the extrusion, and/or display the feature parameters form.


Or maybe conundrum, because I'm not sure exactly what to conclude. SolidWorks is letting me pick between a practice that I already loathe and know causes problems, or one with suck-ass performance. Awesome. And this is primarily talking about forward creation. I'm already reasonably confident that the I-DEAS approach provides some significant advantages when it comes time to do some modifications down the road, but I'll save that topic for a later date.

So do I grin and bear, er, trim it, or do I try to incorporate I-DEAS-ness and get stuck with the longer wait? I don't really like either option.

No comments: