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.
- Using NotePad, create a file containing the following:
"Plate width" = 5in
"Plate height" = 3in
"Num holes" = 4
- Do not put a space before the "in".
- Save the file with the name params.txt
- Start SolidWorks.
- Turn off the Simulation add-in.
- Create a new part.
- Turn off Instand3D mode if it's on.
- Click on Tools -> Equations
- Click on the Import button and import params.txt
- Notice that the variables are to be imported as "linked to file".
- Click Import in the pop-up window to confirm.
- Notice that three new global variables have been defined.
- Click OK to exit the Equations dialog.
- Note that a new Equations item has appeared in the feature manager tree.
- Create an Extruded Base feature on the Front plane.
- Draw a rectangle with arbitrary width and height.
- Click on View -> Hide/Show -> Dimension Names.
- Use the Smart Dimension tool to create a dimension for the width of the rectangle.
- In the dimension pop-up dialog, type and "=" sign, then select [Global Variables] and "Plate width". Hit Enter to confirm.
- We're going to use a different tecchnique to dimension the height, so you can see both.
- Dimension the height of the rectangle and just accept whatever numeric value is shown.
- Click OK to accept the sketch.
- Set the extrusion depth to 1/8 inch.
- Click OK to complete the extrude.
- Go back and edit the sketch again.
- Right click on Equations in the feature manager tree.
- Select Manage Equations.
- Click on the Equation View button.
- In the Equations section, click on the "Add equation" box.
- Click on the D2@Sketch1 dimension, which controls the height.
- In the Value/Equation box, which now contains an "=" sign, select:
= [Global Variables] "Plate height" [Enter]
- Click OK to exit the Equation manager.
- Click on the Hole Wizard.
- Select regular "Hole", ANSI Inch, Screw Clearances, size #4, "Close fit", "Through All".
- Switch to the Positions tab and select the face of the plate.
- Put one hole near the bottom left corner of the plate.
- Select the Smart Dimension tool.
- Add a horizontal dimension from the hole to the left edge. This is D1.
- Add a vertical dimension from the hole to the bottom edge. This is D2.
- Click OK to exit the Hole Wizard.
- Open the #4 Clearance Hole feature in the feature manager tree.
- Edit the first sketch in that feature.
- Right click on Equations in the feature manager tree; select Manage Equations.
- Change the value of D2 in the sketch to:
= [Global Variables] "Plate height" / 3 [Enter]
- Change the value of D1 in the sketch to:
= [Global Variables] "Plate width" / ( [Global Variables] "Num holes" * 2) [Enter]
- Click OK to exit the sketch.
- Create a Linear Pattern feature.
- For Direction1, click on the bottom edge of the plate.
- For the distance D1, enter 1in
- For number of copies, enter 3.
- For Features to Pattern, select the Clearance Hole feature.
- Click OK to complete the pattern.
- In the feature manager tree, right click on Equations again and select Manage Equations.
- Switch to the Dimension View.
- Set the value of D3@LPattern1 to:
= [Global Variables] "Plate width" / [Global Variables] "Num holes"
- Set the value of D1@LPattern1 to:
= "Num holes"
- Click OK.
- Notice that the plate has four evenly-spaced holes.
- In NotePad, change the number of holes from 4 to 5, and resave the file.
- Click on the Rebuild button and watch the number of holes change.
- In NotePad, change the width from 5 to 6 inches, and resave the file.
- Click on the Rebuild button and watch the part change.
- 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
- We're going to make a large hole that is present only when "Num holes" is odd.
- Using the Hole Wizard, create a new Clearance Hole feature.
- Set the hole size to #10.
- Click on the Positions tab, then click on the front face of the part.
- Draw a vertical centerline through the midline of the part.
- Place a point on this centerline, about 2/3 of the way up from the bottom.
- Add a vertical dimension between the point and the bottom edge.
- With the sketch still open, open the Equations manager.
- In the Equations section, click in the "Add equation" box.
- Click on the vertical dimension you just created.
- In the Value box, type the following:
= [Global variables] "Plate height" * (2/3) [Enter]
- Click OK to exit the Equation Manager.
- Click OK again to complete the Clearance Hole feature.
- Open the Equation Manager again.
- In the Features section, click in the "Add feature suppression" box.
- Click on the Clearance Hole feature you just created.
- In the Value box, type the following:
= if( ([Global variables] "Num holes" / 2) =
int([Global variables] "Num holes" / 2), "suppressed", "unsuppressed")
- Click OK to exit the equation manager.
- In Notepad, change the number of holes to 4 and resave the file.
- Click on the Rebuild button in SolidWorks.
- Notice that the second Clearance Hole feature is suppressed.
- Change the number of holes to 7 in Notepad and resave the file.
- Click Rebuild in SolidWorks.
SKETCH EQUATIONS
- Create a new part.
- Click on View -> Hide/Show -> Dimension Names.
- Make an extruded base on the front plane.
- Draw a rectangle not tied to the origin.
- Dimension the width and height of the rectangle.
- Draw an ellipse oriented diagonally in the center of the rectangle.
- Right click on the bottom line of the rectangle and choose Select Midpoint.
- Shift click on the center of the ellipse and add a Vertical property.
- Right click on the left line of the rectangle and choose Select Midpoint.
- Shift click on the center of the ellipse and add a Horizontal property.
- Add a dimension between the top and bottom control points of the ellipse.
- Add a dimension between the left and right control points of the ellipse.
- Click to accept the sketch and set the extrusion depth to 1/8 inch.
- Go back and edit the sketch again.
- Enter the Equation Manager and switch to the Sketch Equation view.
- Click in the "Add equations" box, then click on the dimension for the vertical extent of the ellipse.
- In the Value/Equation box, click on the dimension for the height of the rectangle and then type "* (3/4)" and hit Enter.
- Repeat the process to dimension the width of the ellipse to 3/4 the width of the rectangle.
- Click OK to exit the Equation Manager.
- Edit the sketch again.
- Double click on the dimension for the height of the rectangle.
- Use the spin wheel to change the height and note that the ellipse also changes its height.
- Click OK to accept the dimension, then switch to the Other tab in the dimension dialog box.
- Check the "Driven" box in the other tab.
- Use the same steps to make the dimension for the width of the rectangle "Driven".
- Right click on the bottom left corner of the rectangle and click on the anchor icon to fix the point.
- Click and drag on the top right corner to change the shape of the rectangle and note that the ellipse also changes shape.
- Click and drag on any ellipse control point and note that the rectangle
changes shape.
- 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.
- Bring up the Equation Manager and notice the warning messages about potential circularity.
- To eliminate the circularity warnings, remove the "Driven" attribute
from the dimensions. It's also okay to just ignore the warnings.
CONFIGURATION MANAGER
- Click on the Configuration Manager button in the left window.
- Right click on the part and select "Add Configuration".
- Name the new configuration "signed".
- Click OK to exit the Configuration Manager.
- Click on the Feature manager button in the left window.
- Notice that the part is shown in the "signed" configuration.
- Create an Extruded Cut feature on the part face.
- In the sketch, add a text element.
- Type your initials in the text box and click OK.
- Move the text element to the top left corner of the part.
- Click OK and select "All bodies" if asked.
- Set the Extruded Cut parameter to "Through All"
- Click OK to complete the feature.
- Return to the Configuration Manager and double click on the "Default" configuration.
- Return to the Feature Manager.
- Notice that the Extruded Cut feature is now suppressed.
McMaster-Carr
- Go to www.mcmaster.com
- Type "standoffs" in the search box.
- Select Female standoffs
- Select Hex shape
- Select Inches
- Select 3/4 inch length
- Select 4-40 screw size
- Select 1/4 inch hex size
- Check the prices; which material is cheapest?
- Click on the part number for the part you want.
- Click on Product Details.
- Type "acrylic sheet" in the search box.
- Select "Sheets and bars"
- Select Acrylic
- Select 1/8 inch thickness
- Select Blue color
- Select 12 inch by 12 inch
- Select the colored part and click on the part number.
- Click on Product Details
|