Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 111 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
111
Dung lượng
5,32 MB
Nội dung
FIGURE 9.1 The Equations interface Using the Equations interface, you can turn off equations temporarily by deselecting the Active check box in front of the equation. Equations can also be deactivated by a design table. I will dis- cuss design tables in more detail in Chapter 10, which discusses configurations. Although I do not cover configurations until Chapter 10, I will mention this here. Equations and configurations (particularly those that are driven by a design table) should probably not be mixed. This is not because they do not work together, but more for the sake of organization. When controlling dimensions, it can become confusing if the changes are being driven from multiple sources. Also, there is no reason not to bring your equations into Excel rather than using the comparatively limited equation functionality offered by SolidWorks. Creating equations Equations are easy to create and useful for many purposes. A common situation where you would use an equation is to space a pattern of holes evenly along an edge, including the gap on both ends, where the gap at the ends is half of the regular spacing. Before you write an equation, you need to take care of a few organizational details. Naming dimensions It is not necessary to name every entity in every SolidWorks document, but you should get in the habit of naming important features, sketches, and even dimensions. Dimensions become particu- larly important when you use equations, configurations, and design tables. Under most circum- stances, you do not use or even see dimension names, but with equations, you do. BEST PRACTICE BEST PRACTICE 304 Building Intelligence into Your Parts Part II 15_080139 ch09.qxp 3/26/07 3:41 PM Page 304 Named dimensions make a huge difference when you want to recognize the function of an equa- tion by simply reading it. A most obvious example would be the difference between D3@Sketch6 and Length@WindowExtrusionSketch. The first name means nothing, but the second one is descriptive if you are familiar with the part. To name a dimension, RMB click the dimension and select Properties. At the top of the dialog box shown in Figure 9.2, type the new name for the dimension in the Name text box. You cannot use the symbol @ in dimension names because it is used as a delimiter between the name of the dimension and the feature or sketch to which it applies. FIGURE 9.2 Renaming a dimension You should keep dimension names as short as possible while still making them unique and descriptive. This is because space in the interface is often limited, and when com- bined with sketch or feature names (and even part names when used in an assembly), the names can become difficult to read. You can show dimension names as a part of the dimension value itself by accessing the setting at Tools, Options, General, Show Dimension Names. Building the equation When creating an equation in SolidWorks, it is often a good idea to write it out on paper first. Examine the part shown in Figure 9.3, where the relevant dimensions have been named and dis- played. The behavior to be driven by the equations is that the number of holes — called Instances here — is the driving variable. From that number, the spacing of the holes is calculated over the length of the part. There is also a gap on each end of the pattern of holes. This gap (measured between the center of the last hole and the end of the part) needs to always be half of the spacing between the holes. The sigma symbols to the left of the dimensions indicate that an equation is driving it. Dimensions driven by equations cannot be directly edited. TIP TIP BEST PRACTICE BEST PRACTICE 305 Using Equations 9 15_080139 ch09.qxp 3/26/07 3:41 PM Page 305 FIGURE 9.3 Variables for the hole pattern In this case, more sophistication has not been implemented to account for the diameter of the holes possibly interfering with one another when there are a large number of holes. In other words, because there are two values that need to be calculated (the spacing and the gap), you need to cre- ate two equations. Because the gap dimension is always half of the spacing, the spacing needs to be calculated first, as follows: Spacing = Length / ((Instances-1)+1) The Instances -1 term stands for the number of spacings. If you have two holes, then there is only one spacing. The +1 term stands for the two half-spacings for the two ends. The second equation is simpler and looks like this: Gap = Spacing / 2 The order of the equations is important. SolidWorks solves the equations in the order in which they are listed in the Equations dialog box. Because the gap is dependent on the spacing, the spac- ing must be calculated before the gap. If it is done the other way around, then you can get into a situation where it takes two rebuilds to finalize a set of equations, or even a situation where in every rebuild, all of the numbers change. This is called a circular relation, and is a common error in order or history dependent functions, not just in SolidWorks, but in any computer application. Figure 9.4 shows the resulting set of equations. FIGURE 9.4 Equations for the hole pattern 306 Building Intelligence into Your Parts Part II 15_080139 ch09.qxp 3/26/07 3:41 PM Page 306 Before beginning to build the equation, you should first display the dimensions that you need to use to create the equation. You can add dimensions to the equation by clicking them from the graphics window. To do this, RMB click the Annotations folder at the top of the FeatureManager, and select Show Feature Dimensions. You should also select the Display Annotations option if it is not already on. When you have done this, all of the dimensions that you need to create every fea- ture are displayed. Also be sure to turn on Tools ➪ Options ➪ General ➪ Show Dimension Names. For models that have more than a few features, showing all of the dimensions in the entire model may overload the screen with information. In this case, you can double- click a feature from the FeatureManager to show all of the dimensions on that feature. To build the equation, first use the Equation button on the Tools toolbar to open the Equations dialog box. Then press the Add button to display the Add Equation dialog box. To add dimensions to the equation section, just click the dimension. You can use the keypad on the dialog box or on your keyboard to add operators and syntax. All standard rules of syntax apply for the order of operations, use of parentheses, and driving versus driven sides of the equation. Using comments Notice the comment to the right of the first equation in Figure 9.4. Comments can be very useful for annotating equations for yourself or others. Two important reasons to annotate are to remember the significance of variables or dimensions, and to add special notes about the logic of the equation. You can make comments for equations by using a single quote after the end of the equation, or by using the Comment button in the Add Equation dialog box. In the following example, “Spacing@LPattern1” = “Length@Sketch1” / (“Instances@LPattern1”) ‘This must be solved first the comment, “This must be solved first,” is applied to the equation using the single quote before the comment. Adding to the earlier discussion about projected changes to the Equation interface, several standard selection functionalities do not work in the Edit Equation dialog box. These include triple-clicking to select all (although double-clicking works to select a single word) and pressing Ctrl+A to select all. You can make general comments for the model in the Design Journal, a Microsoft Word document that is embedded into the SolidWorks file. The Design Journal is found in the Design Binder folder near the top of the FeatureManager. You can find the part used in this section on the CD-ROM with the filename Chapter 9 Equations.sldprt. ON the CD-ROM ON the CD-ROM TIP TIP TIP TIP 307 Using Equations 9 15_080139 ch09.qxp 3/26/07 3:41 PM Page 307 Using driven dimensions Sometimes it is more convenient to use a driven (reference) dimension in an equation. This is par- ticularly true when using geometry is the best way to calculate a number. For example, if you are manufacturing a helical auger in 90-degree sections from flat steel stock, then you need to design the auger in 3D, but begin to manufacture it in 2D. What is the shape of the auger when flat? The best way to figure this out (aside from lofted bends, which are discussed in Chapter 29) is to use a little high school geometry, a construction sketch, and some simple equations. Figure 9.5 shows a 90-degree section of an auger blade. The outside diameter is 12 inches, and the blade width is 3 inches. The overall height is 4 inches. In this case, the auger is represented as a surface because the thickness is ignored. Surface features can be useful in situations like this and are discussed in Chapter 27. FIGURE 9.5 Representation of the auger You can find the part for Figure 9.5 on the CD-ROM with the filename Chapter 9 Auger.sldprt. With this information, we can calculate the lengths of the 3D edges using a sketch and a simple equation. In Figure 9.6, the hypotenuses of the triangles represent the helical edges of the helices. By making the triangles the same height as the auger section, and by making the horizontal side of the triangle the same length as a quarter of the inside or outside diameter by using simple equa- tions, the geometry and sketch relations calculate the flat lengths of the inside and outside edges of the auger (length of triangle side = diameter of circle × pi / 4). In this way, the triangle is used to simplify the calculation, and give it a visual result. ON the CD-ROM ON the CD-ROM 308 Building Intelligence into Your Parts Part II 15_080139 ch09.qxp 3/26/07 3:41 PM Page 308 FIGURE 9.6 Triangles calculate the length of the helical edge. From this point, the flat pattern can be calculated again, using SolidWorks’ sketch-solving capabili- ties as the calculator. Think of the auger as being the cardboard tube inside a roll of paper towels. If you examine one of these tubes closely, you see that it is simply a straight and flat strip of card- board that has been wound around a cylinder. What was the flat, straight edge of the original board is wound into a helix. This method is simply reversing that process. This example requires the little-used arc-length dimension to drive the size of the arc. The hypotenuse dimensions are shown by driven or reference dimensions, and these are used to drive the arc-length dimensions, as shown in Figure 9.7. Remember that you can create arc length dimensions by using the Smart Dimension tool to click both endpoints of the arc and then the arc itself. Arcs driven by arc length dimensions often do not react to changes predictably, since the radius and center or end point locations are not necessarily defined. The reasoning behind this example may be a little difficult to grasp, but the equations and the sketches are certainly simple. Using reference dimensions on the driving (independent, or right) side of the equation can in some situations require more than one rebuild to arrive at a stable value (mean- ing a value that does not change with the next rebuild). SolidWorks issues a warning when it sees that you are using a reference dimension in an equation, but it does allow it. Equations are listed in the Equations folder in the FeatureManager. You can edit or delete them through the RMB menu. CAUTION CAUTION 309 Using Equations 9 15_080139 ch09.qxp 3/26/07 3:41 PM Page 309 FIGURE 9.7 Figuring the flat pattern of the auger Equation tricks Some functions that are allowed in SolidWorks equations are often viewed as parlor tricks, but they actually do have some practical applications. The two functions that fall into this category are IIF and SWITCH. If you are familiar with a programming language, you may already be familiar with these two functions. If not, then they are described below. IIF In words, this is how an IIF statement is used: If some relationship is fulfilled, then the IIF function returns a value. If the relationship is not ful- filled, then it returns a different value. A more technical description is IIF(expression, value if true, value if false) In practice, you could use it like this: IIF(x>5, x-1, x+1) 310 Building Intelligence into Your Parts Part II 15_080139 ch09.qxp 3/26/07 3:41 PM Page 310 which reads, “if x is greater than 5, then subtract 1 from x; if not, then add 1 to x.” One of the rea- sons why this is considered a parlor trick is that this function causes the value of x to oscillate between two numbers (depending on the number that it starts with) with each rebuild. It may be difficult to imagine an application where this sort of behavior would be desirable, but when you combine it with a macro that simply rebuilds a model a number of times, you can use it to create a certain animation effect. A simple example of the IIF function can be found on the CD-ROM with the filename Chapter 9 Oscillate.sldprt. The equation is shown in Figure 9.8. FIGURE 9.8 An equation using IIF You can find some great examples of this function at www.mikejwilson.com, along with many other extremely creative examples of SolidWorks modeling. The model on this site called Ship in a Bottle.sldprt also includes a macro that will rebuild the model a certain num- ber of times, which is useful for animations that are created in this way. SWITCH The SWITCH function enables you to have a list of relationships with associated values. The value of the first relationship in the list that is satisfied is returned by the SWITCH function. For example, switch (x>2, 1.5, x>1, .5 x<1, 2.5) reads as follows: “if x is greater than 2, then the answer is 1.5; if x is not greater than 2 but greater than 1, then the answer is .5; if x is not greater than 1 but less than 1, then the answer is 2.5.” As you can see, this function does not cover all situations, but it does create a condition where the value cycles through three different numbers in a specific order. Is this useful? Possibly. Again, the main application for this function would be a simple animation for changing the size or shape of SolidWorks components that cannot be done in other more conventional ways. Using Link Values Link values are simply a way to link several dimensions together. A link value is not exactly like an equation that sets the dimensions equal, because it does not depend on order like an equation does. All dimensions are set to the same value simultaneously. TIP TIP ON the CD-ROM ON the CD-ROM 311 Using Equations 9 15_080139 ch09.qxp 3/26/07 3:41 PM Page 311 Link values are available by RMB clicking the dimension. Unfortunately, they are not available from the RMB menu when the dimension tool is active. To apply a link value to a new dimension, you must place the dimension, exit the dimension tool, RMB click the dimension, and select Link Value. Link values are listed under the Equations folder in the FeatureManager. Figure 9.9 shows the link values in a listed part, and the drop-down list from which you can select them or type them. Notice again that the Link Values feature also operates from a dialog box instead of the PropertyManager. I would predict that the Link Values and Equations would be redesigned to func- tion more in sync with one another in a future version of SolidWorks. FIGURE 9.9 Link values listed in the FeatureManager, and the Shared Values interface The first link value that is assigned in a part must be manually typed in. After you add the first one, you can link other dimensions to this link value by using the scroll arrows shown in Figure 9.9. You cannot edit link values. In order to change the value to which a dimension is linked, you must first unlink the value and then relink it. The Unlink function is available from the RMB menu in the same way that you assign link values. Dimensions that have a link value have the small chain symbol displayed to the left of the dimension. There is one link value name that has a special significance. If you use the name thickness , then a Link To Thickness option appears in all extrude dialog boxes. This is intended to reflect sheet metal functionality, but it is useful for models of various manufacturing techniques. To take this one step further, you can save a part template with a thickness link value; all of your new parts will also have this functionality right from the start. To save the template with a link value, you must create at least one dimension to assign the link value, and then delete the geometry (and the dimension); however, the link value will remain. Link values of different types are not necessarily interchangeable. You cannot use angular dimen- sion link values on radius, diameter, or linear dimensions. You can use linear and diameter link values interchangeably, but not angle link values. TIP TIP 312 Building Intelligence into Your Parts Part II 15_080139 ch09.qxp 3/26/07 3:41 PM Page 312 Using Global Variables Global variables are assigned in the Equations dialog box as simply the variable name equaling the value. Figure 9.10 shows a list of equations, link values, and global variables. When you are typing in the name of the variable, you do not need to add the quotation marks; they are added automatically. FIGURE 9.10 Equations, link values, and global variables Despite the word variable in the name global variable, the values are not variable. They are fixed, and only changeable through the Equations dialog box. The only place where you can use global variables is in equations. You cannot directly enter them into dialog boxes for dimension values. Using Expressions Expressions, unlike all of the previous variables, values, and equations, can be entered directly into dimension dialog boxes. The expressions have to be composed of numbers and mathematical oper- ators. An expression such as 2.375+(4.8/3) -1.1 is perfectly acceptable, as is 1+1/2 or 1 1/2. In the second case above, the plus symbol is understood. 313 Using Equations 9 15_080139 ch09.qxp 3/26/07 3:41 PM Page 313 [...]... calculating it offers a big benefit 3 24 16_080139 ch10.qxp 3/26/07 3 :41 PM Page 325 Working with Part Configurations SolidWorks 2007 Service Pack 1 has a fix associated with it that takes advantage of a new hotfix from Microsoft that removes shadow data from files, and may reduce the size of SolidWorks files to one-half or even one-quarter of their original size See the SolidWorks Customer Portal and the...15_080139 ch09.qxp Part II 3/26/07 3 :41 PM Page 3 14 Building Intelligence into Your Parts Other types of operations are also available, such as changing units in a dimension box For example, if you are editing a part in inches, and enter 40 mm, then SolidWorks does the conversion for you You can even mix units in a single expression such as 4. 875+3.5mm, where the inch part is assumed Tutorial:... input, link values, and global variables If you want to encourage SolidWorks to revise certain features, then you can go to the SolidWorks Web site and submit an enhancement request They do look at customer input when developing or updating functionality 315 9 15_080139 ch09.qxp 3/26/07 3 :41 PM Page 316 16_080139 ch10.qxp 3/26/07 3 :41 PM Page 317 Working with Part Configurations C onfigurations, also... close the part with a new name, including your initials or the date 3 14 15_080139 ch09.qxp 3/26/07 3 :41 PM Page 315 Using Equations Summary SolidWorks equations and related dimension-management tools are powerful, but often leave you wishing for a little more flexibility and control The interface is not up-to-date with the rest of the SolidWorks interface, and so I would look to see an updated equation... 16_080139 ch10.qxp Part II 3/26/07 3 :41 PM Page 328 Building Intelligence into Your Parts FIGURE 10.9 The Configuration Specific tab in the Summary Information dialog box Controlling colors Face, feature, body, and part colors as well as materials are also configurable Just switch to the configuration you want to control, and make the changes New in SolidWorks 2007 sp1 is a button in the Color Properties... of Excel that are supported by SolidWorks for design tables are XP, 2000, and 2003 Although Excel 97 may still work, Microsoft no longer supports that product Excel is a format that is easy to read and print out, and even non -SolidWorks users can understand and work with it Although there is some special syntax that you need to use with design tables, for most uses, SolidWorks can create the syntax... use the part from the CD-ROM with the filename Chapter 10 DTstart.sldprt Figure 10. 14 shows the results of starting with the new blank design table You may notice that the window title bar at the top says SolidWorks, but the toolbars look a lot like the Excel interface This is because Excel is actually running inside of SolidWorks Clicking outside of the Excel window can cause the Excel window to close,... the Advanced Options, which are discussed next Although you can change the preferred settings at any time, it is definitely a best practice to make a template early on when you are using SolidWorks to model parts SolidWorks remembers the Bill of Materials options and Advanced options that you set for the Default configuration and uses them in document templates This is true for both part and assembly... configs because changing suppression states for several features across multiple configs is much easier in a design table than in manual config management 323 10 16_080139 ch10.qxp Part II 3/26/07 3 :41 PM Page 3 24 Building Intelligence into Your Parts Derived configurations Derived configurations are configs that are dependent on other configs You can create them from the RMB menu on a configuration instead... controlling items with configurations Using design tables Tutorial: Working with configurations and design tables 16_080139 ch10.qxp Part II 3/26/07 3 :41 PM Page 318 Building Intelligence into Your Parts Controlling Items with Configurations With every new release of SolidWorks software, it seems that there are new items that become “configurable,” that is, able to be driven by configurations Configurable items . name, including your initials or the date. 3 14 Building Intelligence into Your Parts Part II 15_080139 ch09.qxp 3/26/07 3 :41 PM Page 3 14 Summary SolidWorks equations and related dimension-management. or history dependent functions, not just in SolidWorks, but in any computer application. Figure 9 .4 shows the resulting set of equations. FIGURE 9 .4 Equations for the hole pattern 306 Building. you are editing a part in inches, and enter 40 mm, then SolidWorks does the conversion for you. You can even mix units in a single expression such as 4. 875+3.5mm, where the inch part is assumed. Tutorial: