Tutorials: CAD Clean-up

Often the most time consuming step in the unstructured grid generation process is geometry clean-up.  A lot of times, the geometry to be modeled was originally built in another CAD system and read into SolidMesh from an IGES file.  Usually, when the geometry was not constructed in SolidMesh (and sometimes when it is if care was not taken during construction), CAD clean-up is required before a grid can be generated.  This tutorial is intended to illustrate a few techniques used to clean up a CAD file.  It should be noted that any geometry problem could be fixed any number of ways depending on the situation.  Also,  since CAD clean-up changes the geometry, some techniques may not be appropriate where retaining the original geometry is crucial.  The end result is to obtain a topologically valid (water tight) model free of any holes, overlaps, surface mismatches, ...  Geometry problems covered in this tutorial include: nonintersecting surfaces, overlapping surfaces, badly parameterized surfaces, and surfaces that don't meet at a single point.  Selecting and adjusting the glue tolerance is included as well.  Also, techniques using group activation and deactivation when dealing with surfaces will also be illustrated.  Start by downloading the IGES file: flying_minnow.igs.gz. REMINDER:  This tutorial is rather long.  It is a good idea to save periodically.  Also, if you do have to stop and later read in an intermediate model, when you restart, read the file in with no gluing (-ng).

1.  Read flying_minnow.igs.gz into SolidMesh  (shown with surfaces shaded) with trimming and gluing enabled (see fileio_button for help).   The surfaces of the model will initially be drawn as wireframe.  The surfaces shown to the right are drawn as shaded.  Throughout the tutorial the pictures may switch between either for viewing clarity.

minnow1

2.  To start, hit check to find problem areas. check will highlight problems by selecting every curve that is not adjacent to exactly two surfaces.  Some of these can be fixed by creating trimmed surfaces but others will require a little more work.  Clear the pick list by hitting "Esc".

minnow2

3.  The first clean-up step is to decide if the glue tolerance can be raised to allow gluing of more of the curves.  Determination of the glue tolerance is an ongoing process.  Basically, you want to keep it as small as reasonably possible.  Find the smallest feature to be retained and/or try to estimate what the smallest spacing applied to the surface grid will be and make sure the tolerance doesn't go above about an order of magnitude smaller.  For this case, the propeller will probably require the tightest spacings.  To estimate the spacing that will be required, select the points shown and inquire.  The message window reports the distance between the two points is 0.867665.  A good estimate of the spacing required is around 0.03 or 0.04.  This means the glue tolerance shouldn't exceed about 0.004.  This is just a ballpark maximum for reference.  Don't actually change the glue tolerance right now. NOTE:  The point spacing required is dependent on the geometry and coming up with good estimates of point spacing and/or glue tolerance comes with practice/experience.

minnow3

4.  Hit "esc" to clear the pick list and check again.  You can see most of the problems with the topology are around the prop.  Clear the pick list.  Select the two curves (a derived curve from each surface) shown (select twice in the location of the curve shown in red) and glue.  The message window reports: Max Internal dist = 2.98372e-05
Max Vertex dist = 0 Since this is much smaller than the ballpark max from step 3, the glue tolerance can be raised to include gluing these curves.  A good new tolerance would be one slightly larger than the Max Internal dist above.  Set the cleanup1 (you have to hit enter in the tolerance field after you change the tolerance) as shown and glue (when gluing with nothing selected, all visible curves and vertices are glued at the specified tolerance).  RULE OF THUMB:  If you manually glue two curves and the Max Vertex dist is relatively large (not 0 or close given the model scale), you may not have selected the intended curves, or there may exist a more significant problem.

minnow4

5. check again.  You can see most of the prop curves got glued, but there are still a few problems. 

minnow5

6.  Hit "esc" to clear the pick list.  Like step 3, select the curves shown (again, you will have to pick twice in the same place to get both curves) and glue.  Check the message window: Max Internal dist = 5.25802e-05
Max Vertex dist = 0 Since the Max Internal dist is still much smaller than the estimated max, increase the glue tolerance to 8e-4. glue and check.  You can see this cleared up most of the problems with the prop.  Hit "esc" to clear the pick list.

minnow6

7.  Most of the other problems will require trimming or CAD work, so start with the Mouth.  Select every group but Mouth and groupdeactivate.  This deactivates or removes all the other objects from the on and off scenes and allows work to be done more easily on just the Mouth surfaces. check to see the problem areas, then clear the pick list.

minnow7

8.  Starting with the top cross shaped curves, select the point shown and cor to make this point the new center of rotation.

minnow8

9. Zooming, you can see two of the surfaces overlap and two have a large gap that can't simply be glued.  To repair the surfaces, the original geometry will be changed slightly.  Care must be taken to make the impact as small as possible. Select the four surfaces affected and turn them off and togg.

minnow9

10. Inspection of the surface wireframe reveals some questionable surface parameterization, identified by the skewed wireframe.  Since the surfaces in question are mostly planar with little to no internal curvature, a single carpeted surface can be created to close the gap and eliminate the overlap.  Select all four surfaces and topores to increase the display resolution for a better projection. 

NOTE:  Carpeting is not the only way to fix this problem. You could try splitting the surfaces up, getting rid of the extra, and unioning them back together, but this will not solve the parameterization problem.  Experimentation is the best way to learn clean-up techniques.

minnow10

11.  Select the two curves shown and union.  This will create a physical (yellow) curve. 

minnow12

12.  Zoom on the lower, outside corner of one of the rectangular surfaces.  You can see another gap here. A decision must now be made about which curve to keep. The curve which best represents the shape of the geometry should be kept.  This requires a judgment call.  For this example, the straight curve will be discarded. 

minnow11

13. A curve like the one created in step 11 needs to be created between the rectangular surfaces and the triangular surfaces.  Because of the overlap seen in step 9, the curves can not simply be unioned as in step 11.  For now, select the two triangular surfaces and turn them off.  Zoom in on the same area as in step 9.  Select the curve and point shown and split.  It doesn't really matter which curve or point is selected as long as the result is similar to the picture at the right.  Basically, you want to create two curves that meet at a single point by splitting off the end of one of the curves at the appropriate point.

minnow13

14. Hit "r" to change the Pick Limit to Parametric and select the small curve between the two points.  You may have difficulty picking while zoomed in real tight.  You may have to adjust the clipping plane using the "page-down" and "page-up" buttons to move it back or forward. delete the selected curve.

minnow14

15. Keeping the Pick Limit set to Parametric, select the remaining portion of the curve split in step 13.  Hit "c" and select the bounding curve of the other surfaces as shown.  The curves should meet at the point used to split in step 13. Click union.  Now you should have two yellow (physical) curves running the length of the long sides of the surfaces.

minnow15

16.  Select the curves shown using the pick limit set to "physical" while picking the long curves and "curve" while picking the short sides. 

minnow16

17.  Select the surfaces so the new carpet will be projected onto the old surfaces. Change the Long Res field to 35 and the Short Res field to 21 and carpet.  A new surface is created using 35X21 control points and projected onto the old ones.  This fixes the overlap problem and the parameterization problem. 

minnow17

18.  Select the old surfaces and the curves created in steps 13 and 15 (the physical curves) and delete.  Also, togg, select the triangular surfaces shown.  Click off and togg.

minnow18

19.  Zooming on the corner of the rectangular surface where it meets the triangular surface,  you can see there is still a gap between the new surface and the triangular surfaces.  In cases like this, it is helpful to know how the surfaces to be repaired were generated to know if there is internal curvature in the surface that needs to be retained.  In this case, the triangular surfaces were created using degentfi so there is no internal curvature.  Inspection of the surface also indicates this is true.  So, the surfaces can be repaired by creating a new TFI surface.  If you don't know how a surface or group of surfaces was generated, you just have to do your best to determine which features are most important and which can be "approximated."

minnow19

20.  Select the three curves  and point shown.  Be careful when selecting the curve between the two surfaces not to select one of the shorter curves that runs only halfway across the bottom of the rectangular surface. The curve across from the selected point is the bounding curve from the new surface created in step 17.  Click degentfi to create the new surface.

minnow20

21.  Select the green surfaces and  delete.  Then, select the two remaining surfaces (the two new surfaces), click the Mouth group name and groupadd

minnow21

22.  If you remember, the edge shown picked meets two surfaces (that are turned off).  The rectangular surface will have to be trimmed so select it and extract.  Select the curve shown. Remember to use pick limit set to "param" (hit "r") when picking to ensure the correct curve is picked.

minnow22

23.  Click togg , and select the point shown.  The curve picked in the previous step remains picked and visible when you toggle.  Click split and togg again.

minnow23

24.  Select the rectangular surface and trim (surfaces shown as wireframe surfaces). 

minnow25

25.  Click onglue then check to see if the problem was fixed.  As you can see, the overlapping and gap problems are gone because the surfaces have been replaced, but creating the carpet has caused new problems with the surfaces above it.  This is because the value used in step 17 when creating the carpet was too small to resolve the edge enough so that it would glue to the surfaces above it with the current tolerance.  Increase the glue tolerance to 0.0035 andglue then check. Another way to fix this problem, if the tolerance could not be increased, would be to rebuild the indicated surfaces, or if the indicated surfaces had internal curvature and could not be easily rebuilt, you could try returning to step 17 and using a value larger than 35 when carpeting.   Hit "esc" to clear the pick list. 

minnow24

26.  Select the surfaces opposite those repaired.  These surfaces are simply a mirror of the ones just repaired, so there is no need to repeat steps 9 through 26. delete the selected surfaces.

minnow27

27.  Select the cleaned-up surfaces shown.  Define the plane to be mirrored about by changing the values in the VX, VY, and VZ fields to cleanup2.  No point needs to be selected since the mirror is about the origin (the default).  Click mirror (in the Util panel).  This should replace the surfaces you just deleted with the ones you just repaired. glue then check to see any problems.  The only curves selected are on the boundary.  We will need the adjacent surfaces to determine if there is a problem there.

minnow28

28.  Select the Body and RightWing groups and groupactivate.  You can see the problems on the boundary of the Mouth are because some of the Body surfaces need to be trimmed.  The Mouth is finished for now, so select the Mouth group and groupdeactivate. Select the RightWing group and the Body surface shown and increase the display resolution to 41x41. This is needed to get a good intersection of the wing and body. 

minnow26

29.  We now need to trim the Body surface to remove the portion inside the RightWing and make it connect properly to its neighbors.  Select the Body surface shown above and just the RightWing surfaces that intersect the Body surface.  The surfaces should be picked in that order (Body surface first, then RightWing surfaces) so that the intersection is done properly.  Click inter.  This creates curves at the intersection of the body and wing which will be used for trimming.  For now, click the RightWing group and groupdeactivate.  Also, click the Prop and Mouth groups and groupactivate

minnow29

30.  Select the surface shown (the one you just did the intersection with) and click off and togg.

minnow30

31.  Re-select the surface and extract.  Select the curve shown (the longer of the two short sides) and togg.  Be sure when selecting the curve to have the pick limit set to "Param" so you get the correct curve.

minnow31

32.  Select the point shown and split and togg.

minnow32

33.  Select the curve shown (opposite the one just split) and togg. Again, use "Parametric" when picking.

minnow33

34.  Select the point shown,split and togg.

minnow34

35.  Select the surface and trim.  This redefines the surface using two trimming loops of parametric curves, one on the interior created by intersecting with the RightWing and one at the boundary created by extracting the bounding curves and splitting.  The bounding curves were split in steps 32 and 34 so that once glued the surface to the right will be adjacent to it's neighbors, assuming the resulting segments are within tolerance.

minnow35

36.  Clickon and select the surface shown (the surface picked is untrimmed, you can tell by looking at the wireframe, also, it's the one on the side with the surface just trimmed in the previous step).  Turn it off and togg.

minnow36

37. repick  and extract.  Then, select the curve shown (the shortest of the short side) and togg.  Be sure to set the pick limit to "Parametric" before picking.

minnow37

38.  Select the point shown, split and togg.

minnow38

39.  Using "Param", select the curve shown and togg. (The picked curve is the one neighboring the Mouth as seen in the next step).

minnow39

40.  Select the point shown, split and togg. Select the surface and trim.

minnow40

41.  Click on, select the surface shown (the one beside the surface trimmed in the previous step), and extract

minnow41

42.  Hit "r" and select the curve shown.  Be sure to position the cursor over the curve to the right of the point shown picked.  This will ensure the correct curve is picked.  You can know the parametric being picked is the one extracted in the previous step because no others lie under the selected curve (if you have been following along, keeping your geometry clean).  There should have been no other green curves to the right of the selected point before you extracted those from the surface in step 41. Keeping a clean geometry is key to knowing what you have picked.  Select the point shown andsplit.  Select the same surface as in step 41 and trim.  NOTE:  The last two surfaces were trimmed so that their boundaries will meet their neighbors' boundaries properly and be adjacent when glued.

minnow42

43.  Moving to the wings, click the Prop, Mouth, and Body groups and groupdeactivate.  Click the RightWing group and groupactivate.  As you can see, the portion left of the curves created in step 28 needs to be trimmed off, select the surface shown and extract.  It doesn't really matter which surface you pick as long as it's one of the 8 surfaces running from the body to the wing tip.  The procedure for one is the same as for the others.

minnow43

44.  Select the curve (using Parametric) and point shown and split.  Repeat for the curve on the opposite side of the same surface.

minnow44

45.  Select the parametrics shown (using Parametric) and  delete.  Then select the surface and trim.  Select the surface you just trimmed and click off then child.  The Child button removes the children of surfaces that are not visible and turns on children of surfaces that are visible.  This helps to make sure the parametrics (green curves) you see are those associated with the surfaces you see.  Repeat the procedure in steps 43 through 45 for the other surfaces.  This finishes the work on the RightWing surfaces. 

minnow45

46. groupactivate all groups, glue then check to see what problems remain. As you can see, a few problems still exist around the LeftWing and the Prop.  Clear the pick list.

minnow46

47.  To finish the Prop area, click the Mouth, LeftWing, and RightWing groups and groupdeactivate.  A few of the surfaces where the prop meets the body still need trimming.  Select the surfaces shown (shown solid, in red) and off and togg.  (one of the surfaces picked is at the base of the surfaces trimmed for the RightWing. the other is just above that, if the model is oriented with the trimmed surface mentioned in the front, closest to you).

minnow47

48.  Hit "e" to change the pick type to "Everything," and pick all curves.  Clickunglu .  You can see that the parametrics attached to the untrimmed surfaces were only glued; they didn't "belong" to them.  Hit "3" to change the pick type back to 3D.

minnow48

49.  Select the two surfaces and extract.  Select the parametric shown (the curve picked is the one at the base of the Body surface trimmed to meet the RightWing, see the next picture for further clarification, the selected curve is indicated with the lower arrow) and togg.

minnow49

50.  Select the point shown (indicated by the upper arrow) and split.

minnow50

51. togg, select the surface and trim.

minnow51

52.  Select the parametric shown and togg

minnow53

53.  Select the 2 points shown and split.

minnow52

54. togg, select the surfaces and trim. This should clear up the problems at the base of the body except for one which will be cleared up later. Click on.  NOTE:  The two surfaces to the right were trimmed to create the proper connectivity between them and their neighboring surfaces.  For either surface, splitting the parametrics at its boundaries has created a 1 to 1 relationship between the segments at its boundaries and the corresponding segments at its neighbor's boundaries.

minnow54

55.  The only other problems with the prop were around the base of the prop blades.  This is because the surfaces below the blades need trimming.  In this case, the necessary parametrics have already been provided.  Select the surfaces shown (the easiest way is to hit "p", position the cursor at the nose of the  hub, behind the blades, and right click. You should get 5 surfaces, one below each blade) and trim.  Click the Prop group and groupdeactivate. Click the LeftWing group and groupactivate

minnow55

56.  Close inspection of the wing tip reveals that one of the surfaces on the leading edge has a sliver of a surface that makes up the last piece.  The surrounding surfaces could be trimmed to connect to these small surfaces, but  depending on the spacing this could cause problems in the surface grid.  It would be better if this was one surface.  The best way to fix this problem would be to union the two surfaces.  If this doesn't work a carpet could be created like before.

minnow56

57.  Select the two surfaces shown and union.  Select the new surface, click on the LeftWing group and groupadd.

minnow57

58.  Looking at the underside of the wing, you can see another problem.  This could be fixed in a number of ways.  Again, the surfaces could be trimmed to create proper connectivity but this could cause problems in the surface grid.  You could union the respective surfaces (or carpet if necessary).  If the surfaces were intended to be split at this location, one of the two groups can be split and unioned so that all four surfaces meet at one corner. 

minnow58

59.  Select the surface and point shown.  It shouldn't matter which surface and point is selected, but to select the ones shown in the figure, orient the model so that the top curve leads to the Leading Edge, and the lower curves leads to the Trailing Edge of the wing.  Click split

minnow59

60.  Select the surfaces shown and union . Select the new surfaces, click on the LeftWing group and groupadd.

minnow60

61.  Select the point and surface shown (the point selected is at the leading edge of the wing) and split

minnow61

62.  Move to the end of the curve created by splitting the surface in the previous step.  Select the point and surface shown and split.  Select the four new surfaces, click the LeftWing group, and groupadd.

minnow62

63.  The last problem with the LeftWing surfaces is that they don't lie on or intersect the body. (The picture at the right is looking at the Leading Edge of the wing close to the body)  To correct this the wing surfaces can be extended so that they intersect the Body at every point along the wing.

minnow63

64.  Select the surface and its bounding curve shown. (Leading Edge, upper surface)  Change the value in the distancenew field (distance field in the CAD: Surf panel) to 0.25 and xtend.  Repeat for the other 4 wing surfaces that should intersect the body (the surfaces at the Trailing Edge should be extended also even though they may look like they barely intersect already).  The result should look like the picture in the next step. NOTE:  Extending surfaces can slightly change the interior of the surface depending on how much a given surface is extended.  Also, extending can potentially introduce problems with the surface parameterization.  This problem could be fixed a number of different ways; extending is just the quickest.  Again, the method of repair should be chosen after considering the overall impact on the geometry of each possible method.

minnow64

65.  Select the old surfaces and  delete.  Select the new surfaces, click the LeftWing group, andgroupadd.  The surfaces can now be intersected with the body and trimmed like the RightWing. 

minnow65

66.  Select the surfaces shown and increase the display resolution to 41x41.  Select the body surface then all of the intersecting surfaces (again the order picked is important to obtain the proper intersection) and intergroupdeactivate the Body group.

minnow66

67.  The surfaces need only to be trimmed.  The same procedure as in steps 43 - 46 could be used but another technique is used for illustration.  Select the surfaces shown, off, and toggrepick the surfaces andextract

minnow67

68.  Hit "r" to set the pick limit to "Param."  Position the cursor over the curve shown selected.  Pick twice to get both parametrics (one from each surface).  Pick the point shown and split.  Repeat for the other three sets of curves around the wing.  Don't forget to use Pick Limit: Point when picking the split points.

minnow76

69.  Remove the curves shown.  Again, there are two curves below the split point, one from each surface.  (there should be no green (parametric) curves left where red is shown).

minnow68

70.  Select the surfaces and trimgroupactivate all groups and click on to be sure everything is visible.

minnow69

71.  To clear up the final problems, select the surface shown.off and toggrepick the surface andextract

minnow70

72.  Select the parametric curve shown and togg.

minnow71

73.  Select the point (remember to set the pick limit to "Point" when picking points) shown split and togg.

minnow72

74.  Select the parametric shown and togg.

minnow73

75.  Select the two points shown split and togg.  Pick the surface and trim.

minnow74

76.  Click onglue, and check.  You should get a message: Integrity check passed!
0 Edges Picked The CAD cleanup is done!  Save your work for the next tutorial.

minnow75

The model is now ready to have point spacings applied.  The next tutorial covers splitting surfaces (like the prop and wing surfaces) to use points efficiently .

contents_btn previous_btn home_btn next_btn