Using Equations in SolidWorks

In this exercise we're going to create a plate with equally spaced holes controlled by a parameter file.

You can change the width of the plate and/or the number of holes, and the hole pattern will automatically adjust.

  1. Using NotePad, create a file containing the following:
    "Plate width" = 5in
    "Plate height" = 3in
    "Num holes" = 4
  2. Do not put a space before the "in".
  3. Save the file with the name params.txt

  4. Start SolidWorks.
  5. Turn off the Simulation add-in.
  6. Create a new part.
  7. Turn off Instand3D mode if it's on.
  8. Click on Tools -> Equations
  9. Click on the Import button and import params.txt
  10. Notice that the variables are to be imported as "linked to file".
  11. Click Import in the pop-up window to confirm.
  12. Notice that three new global variables have been defined.
  13. Click OK to exit the Equations dialog.
  14. Note that a new Equations item has appeared in the feature manager tree.

  15. Create an Extruded Base feature on the Front plane.
  16. Draw a rectangle with arbitrary width and height.
  17. Click on View -> Hide/Show -> Dimension Names.
  18. Use the Smart Dimension tool to create a dimension for the width of the rectangle.
  19. In the dimension pop-up dialog, type and "=" sign, then select [Global Variables] and "Plate width". Hit Enter to confirm.
  20. We're going to use a different tecchnique to dimension the height, so you can see both.
  21. Dimension the height of the rectangle and just accept whatever numeric value is shown.
  22. Click OK to accept the sketch.
  23. Set the extrusion depth to 1/8 inch.
  24. Click OK to complete the extrude.

  25. Go back and edit the sketch again.
  26. Right click on Equations in the feature manager tree.
  27. Select Manage Equations.
  28. Click on the Equation View button.
  29. In the Equations section, click on the "Add equation" box.
  30. Click on the D2@Sketch1 dimension, which controls the height.
  31. In the Value/Equation box, which now contains an "=" sign, select:
    = [Global Variables] "Plate height" [Enter]
  32. Click OK to exit the Equation manager.

  33. Click on the Hole Wizard.
  34. Select regular "Hole", ANSI Inch, Screw Clearances, size #4, "Close fit", "Through All".
  35. Switch to the Positions tab and select the face of the plate.
  36. Put one hole near the bottom left corner of the plate.
  37. Select the Smart Dimension tool.
  38. Add a horizontal dimension from the hole to the left edge. This is D1.
  39. Add a vertical dimension from the hole to the bottom edge. This is D2.
  40. Click OK to exit the Hole Wizard.
  41. Open the #4 Clearance Hole feature in the feature manager tree.
  42. Edit the first sketch in that feature.
  43. Right click on Equations in the feature manager tree; select Manage Equations.
  44. Change the value of D2 in the sketch to:
    = [Global Variables] "Plate height" / 3 [Enter]
  45. Change the value of D1 in the sketch to:
    = [Global Variables] "Plate width" / ( [Global Variables] "Num holes" * 2) [Enter]
  46. Click OK to exit the sketch.

  47. Create a Linear Pattern feature.
  48. For Direction1, click on the bottom edge of the plate.
  49. For the distance D1, enter 1in
  50. For number of copies, enter 3.
  51. For Features to Pattern, select the Clearance Hole feature.
  52. Click OK to complete the pattern.

  53. In the feature manager tree, right click on Equations again and select Manage Equations.
  54. Switch to the Dimension View.
  55. Set the value of D3@LPattern1 to:
    = [Global Variables] "Plate width" / [Global Variables] "Num holes"
  56. Set the value of D1@LPattern1 to:
    = "Num holes"
  57. Click OK.
  58. Notice that the plate has four evenly-spaced holes.
  59. In NotePad, change the number of holes from 4 to 5, and resave the file.
  60. Click on the Rebuild button and watch the number of holes change.

  61. In NotePad, change the width from 5 to 6 inches, and resave the file.
  62. Click on the Rebuild button and watch the part change.

  63. Go back into the Equation Manager and observe the four display modes:

Equation Dialog Box: Four Views

  • Equation View - shows only the equations you've defined.
  • Sketch Equation View - shows only equations for the current sketch. Allows you to click and drag to change values.
  • Dimension View - shows every dimension in the part.
  • Ordered View - shows order of evaluation for equations.

CONDITIONAL FEATURES

  1. We're going to make a large hole that is present only when "Num holes" is odd.
  2. Using the Hole Wizard, create a new Clearance Hole feature.
  3. Set the hole size to #10.
  4. Click on the Positions tab, then click on the front face of the part.
  5. Draw a vertical centerline through the midline of the part.
  6. Place a point on this centerline, about 2/3 of the way up from the bottom.
  7. Add a vertical dimension between the point and the bottom edge.
  8. With the sketch still open, open the Equations manager.
  9. In the Equations section, click in the "Add equation" box.
  10. Click on the vertical dimension you just created.
  11. In the Value box, type the following:
    = [Global variables] "Plate height" * (2/3) [Enter]
  12. Click OK to exit the Equation Manager.
  13. Click OK again to complete the Clearance Hole feature.

  14. Open the Equation Manager again.
  15. In the Features section, click in the "Add feature suppression" box.
  16. Click on the Clearance Hole feature you just created.
  17. In the Value box, type the following:
    = if( ([Global variables] "Num holes" / 2) =
          int([Global variables] "Num holes" / 2), "suppressed", "unsuppressed")
  18. Click OK to exit the equation manager.

  19. In Notepad, change the number of holes to 4 and resave the file.
  20. Click on the Rebuild button in SolidWorks.
  21. Notice that the second Clearance Hole feature is suppressed.

  22. Change the number of holes to 7 in Notepad and resave the file.
  23. Click Rebuild in SolidWorks.

SKETCH EQUATIONS

  1. Create a new part.
  2. Click on View -> Hide/Show -> Dimension Names.
  3. Make an extruded base on the front plane.
  4. Draw a rectangle not tied to the origin.
  5. Dimension the width and height of the rectangle.
  6. Draw an ellipse oriented diagonally in the center of the rectangle.
  7. Right click on the bottom line of the rectangle and choose Select Midpoint.
  8. Shift click on the center of the ellipse and add a Vertical property.
  9. Right click on the left line of the rectangle and choose Select Midpoint.
  10. Shift click on the center of the ellipse and add a Horizontal property.
  11. Add a dimension between the top and bottom control points of the ellipse.
  12. Add a dimension between the left and right control points of the ellipse.
  13. Click to accept the sketch and set the extrusion depth to 1/8 inch.

  14. Go back and edit the sketch again.
  15. Enter the Equation Manager and switch to the Sketch Equation view.
  16. Click in the "Add equations" box, then click on the dimension for the vertical extent of the ellipse.
  17. In the Value/Equation box, click on the dimension for the height of the rectangle and then type "* (3/4)" and hit Enter.
  18. Repeat the process to dimension the width of the ellipse to 3/4 the width of the rectangle.
  19. Click OK to exit the Equation Manager.

  20. Edit the sketch again.
  21. Double click on the dimension for the height of the rectangle.
  22. Use the spin wheel to change the height and note that the ellipse also changes its height.
  23. Click OK to accept the dimension, then switch to the Other tab in the dimension dialog box.
  24. Check the "Driven" box in the other tab.
  25. Use the same steps to make the dimension for the width of the rectangle "Driven".
  26. Right click on the bottom left corner of the rectangle and click on the anchor icon to fix the point.
  27. Click and drag on the top right corner to change the shape of the rectangle and note that the ellipse also changes shape.
  28. Click and drag on any ellipse control point and note that the rectangle changes shape.
  29. The only way to undo the "Fixed" attribute of the bottom left point is to click on it and then click on "Fixed" in the property manager and press Delete.

  30. Bring up the Equation Manager and notice the warning messages about potential circularity.
  31. To eliminate the circularity warnings, remove the "Driven" attribute from the dimensions. It's also okay to just ignore the warnings.

CONFIGURATION MANAGER

  1. Click on the Configuration Manager button in the left window.
  2. Right click on the part and select "Add Configuration".
  3. Name the new configuration "signed".
  4. Click OK to exit the Configuration Manager.
  5. Click on the Feature manager button in the left window.
  6. Notice that the part is shown in the "signed" configuration.

  7. Create an Extruded Cut feature on the part face.
  8. In the sketch, add a text element.
  9. Type your initials in the text box and click OK.
  10. Move the text element to the top left corner of the part.
  11. Click OK and select "All bodies" if asked.
  12. Set the Extruded Cut parameter to "Through All"
  13. Click OK to complete the feature.
  14. Return to the Configuration Manager and double click on the "Default" configuration.
  15. Return to the Feature Manager.
    • Notice that the Extruded Cut feature is now suppressed.

McMaster-Carr

  1. Go to www.mcmaster.com
  2. Type "standoffs" in the search box.
  3. Select Female standoffs
  4. Select Hex shape
  5. Select Inches
  6. Select 3/4 inch length
  7. Select 4-40 screw size
  8. Select 1/4 inch hex size
  9. Check the prices; which material is cheapest?
  10. Click on the part number for the part you want.
  11. Click on Product Details.

  12. Type "acrylic sheet" in the search box.
  13. Select "Sheets and bars"
  14. Select Acrylic
  15. Select 1/8 inch thickness
  16. Select Blue color
  17. Select 12 inch by 12 inch
  18. Select the colored part and click on the part number.
  19. Click on Product Details