156
www.driveworks.co.uk The Little Book of Rules DriveWorksXpress and DriveWorks Solo Edition

SOLIDWORKS, SolidCAM, Cimatron İpuçları ve Eğitim - The Little … · 2020. 6. 4. · DriveWorksXpress and DriveWorks Solo Design Automation software products, developed by DriveWorks

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

  • www.driveworks.co.uk

    The Little Book of Rules

    DriveWorksXpress and DriveWorks Solo Edition

  • DriveWorks Ltd.

    2

    The Little Book of Rules (DriveWorksXpress and DriveWorks Solo Edition)

    Copyright © 2011 DriveWorks Ltd.

    www.driveworks.co.uk

    All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means without written permission of the author.

  • The Little Book of Rules

    3

    About this Book

    This book has been written as a pocket guide to accompany DriveWorksXpress and DriveWorks Solo Design Automation software products, developed by DriveWorks Ltd.

    Throughout this book we have used this symbol to identify information that is relevant exclusively to DriveWorks Solo.

    DriveWorksXpress has been incorporated as core functionality into every license of SolidWorks. ‘How to’ Video clips, Tutorials and Sample Projects are available for you at www.driveworksxpress.com

    DriveWorks Solo is available to purchase worldwide through the SolidWorks/DriveWorks Value Added Reseller Channel. A FREE 30 day license is available to allow you to TRY DriveWorks Solo.

    Simply register online at www.driveworkssolo.com, request the 30 day license and download the software. ‘How to’ Video Clips, Training Tutorials and Sample Projects are all also available on the web at www.driveworkssolo.com

  • www.driveworks.co.uk

    Table of Contents THE LITTLE BOOK OF RULES ................................... 1 

    ABOUT THIS BOOK ................................................ 3 

    WHAT IS A RULE? .................................................. 9 

    WHY ARE RULES GOOD? ...................................... 10 

    TYPICAL RULES ..................................................... 11 

    WHAT’S IN A RULE? ............................................. 12 

    DATA TYPES ............................................................ 13 WHAT CAN GO IN A RULE? ......................................... 14

    Operators ......................................................... 14 Functions .......................................................... 15 Literals ............................................................. 16 Names .............................................................. 16 Other Rules ...................................................... 17

    MAKING DECISIONS .................................................. 18 IF ...................................................................... 18 Conditions ........................................................ 19 Comparison Operators ..................................... 19 Values .............................................................. 20 Lookup ............................................................. 21

    CONCATENATE OR JOIN TEXT, VALUES AND FUNCTIONS .... 23 SPEECH MARKS ........................................................ 23 PARENTHESES .......................................................... 24

  • DriveWorks Ltd.

    6

    ADVANCED RULES ............................................... 25

    NESTED IF STATEMENT .............................................. 25 NESTING AND COMBINING OTHER FUNCTIONS ................ 28

    TYPES OF RULE .................................................... 31

    INPUT CONTROL LIST RULES ....................................... 32 FILE NAME RULES..................................................... 32

    Unique naming ................................................ 32 Intelligent naming ............................................ 34 Remove Master File Name ............................... 35 Move Master File Name to the End ................. 35 Deleting or suppressing components ............... 36 Replacing components ..................................... 37 Replacing driven components .......................... 38

    RELATIVE PATH RULES ............................................... 39 Relative ............................................................ 39 Absolute ........................................................... 40

    CONFIGURATION RULES ............................................. 41 Delete unused configurations .......................... 41

    DIMENSION RULES ................................................... 42 Linear Dimensions ............................................ 42 Angles .............................................................. 43 Patterns ........................................................... 43 Tolerances ........................................................ 45

    FEATURE RULES ....................................................... 47 ADVANCED FEATURE RULES ....................................... 48

    Advanced Base Extrude and Base Extrude Thin Parameters ...................................................... 48 Advanced Boss Extrude Parameters ................ 51 Advanced Boss Extrude Thin Parameters ......... 53 Advanced Cut Extrude parameters .................. 56

  • The Little Book of Rules

    7

    Advanced Cut Extrude Thin parameters .......... 59 Advanced Chamfer parameters ....................... 62 Advanced Fillet parameters ............................. 64 Advanced Text parameters .............................. 66

    CUSTOM PROPERTY RULES ......................................... 67 Driving the Color .............................................. 67 Driving the Material ......................................... 69 Driving the Texture .......................................... 70

    INSTANCE RULES ...................................................... 71 DRAWING RULES ...................................................... 73

    File Name Rule ................................................. 73 Relative Path Rule ............................................ 74 Layer State Rule ............................................... 75 Sheet State ....................................................... 75 Sheet Scale Numerator and Denominator Rules ......................................................................... 76 View State Rules .............................................. 77 View Scale Numerator and Denominator Rules 78 View Left and Top (Position) Rules ................... 79 Breakline Rules ................................................. 80 Drawing Custom Property Rules ...................... 81 Annotation Rules ............................................. 81 Dimension Text Rules ....................................... 82 Surface Finish Symbol Rules ............................. 83 Surface Finish Value Rules ............................... 85 Combining Surface Finish Symbol and Value Rules ................................................................ 87

    COMMON FUNCTIONS ......................................... 88

    DATE AND TIME FUNCTIONS ....................................... 89 HELPER FUNCTIONS .................................................. 98

  • DriveWorks Ltd.

    8

    LOGIC FUNCTIONS .................................................. 101 MATH FUNCTIONS .................................................. 106 TEXT FUNCTIONS .................................................... 126 TABLE FUNCTIONS .................................................. 138 VALIDATION FUNCTIONS .......................................... 145 FILE SYSTEM FUNCTIONS.......................................... 149

    APPENDIX ......................................................... 150

    NetWorkDaysCustom function WeekendValues: ....................................................................... 150 WeekDay function ReturnType values: .......... 151 WeekNum function ReturnType values: ......... 152 WorkDayCustom function Weekend values: .. 153

    INDEX ................................................................ 154

  • www.driveworks.co.uk

    What is a Rule? The dictionary explanation of a rule is:

    rule (noun) [rool]

    1. A principle or regulation governing conduct The rules of chess

    2. The customary or normal circumstance The rule rather than the exception

    3. A prescribed mathematical method for performing a calculation or solving a problem If x is > y, add 200

    When used as a verb, to rule implies exercising controlling authority over somebody or something.

    In this book, we will be discussing rules in the sense of a mathematical method for solving a problem. This type of rule works best when it can be defined in words:

    We use a support if the length of the gantry is greater than 2 metres

    We always have a ¼ inch gap around the door frame, unless the frame is over 4 feet wide, in which case the gap is increased to 5/16th of an inch

    Customers in the USA are invoiced in US dollars; customers in Europe are invoiced in Euros.

  • DriveWorks Ltd.

    10

    Why are Rules good? Rules are a great way of defining the solution to a given problem. Rules allow your knowledge to be captured and transferred in a simple way to others.

    Rules can also be a great way of telling a computer how to work something out. This allows computers to perform mundane tasks that humans undertake day in and day out, allowing us to concentrate on more interesting and important responsibilities.

    If you can put some of your knowledge and intelligence (or rules) into a computer, you can then use that rule to make relevant decisions and actions.

    Rules can work out many things, and be applied in many different scenarios.

    Rules can be based on:

    A mathematical formula

    A conditional or logical statement

    The stringing together of lots of text

    A lookup in a table on a value you have entered

    If you create enough of these rules, then you can automate some of your daily tasks. This is the idea behind DriveWorks. This book aims to help you to understand rules and how they can be used in DriveWorks to automate your SolidWorks® designs.

  • The Little Book of Rules

    11

    Typical Rules Below are some typical rules:

    A typical mathematical formula would be: (34 + 98) x 5

    A logical rule may look something like this: IF(SafeWorkingLoad="500 Kg",200,250)

    Stringing text together (also called Concatenation) might look something like this: OpeningWidth & "wide x" & SafeWorkingLoad &

    "safe working load"

    And a lookup on some data might look like this: VLookup(Customer,CustomerTable,3,False)

  • DriveWorks Ltd.

    12

    What’s in a Rule? A rule, when broken down, is made up of two elements that are separated by an equals sign:

    ModelHeight = (234+987)*34 In English this means that the height of the model is equal to 34 multiplied by the result of adding 234 and 987.

    When we start building a rule we ignore the left hand side, because that is what we are building the rule for. The only part we need to concentrate on is the right hand side – this is what we call "The Rule".

    Note that in the DriveWorksXpress Rule Builder the "=" must be present at the beginning of the rule. In DriveWorks Solo’s Rule Builder the "=" is implied and is not shown.

    The right hand side must be written in a certain form (this is called syntax), as otherwise DriveWorks won’t be able to understand it; much like a mathematical equation. The good news is that DriveWorks’ syntax is easy to work with as it is based on Microsoft Excel’s syntax and many people will have used Excel or be familiar with it.

    Elements of the rule can be fixed values (also called Literals), e.g.

    12 + 345 * 234 Or names that refer to values that are entered, or calculated elsewhere:

    WallGap + OpeningWidth * NumberOfDoors

  • The Little Book of Rules

    13

    Data Types Values in a rule, as well as the result of the rule, have a data type. The data types that are available in a rule are:

    Numbers, e.g. 3, or -4.7

    Text, e.g. "500 Kg"

    Booleans, i.e. TRUE or FALSE

    There is a fourth data type which is the Date/Time, but these are generally entered as Text and are converted to a Date/Time by a Date/Time function.

  • DriveWorks Ltd.

    14

    What can go in a Rule? A rule can be made up of:

    Operators

    Functions

    Literals (e.g. a Number or Text value)

    Names (Which refer to values entered or calculated elsewhere)

    Other Rules

    Operators

    All mathematical operators can be used in a rule. Parentheses can also be used as you would use them in any mathematical formula.

    - subtract + add * multiply / divide () parenthesis ^ power

    Remember to use the asterisk for multiplication (*) and the circumflex for "to the power" – (^) when creating your rules in DriveWorks.

  • The Little Book of Rules

    15

    Functions

    Functions are fantastic and are the real power of rules.

    Functions start with their name; have parentheses, with zero or more arguments in between.

    Different functions have different numbers of arguments, and some functions can have varying amounts of arguments.

    So, a typical function would be: ROUNDUP(345.876,2)

    This function means that it will round up 345.876 to 2 decimal places.

    SUM(234,765,912) This function will add up the three numbers; 234, 765 and 912. Notice that each argument is separated by a comma1.

    Parentheses always surround the arguments, and the function name always goes before the opening parenthesis:

    FunctionName(Argument1,Argument2) The type of value which gets returned depends on the function.

    For instance, the RoundUp function expects two numbers as the arguments, and will give you back (or return) a number.

    However, if you use the Left function, you will need to give it two arguments, one as text and one as a number:

    LEFT("DriveWorks",2) The Left function will return the result "Dr", which is the first two letters of "DriveWorks". 1 On English language installations, the default system separator is the comma. Other languages may use the semi-colon (;) as the system separator.

  • DriveWorks Ltd.

    16

    There is a comprehensive list of functions, what arguments they expect, and what they return in the ‘Common Functions’ section of this book.

    Literals

    A literal is a value which is typed directly into a rule; it could be a Number, Text, or a Boolean.

    Numbers exist in rules to be calculated or to assist a function. 9 + 6

    (4 ^ 4) * (4 + 2) Text is used in rules for things like names of files, or configurations.

    Notice how literal text needs to be encased within speech marks, whereas numbers do not.

    So returning to an earlier rule: IF(SafeWorkingLoad="500 Kg",200,250)

    This is a function with three arguments; the first is comparing the value referred to by a name (SafeWorkingLoad – which isn’t in speech marks) with a literal value ("500 Kg"– which needs to be in speech marks). If the comparison is true, then the function will send back (or return) 200, and if it isn’t (i.e. the comparison is false) then it will return 250.

    Names

    Names are references to values which come from somewhere else. For example, the value that is typed into a textbox, an option that is picked from a list of values, or the result of a variable2.

    2 Variables are available in DriveWorks Solo only.

  • The Little Book of Rules

    17

    You’ve already seen names used in various examples, for example:

    IF(SafeWorkingLoad="500 Kg",200,250) In this example, SafeWorkingLoad is a name which refers to the selected value in an input control which shows a list of values.

    Similar to the way the type of a function’s return value depends on the function, the type of a name depends on the value to which it refers.

    In DriveWorks, names can be used in place of numbers, text, and Booleans, for example:

    OpeningHeight – 345 where OpeningHeight is a name which refers to the result of a textbox. Keep in mind that if you have not entered or calculated a value for the OpeningHeight then it will actually be seen as an empty text string, and so cannot have 345 taken away from it. Input controls in DriveWorks Solo provide many properties (for example Min, Max and Visibility) in addition to the input value. So to get the input value from the control, the term Return is added to the end of the control name, e.g. MyTextBoxReturn.

    DriveWorksXpress only provides the value coming from the input control, so all input controls are referred to by the name applied when they were created, e.g. MyTextBox.

    Other Rules

    A rule can also be nested – that is, it can contain bits of other rules, for example:

    ROUNDUP(OpeningHeight - 34, 3)

  • DriveWorks Ltd.

    18

    In this example, OpeningHeight – 34 is effectively a rule on its own, and the result is used as the first argument of the ROUNDUP function. In the next section, we’ll see another example which chains together IF functions to make decisions.

    Making decisions Making decisions is an essential part of many rules, for example, the rule:

    We use a support if the length of the gantry is greater than 2 metres

    shows one type of decision – a choice between two values. Another type of decision is looking up one value in a table and returning another value on the same row. This section shows you how to make decisions in your DriveWorks rules.

    IF

    The IF function is probably one of the most common rules used. The IF Function checks whether a specified condition has been met, and returns one value if the condition is True and another value if the condition is False.

    Use IF to conduct conditional tests on values and formulas.

    The format of the IF function is as follows; IF(condition , value if condition is TRUE ,

    value if condition is FALSE)

    IF initiates the function.

    Separators divide the condition and the values.

    Using the IF Wizard in DriveWorks allows you to concentrate on building the condition and the values; the wizard takes care of adding the initiating IF, the opening and closing parentheses and the separators.

  • The Little Book of Rules

    19

    Conditions

    Conditions allow you to determine if the User has made a specific selection from a control, or entered a certain number. Conditions can be set to determine when a variable equates to a particular value or is under a certain value. Conditions can evaluate who has logged onto the application. Basically, conditions are arguments that determine if something has happened.

    A condition exists of three elements;

    1. A reference that has a value

    2. A comparison operator

    3. A result to compare to the referenced value

    A condition looks like this: SafeWorkingLoad = "500 Kg" Here, SafeWorkingLoad is a name referring to an input control that can have a range of test values selected from it. This condition asks if the selected value equals 500 Kg.

    Comparison Operators

    The chart below shows the available comparison operators that can be used within a condition:

    Comparison Operator Example

    = equal to SafeWorkingLoad = "500 Kg"

    > greater than Length > 100

    < less than Width < 1000

    >= greater than or equal to Length >= 3000

  • DriveWorks Ltd.

    20

    Values that can be included in a comparison can be Numeric, Boolean or Text.

    Values

    Values determine the result of the IF function. If the condition evaluates to True, the first of the two values is returned. If the condition equates to False, the second value is returned.

    For example, a checkbox named ‘Mycheckbox’ can be selected from the input form. The status of the checkbox (checked or unchecked) determines whether to suppress or unsuppress a captured feature. The rule for the captured feature would look like this:

    IF(MycheckboxReturn=TRUE,"Unsuppress", "Suppress")

    So when the checkbox is checked (i.e. equals TRUE), the feature is to be unsuppressed. When the checkbox is unchecked (i.e. equals FALSE), the feature is to be suppressed.

    Rule building can get a little complicated, especially when you have a rule inside a rule. For instance, a rule can be built within an IF function:

    IF(SafeWorkingLoad="500 Kg",200, IF(SafeWorkingLoad="100 Kg",250,300))

    Here the third argument has been replaced by a complete IF statement that will itself calculate a value based on its condition. There is more about placing IF statements inside other IF statements later on in this book.

  • www.driveworks.co.uk

    Lookup

    Constructing more powerful rules is discussed in the next section. But before embarking on a complex series of IF statements to achieve a result you may want to consider Lookups.

    Consider the following situation. Your user can select from a list of Safe Working Loads (SWL) to specify a lifting gantry. The safe working load selected determines the sectional size of the I-section beam that carries the load. The table below shows the effect the safe working load has on the section depth, width and thickness.

    Now the captured depth of the I-section model could be driven by a rule in the form of a nested IF. And it would look like…

    IF(SWL=100,127,IF(SWL=250,152.4,IF(SWL=400,177.8,IF(SWL=600,203.2,IF(SWL=800,203.2,IF(SWL=

    900,206.8,254))))))

    As you can see, this is getting a little difficult to read.

    However, we could table the data and bring this into the DriveWorks project. This would look like the chart below:

  • DriveWorks Ltd.

    22

    This table has multiple purposes. It will allow us to use the LISTALL2 function to present the SWL column into a list control for selection by the user. It also contains all the other data that the SWL selection affects.

    So we can now use the VLOOKUP function to select the required I-section beam depth, as below: VLOOKUP(SWLReturn,DWLookupBeamData,2,FALSE)

    What this function is actually saying is; look for the SWL selected by our user (SWLReturn) in the table brought into DriveWorks (DWLookupBeamData) and when an exact match is found (FALSE) return the value from the corresponding Depth column (2). The ‘V’ in VLookup means vertical, so the search takes place vertically, i.e. down the left most column.

    VLookup is limited by the way your table of data is constructed in that the values to be searched for must be in the first column.

    DriveWorks Solo provides a built in function to overcome this limitation - DWVLOOKUP, where the search value can exist in any column, and the value returned can be any other column to the left or right of this. DWVLOOKUP is discussed in a later section of this book.

  • The Little Book of Rules

    23

    Concatenate or Join text, values and functions Two options are available when strings of text, values or formulae need to be joined.

    First of all the function ‘Concatenate’ can be used. This looks like this:

    Concatenate(Length,"long") Secondly using the ampersand symbol (&) will achieve the same result. This looks like this:

    Length & "long" Which one you use depends on your preference.

    Speech Marks Using speech marks (""), you can determine which part of a rule is plain text and which is a form control or variable:

    OpeningHeight & "wide" This would result in the following for an OpeningHeight of 4 inches:

    4 wide You may, however, want to include a double speech mark for the inches, so the rule would be:

    OpeningHeight & """ wide" The result would now be:

    4" wide Notice that there are three speech marks together before the word ‘wide’, as the double speech marks denote inches and these must be included within a set of speech marks to ensure they are shown in the return result.

  • DriveWorks Ltd.

    24

    Parentheses Just like in any mathematical formula, the use of parentheses -() - helps define which parts of the rule are calculated in which order:

    (12+345) * 234 The above formula has a different result to this one:

    12 + 345 * 234 Parentheses are also required around function arguments:

    SUM(123,132,322)

  • The Little Book of Rules

    25

    Advanced Rules The rules covered so far should be sufficient to control parameters in most circumstances. However more complex situations may require a rule to have more depth. This section explains how rules can be nested to achieve a single result from many possible combinations.

    Nested IF statement The IF statement is a rule that is commonly nested. To understand how to nest IF it is crucial that the basic IF statement is understood. To recap on the earlier IF section:

    The basic IF statement comprises a condition, a value when true and a value when false. It appears in the following format:

    IF(condition,value if condition is TRUE, value if condition is FALSE)

    IF initiates the function. Separators divide the condition and the values. The condition and values are encased within open and close parenthesis.

    Nesting IF requires the basic structure to be maintained while embedding an identically structured argument. This means the original parenthesis and separators need to remain. The embedded argument will replace either the ‘value when true’ or the ‘value when false’ portions of the original statement.

    The example below shows Nesting IF statements to four levels deep:

    IF(WindowType="None","Suppress", IF(WindowType="Round","Suppress" ,

    IF(WindowType="Crescent","Suppress", IF(WindowType="Square","Unsuppress" ,

    "Suppress") ) ) )

  • DriveWorks Ltd.

    26

    Here we can see the original IF statement (normal font), with the ‘value when false’ being replaced with a second IF statement (bold font), and the ‘value when false’ of that level being replaced with a third IF statement (italic font).This goes even deeper with a fourth IF statement (bold and italic font) replacing the ‘value when false’ portion of the third IF statement (second largest font).

    How the nested IF is evaluated is shown in the diagram below:

  • The Little Book of Rules

    27

    To give this example further explanation, WindowType is an input control from which the values None, Round, Crescent, Square and Triangular can be selected. This rule is built for a captured feature that represents the Square selection. Starting from the left of the nested IF statement, the first condition is evaluated, if the user had selected None from the WindowType control, the feature would be suppressed. If None had not been selected the next condition would come into play.

    The next condition (does WindowType equal Round?) gets evaluated in the same way, with the same outcome. This pattern goes on until a valid outcome is obtained.

    You will note that Triangular could have been selected from the WindowType control, and that no condition exists in the nested IF statement to take this into consideration. This is because the outcome when the last condition is false allows for the Triangular selection. When nesting IF statements it is important to ensure any conditions take into account the flow of the evaluation.

    For instance, if nested conditions used the less than (

  • DriveWorks Ltd.

    28

    If this was constructed with the largest value first as below: IF(MyValue

  • The Little Book of Rules

    29

    Next the result of the MAX function is required to be rounded up to 4 decimal places so the function:

    ROUNDUP(number,4) is used.

    So now we can nest the first function in place of the number argument in the second function, like so: ROUNDUP(MAX (Width, Height, Depth)*1000, 4)

    Also, nesting the OR function within an IF statement can simplify a potentially complex statement. If any of the conditions are true the OR function returns true, otherwise it will return false. For example:

    OR (WindowType="None",WindowType="Round",WindowT

    ype="Crescent")

    If the user selects either None, Round or Crescent from the WindowType selection the OR function will return true. So to nest this into an IF function, we replace the condition portion of the IF, so:

    IF(condition,"Suppress","Unsuppress")

    Becomes… IF(OR

    (WindowType="None",WindowType="Round",WindowType="Crescent"), "Suppress" , "Unsuppress")

    Exactly the same can be applied with the AND function. This time all of the arguments within the AND function must be true. IF(AND(WindowType="None",WindowType="Round",W

    indowType="Crescent"), "Suppress" , "Unsuppress")

  • DriveWorks Ltd.

    30

    Combining functions is used when the result of one function needs applying to the result of another function.

    Consider this LEFT(CompanyReturn,3) & ROUND(LengthReturn,0) & VLOOKUP(BracketType,BracketCodes,2,FALSE)

    This formula is used to create a unique part number for a bracket that is produced by DriveWorks. Here we are calculating the first 3 letters of the entered company name:

    LEFT(CompanyReturn,3)

    And then combining the calculated size which is rounded to zero decimal places:

    & ROUND(LengthReturn,0)

    And then appending a code selected from a table of codes: & VLOOKUP(BracketType, BracketCodes,2,FALSE)

    So we end up with DRI 238 CX03 (spaces are shown to separate the results of the 3 combined functions).

  • The Little Book of Rules

    31

    Types of Rule Rules define the outcome of a parameter.

    Rules don’t need to be an elaborate equation or an involved function. A fixed value defines the behavior of a parameter just as much as a dynamic calculation.

    In DriveWorks a rule is anything applied to a parameter or property that drives the required outputs or behavior of the user interface.

    Rules in DriveWorksXpress are limited to parameters captured from the models being driven. DriveWorks Solo can drive model parameters more extensively, and also control drawings and documents. DriveWorks Solo also allows rules to be applied to control user form behavior (form navigation) and the inputs added to each user form.

    When using the value from a user form input value in a rule, DriveWorksXpress will refer to it by name, while DriveWorks Solo will suffix the name with the word Return. For example a user form input called Length will be LengthReturn (see page 17 for more details).

    Note

    In all of the following examples, where an input control is referred to, we have used the DriveWorks Solo name (i.e. suffixed with Return). When applying an example in DriveWorksXpress do not use this suffix for a control name.

  • DriveWorks Ltd.

    32

    Input Control List Rules The Items property of an input control of a ComboBox, or other list controls determines the items shown in the list. This property is always driven by a rule, so we need a way to create a list of values in a rule.

    The pipe bar (|) is a special character used by DriveWorks to separate lists of data. For example:

    "One | Two | Three" And using the ampersand can help you to combine values from other inputs or variables into a single list:

    FirstInput & "|" & SecondInput & "|" & ThirdInput

    File Name Rules The file name parameter is used to determine the name of the driven model, or, in the case of a subassembly or part, to delete it or control its suppression state or visibility in the parent assembly.

    Unique naming

    The top level component always requires a unique name, or nothing will be generated.

    Examples:

    Include an input field on the user form, where a unique number or code can be entered. Use this in the rule for the file name:

  • The Little Book of Rules

    33

    Rule Meaning

    OrderNumberReturn Will append the value entered in the OrderNumber input to the master file name for automatically created file.

    "*" & OrderNumberReturn

    Creates a model with its file name set to the value entered in the OrderNumber input.

    "*" & OrderNumberReturn & "*"

    Creates a model with its file name set to its original name, prefixed with the value entered in the OrderNumber input.

    Tip: If using DriveWorks Solo you can ensure data entered in the input field is valid for a file name by using the IsValidFileNameResult function on the Error Result property of the control as below:

    Rule Meaning

    IF( IsValidFileNameResult( OrderNumberReturn) =FALSE , "Invalid Characters Entered for Order Number!","")

    Will check the value entered in the OrderNumber input for illegal characters. If no illegal characters exists (=FALSE) the message "Invalid Characters Entered for the Order Number" in the task list during specification.

  • www.driveworks.co.uk

    Or make use of the inbuilt auto-number:

    Rule Meaning

    DWSpecificationId Will append the DriveWorks Solo auto-number to the master file name for the automatically created file.

    Intelligent naming

    Using an intelligent naming convention means that DriveWorks will recognize components that have previously been built and will re-use them when it comes across the name again.

    Examples:

    Use the input fields that affect the component to build up a string of values:

    Rule Meaning

    HeightReturn & WidthReturn & LengthReturn

    Will append the result of the input controls Height, Width and Length to the master file name for the automatically created file. For example, when Height is 55, Width is 33 and Length is 66, the value 553366 will be appended.

  • www.driveworks.co.uk

    TIP: Include text in between numeric input fields to indicate what the number signifies:

    Rule Meaning

    HeightReturn & " High x " & WidthReturn & " Wide x " & LengthReturn & " Long"

    Will append the result of the input controls Height, Width and Length to the master file name for the automatically created file. Each value will be separated with the corresponding text. For example, when Height is 55, Width is 33 and Length is 66, the value 55 High x 33 Wide x 66 Long will be appended.

    Remove Master File Name

    Making use of the wildcard or asterisk symbol * on a file name rule will remove the original file name.

    Example:

    Rule Meaning

    "*" & OrderNumberReturn

    Will use the value entered in the OrderNumber input as the file name for automatically created file.

    Move Master File Name to the End

    Using this at the end of the rule will add the original file name after the result of the rule:

    Rule Meaning

    "*" & OrderNumberReturn & "*"

    Will prefix the master file name with the value entered in the OrderNumber input for the automatically created file.

  • DriveWorks Ltd.

    36

    Deleting or suppressing components

    Components can be deleted or suppressed in the resulting assembly, typically by using the IF function in a rule on the File Name parameter of the component.

    Rule Meaning

    IF( LengthReturn < 1000 , "Delete" , "Unsuppress" )

    Will delete the file the rule is applied to when the value entered in the Length control is less than 1000.

    IF( LengthReturn < 1000 , "Suppress" , "Unsuppress" )

    Will suppress the file the rule is applied to when the value entered in the Length control is less than 1000.

    If a new version of the component is required the File Name parameter will need to result in a suitable value to apply to the file name:

    Rule Meaning

    IF( Length < 1000 , "Delete" , OrderNumberReturn)

    Will delete the file the rule is applied to when the value entered in the Length control is less than 1000, otherwise the value entered in the OrderNumber input will be appended to the master file name.

    IF( Length < 1000 , "Delete" , "*" & OrderNumberReturn)

    Will delete the file the rule is applied to when the value entered in the Length control is less than 1000, otherwise the value entered in the OrderNumber input will be used as the file name of the model.

  • www.driveworks.co.uk

    Replacing components

    A model can be replaced with a model that exists in the same location as the model it is replacing. Make the File Name result equal the name of the model to swap in.

    The models being replaced must match, i.e. a part for a part.

    Examples:

    Rule Meaning

    "M5x20 hex hd bolt" Will replace the file the rule is applied to with a file named M5x20 hex hd bolt. The file must exist in the same location as the file being replaced.

    IF( SheetThicknessReturn > 3 , "M5x20 hex hd bolt" , OrderNumber )

    When the input SheetThickness is greater than 3 it will replace the file the rule is applied to with a file named M5x20 hex hd bolt. This must exist in the same location as the file being replaced, otherwise a new file will be created using the OrderNumber input value as the file name.

  • www.driveworks.co.uk

    Replacing driven components

    A model that is being replaced into a new assembly can also have captured parameters driven.

    DriveWorks Solo uses its own directive along with the master name of the model. This avoids having to apply the resulting name of the driven model.

    Rule Meaning

    "Part B" Will replace the model the rule is applied to with the model created from the model named Part B

    IF( DoorStyleReturn = "Flat" , "Cupboard Right Door" , IF( DoorStyleReturn = "Glass" , "Cupboard Right Door Framed" , DWSpecificationID ) )

    When the input value of DoorStyle is not “Flat” or “Glass” the model, the rule is applied to, will be created with the DWSpecificationID.

    When the input value of DoorStyle is “Flat” the model will be replaced with the model Cupboard Right Door.

    When the input value of DoorStyle is “Glass” the model will be replaced with the model Cupboard Right Door Framed model

  • The Little Book of Rules

    39

    Relative Path Rules The relative path parameter determines the folder each new model will be stored in.

    The term Relative refers to a location relative to where the DriveWorks Solo project is stored.

    If the result of the relative path rule does not exist, DriveWorks will create the folder.

    Relative

    To place the new model in a sub folder, named Results, of the location the project is stored:

    Rule Meaning

    ""

    Or left blank

    Will place the new model in a folder named ProjectLocation\Results.

    ProjectLocation is the location of the project file (ProjectName.driveproj)

  • DriveWorks Ltd.

    40

    To place the new model in a sub folder of the Results folder, relative to the project location, using a special variable to name the folder, see the following examples:

    Rule Meaning

    DWSpecificationID Will place the new model in a folder named ProjectLocation\Results\1234.

    ProjectLocation is the location of the project file (ProjectName.driveproj). 1234 is the auto-number assigned by DriveWorks.

    OrderNumberReturn

    Will place the new model in a folder named according to the value entered in the OrderNumber input in the location ProjectLocation\Results\

    ProjectLocation is the location of the project file (ProjectName.driveproj).

    Absolute

    When the model is not required to be within the Results folder an absolute path can be used:

    Rule Meaning

    "\\dataserver\models"

    Will place the model in the folder \models on the data server machine

    "C:\models\parts"

    Will place the model in the folder \models\parts on the C: of the local machine

  • The Little Book of Rules

    41

    Configuration Rules When configurations exist in the master model being driven, they can be switched in the resulting model.

    The result of the rule should be the name of the existing configuration required to be used:

    Rule Meaning

    "Section A" Switches the configuration to Section A.

    Delete unused configurations

    Using the wildcard or asterisk * symbol in the resulting configuration rule will delete all other configurations from the new model and any associated design table if present:

    Rule Meaning

    "*Section A" Switches the configuration to Section A, and deletes all unused configurations.

  • DriveWorks Ltd.

    42

    Dimension Rules

    Linear Dimensions

    A captured dimension will have a rule applied that results in a numeric value. DriveWorks recommends driving dimensions to positive numbers to avoid sketch defining issues. Dimensions are driven in model units.

    Rule Meaning

    12 Will always drive the parameter the rule is applied to a value of 12

    (WidthReturn-(2*5)-89)/2

    Will always drive the parameter the rule is applied to the result of the value of the equation, factoring in the value coming from the Width input.

    (WidthReturn-(2*DWVariableClearance)-DWVariableFrameAllowance)/2

    Will always drive the parameter the rule is applied to the result of the value of the equation, factoring in the values coming from the Width input and the Clearance and FrameAllowance variables.

  • www.driveworks.co.uk

    Angles

    A captured angular dimension will have a rule applied that results in a numeric value in degrees:

    Rule Meaning

    AngleReturn Will always drive the parameter the rule is applied to the value coming from the Angle input.

    TAND(AngleReturn) / 2

    Will always drive the parameter the rule is applied to the Tangent of the value coming from the Angle input, divided by 2.

    Patterns

    Patterns can have the following basic parameters captured:

    Spacing (Pitch) – Linear Patterns

    Angle – Circular Patterns

    Number of instances (Quantity) – Linear and Circular Patterns

    The captured spacing will have a rule applied that results in a numeric value:

    Rule Meaning

    LengthReturn - (2 * DWVariableDistFromEnd ) / (DWVariableInstances-1)

    Will always drive the parameter the rule is applied to the result of the equation.

  • DriveWorks Ltd.

    44

    The captured angle will have a rule applied that results in a numeric value in degrees.

    Rule Meaning

    TAND(Angle) / Adjacent

    Will always drive the parameter the rule is applied to the Tangent of the value coming from the Angle input, divided by 2.

    The captured number of instances will have a rule applied that results in a whole number:

    Rule Meaning

    ROUNDUP(( LengthReturn-(2* DWVariableDistFromEnd ) ) /DWVariablePitch , 0 )

    Will always drive the parameter the rule is applied to the result of the equation, factoring in the values coming from the Length input and the DistFromEnd and Pitch variables.

  • www.driveworks.co.uk

    Tolerances

    Captured dimensions can also have tolerances driven.

    When controlling the tolerance of a captured dimension the format of the output rule is:

    NominalValue|LowerLimit|UpperLimit|Type

    Where:

    NominalValue - is the nominal dimension to be applied to the parameter (in the SolidWorks document units)

    LowerLimit - is the lower limit for the tolerance (in meters - SolidWorks system units)

    UpperLimit - is the upper limit for the tolerance (in meters - SolidWorks system units)

    Type - is an index number for the type of tolerance to be applied - see chart below:

    Type of Tolerance Index Number

    Basic 1

    Bilateral 2

    Limit 3

    Symmetric 4

    MIN 5

    MAX 6

    Fit 7

    Fit with tolerance 8

    Fit tolerance only 9

  • DriveWorks Ltd.

    46

    Rule Meaning

    25 & "|"& -0.002 &"|"& 0.001 &"|"& 2

    Will always drive the parameter the rule is applied to a nominal value of 25 with a bi-lateral tolerance applied with a lower limit of -0.002 and an upper limit of 0.001

    NominalDiameterReturn & "|" & DWVariableLowerLimit * (25.4/1000) & "|" & DWVariableUpperLimit * (25.4/1000)&"|"& 3

    Will always drive the parameter the rule is applied to the value coming from the input NominalDiameter with a limit tolerance applied that has the lower and upper limits driven to the equations defined in the rule.

  • The Little Book of Rules

    47

    Feature Rules Feature rules control the state of a feature, i.e. suppressed, unsuppressed, or deleted.

    Rule Meaning

    TRUE Unsuppresses the feature.

    You could also use "Unsuppress" (in quotes), or "U" (in quotes).

    FALSE Suppresses the feature.

    You could also use "Suppress" (in quotes), or "S" (in quotes).

    "DELETE" Deletes the feature.

    IF(LengthReturn < 1000 , "Suppress", "Unsuppress")

    Suppresses the feature when the value in the Length input is less than 1000. Otherwise the feature will be unsuppressed.

  • DriveWorks Ltd.

    48

    Advanced Feature Rules Most features also have advanced parameters that can be controlled by DriveWorks Solo only.

    The most common types of advanced parameter available are listed in this section.

    Advanced Base Extrude and Base Extrude Thin Parameters

    The following advanced feature parameters are available for the base extrude feature:

    BothDirections

    Rule Meaning

    TRUE Will extrude the base feature in direction 1 and direction 2.

    FALSE Will extrude the base feature in direction 1 only.

    D1Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

  • www.driveworks.co.uk

    D1DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 1 to 15 degrees.

    D1ApplyDraft

    Rule Meaning

    True Applies draft in direction 1.

    False Will not apply draft to direction 1.

    D1DraftOutward

    Rule Meaning

    TRUE Applies outward draft to the extrusion.

    FALSE Applies inward draft to the extrusion.

    D2Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 2 to the value coming from the Length input.

  • DriveWorks Ltd.

    50

    D2DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 2 to 15 degrees.

    D2ApplyDraft

    Rule Meaning

    TRUE Applies draft in direction 2.

    FALSE Will not apply draft to direction 2.

    D2DraftOutward

    Rule Meaning

    TRUE Applies outward draft to the extrusion.

    FALSE Applies inward draft to the extrusion.

  • The Little Book of Rules

    51

    Advanced Boss Extrude Parameters

    BothDirections

    Rule Meaning

    TRUE Will extrude the base feature in direction 1 and direction 2.

    FALSE Will extrude the base feature in direction 1 only.

    D1Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    D1DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 1 to 15 degrees.

  • DriveWorks Ltd.

    52

    D2Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 2 to the value coming from the Length input.

    D2DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 2 to 15 degrees.

  • The Little Book of Rules

    53

    Advanced Boss Extrude Thin Parameters

    BothDirections

    Rule Meaning

    TRUE Will extrude the base feature in direction 1 and direction 2.

    FALSE Will extrude the base feature in direction 1 only.

    D1Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    D1DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 1 to 15 degrees.

  • DriveWorks Ltd.

    54

    D1WallThickness

    Rule Meaning

    IF( MaterialReturn = "Stainless Steel" , 1.6 , 1.5 )

    Sets the Wall thickness for the extrusion in direction 1 to the value calculated by the rule.

    D2Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 2 to the value coming from the Length input.

    D2DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 2 to 15 degrees.

    D2WallThickness

    Rule Meaning

    IF( MaterialReturn = "Stainless Steel" , 1.6 , 1.5 )

    Sets the Wall thickness for the extrusion in direction 2 to the value calculated by the rule.

  • The Little Book of Rules

    55

    ThinWallType

    Rule Meaning

    "OneDirection" Sets the Thin wall type for the feature to be one direction.

    "OneDirectionReverse" Sets the Thin wall type for the feature to be the reverse one direction.

    "MidPlane" Sets the Thin wall type for the feature to be mid plane.

    "TwoDirection" Sets the Thin wall type for the feature to be two directions.

  • DriveWorks Ltd.

    56

    Advanced Cut Extrude parameters

    D1Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    D1DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 1 to 15 degrees.

    D1ApplyDraft

    Rule Meaning

    TRUE Will apply draft to the extrusion in Direction 1.

    FALSE Will not apply draft to the extrusion in Direction 1.

  • The Little Book of Rules

    57

    D1DraftOutward

    Rule Meaning

    TRUE Will apply Draft outwardly in direction 1.

    FALSE Will apply Draft inwardly in direction 1.

    BothDirections

    Rule Meaning

    TRUE Sets the extrusion in both directions.

    FALSE Sets the extrusion in the D1 direction only.

    D2Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 2 to the value coming from the Length input.

  • DriveWorks Ltd.

    58

    D2DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 1 to 15 degrees.

    D2ApplyDraft

    Rule Meaning

    TRUE Will apply draft to the extrusion in Direction 1.

    FALSE Will not apply draft to the extrusion in Direction 1.

    D2DraftOutward

    Rule Meaning

    TRUE Will apply Draft outwardly in direction 2.

    FALSE Will apply Draft inwardly in direction 2.

  • The Little Book of Rules

    59

    Advanced Cut Extrude Thin parameters

    D1Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    D1DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 1 to 15 degrees.

    D1WallThickness

    Rule Meaning

    2 Sets the wall thickness for the extrusion in direction 1 to 2.

  • DriveWorks Ltd.

    60

    BothDirections

    Rule Meaning

    TRUE Sets the extrusion in both directions.

    FALSE Sets the extrusion in the D1 direction only.

    D2Depth

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 2 to the value coming from the Length input.

    D2DraftAngle

    Rule Meaning

    15 Sets the draft angle for the extrusion in direction 2 to 15 degrees.

    D2WallThickness

    Rule Meaning

    2 Sets the wall thickness for the extrusion in direction 2 to 2.

  • The Little Book of Rules

    61

    ThinWallType

    Rule Meaning

    "OneDirection" Sets the Thin wall type for the feature to be one direction.

    "OneDirectionReverse" Sets the Thin wall type for the feature to be the reverse one direction.

    "MidPlane" Sets the Thin wall type for the feature to be mid plane.

    "TwoDirection" Sets the Thin wall type for the feature to be two directions.

  • DriveWorks Ltd.

    62

    Advanced Chamfer parameters

    Type

    Rule Meaning

    "AngleDistance" Sets the chamfer type to angle and distance inputs.

    " DistanceDistance" Sets the chamfer type to distance and distance inputs.

    " Vertex" Sets the chamfer type to vertex inputs.

    TangentPropagation

    Rule Meaning

    TRUE Set the Tangent Propagation property of the Chamfer.

    KeepFeatures

    Rule Meaning

    TRUE Set the Keep Features property of the Chamfer

  • The Little Book of Rules

    63

    EqualDistance

    Rule Meaning

    TRUE Set the Equal Distance Of the Chamfer.

    EdgeChamferAngle

    Rule Meaning

    45 Sets the angle of the chamfer to 45.

    EdgeDistance1

    Rule Meaning

    5 Sets the edge distance in direction 1 to be 5.

    EdgeDistance2

    Rule Meaning

    10 Sets the edge distance in direction 1 to be 10.

  • DriveWorks Ltd.

    64

    Advanced Fillet parameters

    DefaultRadius

    Rule Meaning

    LengthReturn Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    KeepFeatures

    Rule Meaning

    TRUE Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    PropagateToTangentFaces

    Rule Meaning

    TRUE Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

  • www.driveworks.co.uk

    RoundCorners

    Rule Meaning

    TRUE Sets the Depth for the extrusion in direction 1 to the value coming from the Length input.

    OverflowType

    Rule Meaning

    "Default" Sets the overflow fillet type to default.

    "KeepEdge" Sets the overflow fillet type to keep edge.

    "KeepSurface"

    Sets the overflow fillet type to keep surface.

  • DriveWorks Ltd.

    66

    Advanced Text parameters

    Text controls the text in the sketch if present.

    Rule Meaning

    "Designed By " & DrawnByReturn

    Sets the sketch text to be Designed By and the value coming from the DrawnBy input.

  • The Little Book of Rules

    67

    Custom Property Rules Custom property rules control the text written into a custom property.

    Rule Meaning

    Today() Will write the current date into the custom property.

    DrawnByReturn Will write the result of the input DrawnBy into the custom property.

    Driving the Color

    To drive the color of a model, first create and then capture a custom property named DWColor. The result of the rule for this property should return the required RGB value in the format:

    RedValue | GreenValue | BlueValue

    Note that each value is separated with the pipe (|) symbol.

  • DriveWorks Ltd.

    68

    Rule Meaning

    "0|0|255" Will write the value 0|0|255 into the custom property. The color of the model will be driven to the RGB equivalent of this value when applied to a custom property named DWColor.

    RedReturn & "|" & GreenReturn & "|" & BlueReturn

    Will write the result of the inputs Red, Green and Blue into the custom property.

    Color( 0 , 0 , 255 ) The Color function will write the value 0|0|255 into the custom property. The color of the model will be driven to the RGB equivalent of this. Value when applied to a custom property named DWColor.

    Color(RedReturn , GreenReturn , BlueReturn)

    Will write the result of the inputs Red, Green and Blue into the custom property.

  • The Little Book of Rules

    69

    Driving the Material

    Capture a custom property named DWMaterial. The result of the rule for this property should return a string in the following format:

    MaterialDatabaseName | MaterialName

    Rule Meaning

    " SolidWorks Materials|Alloy Steel"

    Will write the value SolidWorks Materials|Alloy Steel to the custom property. The material will be driven to this value when applied to a custom property named DWMaterial

    " SolidWorks Materials|" & MaterialReturn

    Will write the value SolidWorks Materials|and the value coming from the input Material to the custom property.

  • DriveWorks Ltd.

    70

    Driving the Texture

    Capture a custom property named DWTexture. The result of the rule for this property should return a string in the following format:

    PathToTextureBitmap | ScalePercentage | AngleInDegrees

    Rule Meaning

    "\\Data\ Textures\ Plastic.jpg|0.45|90"

    Will write the value \\Data\Textures\Plastic.jpg|0.45|90 to the custom property. The texture will be driven to this value when applied to a custom property named DWTexture.

    DWVariablePath & TextureReturn & ".jpg |" & 0.45 & "|" & 90

    Will write the value calculated by the variable Path (combined with the value of the Texture input and .jpg) to the custom property.

  • The Little Book of Rules

    71

    Instance Rules The instance rule is used to determine the suppression state, as well as delete or replace the instance or change the configuration of an instance of a part or sub-assembly in an assembly.

    An instance can have its state changed and configuration switched by using the following format:

    State Operation | Configuration Name

    Rule Meaning

    TRUE Unsuppresses the instance. You could also use "Unsuppress" (in quotes), or "U" (in quotes).

    FALSE Suppresses the instance. You could also use "Suppress" (in quotes), or "S" (in quotes).

    "DELETE" Deletes the instance from its parent assembly.

    "Red" The configuration of the instance is switched to red.

    " MyComponentSetName"

    Replaces the instance with a component set called MyComponentSetName.

    "U|Red" Will unsuppress the instance and switch it’s configuration to Red.

  • DriveWorks Ltd.

    72

    " MyComponentSetName | Red "

    Replaces the instance with a component set called MyComponentSetName and switches the configuration of the replacement file to Red.

  • The Little Book of Rules

    73

    Drawing Rules

    File Name Rule

    The file name rule is used to determine the name of the driven drawing.

    Rule Meaning

    "Delete" Prevents the drawing from being generated.

    DWSpecificationId Creates a drawing with its file name set to be its original file name, suffixed with the specification number. Eg: "Block.slddrw" would become "Block 1.slddrw" if it was generated by the first specification.

    "*" & DWSpecificationId Creates a drawing with its file name set to be the specification number. Eg: "Block.slddrw" would become "1.slddrw" if it was generated by the first specification.

    "*" & DWSpecificationId & "*"

    Creates a drawing with its file name set to its original name, prefixed with the specification number. Eg: "Block.slddrw" would become "1 Block.slddrw" if it was generated by the first specification.

  • DriveWorks Ltd.

    74

    Relative Path Rule

    The relative path rule controls the folder that the drawing is created in. The folder is specified relative to the "Results" folder which is in the same folder as the project file.

    Rule Meaning

    "" If the project is located at "C:\DriveWorks Pro\My Cupboard\My Cupboard.driveproj" then the driven drawing will be created in "C:\DriveWorks Pro\My Cupboard\Results\".

    DWSpecificationId If the project is located at "C:\DriveWorks Pro\My Cupboard\My Cupboard.driveproj" and the specification number is 56 then the driven drawing will be created in "C:\DriveWorks Pro\My Cupboard\Results\56\".

    " \\dataserver\ models\cupboards"

    The driven drawing will be created in \\dataserver\models \cupboards.

  • The Little Book of Rules

    75

    Layer State Rule

    Layer state rules are used to control the visibility of a layer.

    Rule Meaning

    TRUE Shows the layer.

    You could also use "Show" (in quotes).

    FALSE Hides the layer.

    You could also use "Hide".

    Sheet State

    Sheet state rules are used to delete or rename sheets.

    Rule Meaning

    "" Leaves the sheet as it is.

    TRUE Leaves the sheet as it is.

    FALSE Deletes the sheet.

    You could also use "Delete" (in quotes).

    "PDF" Renames the sheet to be "PDF".

  • DriveWorks Ltd.

    76

    Sheet Scale Numerator and Denominator Rules

    Sheet numerator and denominator rules are used to control the scale of the sheet.

    Rule Meaning

    Scale Numerator = 1

    Scale Denominator = 2

    Will set the scale of the sheet to be 1:2

    Scale Numerator = IF(HeightReturn

  • www.driveworks.co.uk

    View State Rules

    View state rules are used to delete or change the configuration of a view.

    Rule Meaning

    "" Leaves the view as it is.

    TRUE Leaves the view as it is.

    FALSE Deletes the view.

    You could also use "Delete" (in quotes).

    "Red" Changes the view to show the "Red" configuration of the referenced model.

  • www.driveworks.co.uk

    View Scale Numerator and Denominator Rules

    View numerator and denominator rules are used to control the scale of the view.

    Rule Meaning

    Scale Numerator = 1

    Scale Denominator = 2

    Will set the scale of the view to be 1:2.

    Scale Numerator = IF(HeightReturn

  • www.driveworks.co.uk

    View Left and Top (Position) Rules

    View left and top rules are used to control the position of the view relative to the bottom left of the sheet.

    Rule Meaning

    View Left = 20

    View Top = 250

    Sets the left position 20 units from the left and 250 units from the bottom.

    View Left = DWVariableLeft

    View Top = DWVariableTop

    Sets the left position to the value calculated by DWVariableLeft from the left and the value calculated by DWVariableTop units from the bottom.

    View Left = IF( LengthReturn < 2000,20,40)

    View Top = IF( HeightReturn < 1000,250,350)

    Sets the left position 20 units from the left, when the Length is less than 2000 and 250 units from the bottom when the Height is less than 1000.

  • DriveWorks Ltd.

    80

    Breakline Rules

    Breakline rules are used to control the position of the breaklines relative to the left and right of the view.

    The Distance 1 reference is to the first breakline from the left of the view edge. The Distance 2 reference is to the second breakline from the right of the view edge.

    Rule Meaning

    Distance 1 = 15

    Distance 2 = 35

    Sets the first breakline 15 document units from the left of the view, and the second breakline 35 document units from the right of the view.

    Distance 1 = DWVariableBreakLeft

    Distance 2 = DWVariableBreakRight

    Sets the first breakline to the value calculated by DWVariableBreakLeft from the left of the view, and the second breakline to the value calculated by DWVariableBreakRight from the right of the view.

    Distance 1 = IF(LengthReturn

  • The Little Book of Rules

    81

    Drawing Custom Property Rules

    Custom property rules control the text of a custom property in a drawing.

    Rule Meaning

    CustomerReturn Results in the custom property being set to the value the user typed into the input Customer.

    DrawnByReturn Will write the result of the input DrawnBy into the custom property.

    Annotation Rules

    The Annotation Note rule simply requires the result to be the text required in the captured note.

    There are many uses for driving notes, typically for populating the text required in drawing title blocks. The example below gives some idea of how to build rules to drive notes.

    Rule Meaning

    "Total Quantity = " & QuantityReturn

    Sets the note to be Total Quantity = 5 (when the value in the form control QuantityReturn is 5)

  • DriveWorks Ltd.

    82

    Dimension Text Rules

    The text displayed around a dimension (either reference or model item dimension) in a drawing view can be controlled by DriveWorks.

    SETTEXT([TextPosition],[Text]) Where TextPosition is an index number representing the position to place the text where:

    1 = Places text to the left of the display dimension

    2 = Places text to the right of the display dimension

    3 = Places text above the display dimension

    4 = Places text below the display dimension

    5 = Replaces all text in the display dimension with the string

    Text is a number or text to insert in that position.

    Rule Meaning

    "SetText(2,OAll Length)" Places the text OAll Length after the display dimension.

    "SetText(4,Reference Only)"

    Places the text Reference Only below the display dimension.

  • The Little Book of Rules

    83

    Surface Finish Symbol Rules

    A surface finish symbol rule consists of separate functions to control individual elements of the surface finish (SF) symbol. The functions can be used individually, to control just that element of the SF Symbol, or together to control the whole of the SF Symbol. When used together the functions are separated using the pipe bar (|).

    SETSYMBOL([SymbolIndexNumber], [SurfaceTextureIndexNumber],[AllAround]) Where:

    SymbolIndexNumber is the index number of the required symbol (see chart below).

    SurfaceTextureIndexNumber is the index number of the required texture symbol (see chart below).

    AllAround is either True or False (see chart below).

  • DriveWorks Ltd.

    84

  • The Little Book of Rules

    85

    Rule Meaning

    "SetSymbol (2,0,True)" Results in the Machining Prohibited, All Around symbol being used.

    "SetSymbol(" & DWVariableSymbolNumber & "," & DWVariableTextureNumber & "," & "False)"

    Results in Machining Prohibited, Local symbol being used, when the results of the variables used are 2 and 0 respectively.

    "SetSymbol(" & DWVariableSFString & ")"

    Results in Machining Prohibited, Local symbol being used, when the result of the variable, DWVariableSFString, is the string ,2,0,False

    Surface Finish Value Rules

    SETTEXT([PositionIndexNumber],[Text]) Where:

    PositionIndexNumber is the index number for the required position of the value to display (see chart below).

    Text is the value to display.

  • DriveWorks Ltd.

    86

  • The Little Book of Rules

    87

    Rule Meaning

    "SetText (5,6.3)|SetText (6,1.6)"

    Sets the Rmax value to be 6.3 and the Ra value to be 1.6

    "SetText(5," & DWVariableRmax & ")|SetText (6," & DWVariableRa & ")"

    Sets the Rmax value to be the result of the variable DWVariableRmax, and the Ra value to be the result of the variable DWVariableRa

    Combining Surface Finish Symbol and Value Rules

    Surface Finish Symbol and Values are combine by separating the Symbol and Value syntax with the pipe bar (|) symbol.

    Rule Meaning

    "SetSymbol(" & DWVariableSFString & ")|SetText(5," & DWVariableRmax & ")|SetText(6," & DWVariableRa & ")"

    Results in Machining Required, Local symbol being used, when the result of the variable, DWVariableSFString, is the string ,1,0,False.

    Also sets the Rmax value to be the result of the variable DWVariableRmax, and the Ra value to be the result of the variable DWVariableRa

  • DriveWorks Ltd.

    88

    Common Functions There are hundreds of different functions that can be used within the rules you build using DriveWorks. This chapter will cover the most common ones, examples of how they can be used and their correct syntax.

    Please note:

    Value can be a static number or a variable

    Number is a number, or a reference to a number. A reference can be a variable, such as DWVariableNumber, or the result of a form selection, such as SpinBoxReturn.

    Text is a string of text or reference to some text. A reference can be a variable, such as DWVariableText, or the result of a form selection, such as ComboBoxReturn.

  • www.driveworks.co.uk

    Date and Time Functions Date

    This function returns the current date at the time it is called.

    DATE() If the DATE()function is called on the 21st August 2011, then this will return the value: 21/08/2011

    DateTime

    This function converts a value into a date-time representation using standard US English formatting (where . is used as the decimal separator for decimal numbers).

    DateTime([Value]) If DateTime(40631+30)is entered, this will return 04/28/2011.

    If DateTime(DWVariableDate+20.5)is entered, this will return 18/04/2011 12:00:00 when DWVariableDate is 40631.

    DateTimeLocal

    This function converts a value into a date-time representation using standard current culture formatting.

    DateTimeLocal([Value]) If DateTimeLocal(DWVariableDate+20,5)is entered, it will return 18/04/2011 12:00:00 in UK type formatting (04/18/2011 12:00:00 for US type formatting) when DWVariableDate is 40631 on machines that use , as the decimal separator.

  • DriveWorks Ltd.

    90

    DateValue

    This function returns the system date value for the given date.

    DATEVALUE() If DATEVALUE("09/21/2010")is entered, this will return the system value of 40442 for the given date.

    If DATEVALUE(DATE())is entered, this will return the system value of 40462 when called on the 11th October 2010.

    Day

    This function returns the day number from the given value.

    DAY() If DAY()is entered on the 11th October 2011, the value returned will be 11.

    If DAY(40462)is entered, this will return 11 from the given system date value.

    If DAY("09/21/2011")is entered, the value 21 will be returned from the given date.

    Hour

    This function returns the hour, a number from 0 to 23, from the given value.

    HOUR() If HOUR(NOW())is entered at the time of 13.20, then the value returned will be 13.

    If HOUR(0.555)is entered, this will return 13 from the given system value time.

  • The Little Book of Rules

    91

    Minute

    This function returns the minute, a number from 0-59, from the given value.

    MINUTE() If MINUTE(NOW())is entered at the time of 13:20, then it will return a value of 20.

    If MINUTE("16:19:22")is entered, then the value of 19 will be returned from the given system value.

    Month

    This function returns the month number from the given value.

    MONTH() If MONTH(DATE())is entered on the 12th August 2011, then it will return the value of 8.

    If MONTH("11 OCTOBER 2010")is entered, this will return 10 from the given date.

  • DriveWorks Ltd.

    92

    NetWorkDays

    This function returns the number of work days between the given dates.

    NETWORKDAYS([StartDate],[EndDate], [Holidays])

    All dates must be in the mm/dd/yyyy format.

    If NETWORKDAYS("10/08/2010","10/30/2010", "10/12/2010")is entered, all the work days between 10/08/2010 and 10/30/2010 will be counted, except 10/12/2010 (indicated by Holidays), and will therefore return 15 as the net amount of days worked.

    If NETWORKDAYS("10/08/2010","10/30/2010", "10/12/2010","10/13/2010")is entered, all the work days between 10/08/2010 and 10/30/2010 will be counted except the days of the 10/12/2010 and the 10/13/2010, therefore returning a value of 14.

  • The Little Book of Rules

    93

    NetWorkDaysCustom

    This function returns the number of work days between the given dates, allowances for which days are weekend days and holidays are specified by the WeekendValue and Holidays values respectively.

    NETWORKDAYSCUSTOM([StartDate],[EndDate],[WeekendValue],[Holidays])

    All dates must be in the mm/dd/yyyy format.

    See Appendix A for WeekendValues. NETWORKDAYSCUSTOM("10/08/2010","10/30/2010",3,"10/12/2010")is entered, all work days between 10/08/2010 and the 10/30/2010 will be counted, where the Mondays and Tuesday are taken as weekend days (3) and the 10/12/2010 is taken as holiday. This will return a value of 17 net work days.

    Now

    This function will return the current system date and time at the time it is called.

    NOW() If NOW()is called on the 12th August 2011 at 9:19 am (and 12 seconds), the return value will be 12/08/2011 09:19:12

    Second

    This function returns the second, a number from 0 – 59, from the given value.

    SECOND() If SECOND(NOW())is entered at the time of 13:20:47, a value of 47 will be returned.

    If SECOND("16;28;10")is entered, this will return 10 from the given time value.

  • DriveWorks Ltd.

    94

    TimeValue

    This function converts the given time to a serial number value.

    TIMEVALUE() If the TIMEVALUE(NOW())function is called at the time of 13:17:02, it will return the system value of 0.553496458334848.

    If TIMEVALUE("16;25;21")is entered, it will return a system value of 0.684270833 for the given time.

    Today

    This function returns the current system date at the time the function is called.

    TODAY() If TODAY()is called on the 12th August 2009, the value returned is 12/08/2009

  • www.driveworks.co.uk

    WeekDay

    This function returns a number representing the day of the week.

    WEEKDAY([Date],[ReturnType]) Date is the date to return the weekday from.

    ReturnType is a number representing the day in which the week starts.

    Please see Appendix B for ReturnType values.

    If WEEKDAY(Today(),2)is called on a Monday, it will return 1 as the ReturnType value defines Monday as the first day (2).

    If WEEKDAY("10/08/2010")is entered, this will return 6 as the value as the date falls on a Friday and the ReturnType has been omitted, which will mean Sunday is counted as the first day of the week.

    WeekNum

    This function returns the week of the given date as a number.

    WEEKNUM([Date],[ReturnType]) Date is the date to return the week number from.

    ReturnType is a number representing the day on which the week starts.

    Please see Appendix C for ReturnType values.

    If WEEKNUM(Today())is entered as a function on the 10/18/2010 it will return 43 as the week number.

    If WEEKNUM("10/18/2010",12)is entered, this will return a value of 42 as the date given falls on a Monday and the week is set to start on a Tuesday (represented by ReturnType value 12).

  • DriveWorks Ltd.

    96

    WorkDay

    This function returns the date before or after a specified number of work days.

    WORKDAY([Date],[Days],[Holidays]) Date is the date to start counting the number of work days from.

    Days is the number of work days to include.

    Holidays are the dates to be ignored.

    If WORKDAY(Today(),10,"10/19/2010")is entered and the function is called on the 18th August, the value returned will be 12/08/2010.

    WorkDayCustom

    This function returns the date before or after a specified number of work days.

    WORKDAYCUSTOM([Date],[Days],[Weekend], [Holidays])

    Date is the date to return the week number from.

    Days is the date to return the week number from.

    Weekend is the date to return the week number from.

    Please see Appendix D for Weekend values.

    If WORKDAYCUSTOM(Today(),10,1,"10/27/2010")is called on the 19th October 2010, then it will return the value 03/11/2010.

  • The Little Book of Rules

    97

    Year

    This function returns the year from the given date or date serial number.

    YEAR([Date]) If YEAR(43563)is entered, the year 2019 will be returned from the given date serial number.

    If YEAR(Today())is called on the 19th October 2010 then it will return the value of 2010.

  • www.driveworks.co.uk

    Helper Functions

    Color

    This function takes three values and converts them to a color value which can be used, for example, with the DWColor custom property to drive a part color. Red, Green and Blue are values from 0-255 (inclusive).

    COLOR([Red],[Green],[Blue]) If the function entered is COLOR(123,51,204)then the result returned will be 123|51|204 (red|green|blue).

    DimensionText

    This function displays text strings at the specified positions around a dimension.

    DIMENSIONTEXT([Left Text],[RightText],[Top Text],[BottomText])

    LeftText is the text to be displayed to the left of the dimension.

    RightText is the text to be displayed to the right of the dimension.

    TopText is the text text to be displayed on the top of the dimension.

    Bottom Text is the text to be displayed at the base of the dimension.

  • The Little Book of Rules

    99

    DimensionTextAll

    This function sets all the text for that dimension to the specified text.

    DIMENSIONTEXTALL([AllText]) AllText is the text that you want to display on the dimension. DIMENSIONTEXTALL(DimensionDescriptionTextBox Return)would return the text from the Dimension Description Text Box and display it on the dimension.

    List

    The List function is a helper that allows quick entry of a range of items for inclusion into a list-type control.

    "[Item A]|[Item B]|[Item C]" Within the DriveWorks Rule Builder, lists can be entered by entering each line item on a new line by hitting the return key.

    Once all items have been entered into the editor, and Finish is selected, the Rule Builder will automatically place | in between each item and the entire string within quotes so it can be displayed in a list-type control (e.g. List Box, Combo Box or Option Group).

  • www.driveworks.co.uk

    Text Builder

    The Text Builder function is a helper that allows quick entry of many values that require building into a single string of text.

    [ItemA]&""&[Item B]&""&[ItemC] Enter text strings within quotes and numbers as values in the Text Builder tab of the editor. Hit return after each entry to create a joining item of text to include in the string. Click Finish when the list is complete.

    Once all items have been entered into the editor, and Finish is selected, the Rule Builder will automatically apply the syntax & " " & in between each item.

  • The Little Book of Rules

    101

    Logic Functions

    And

    The And function returns TRUE if all its arguments are TRUE.

    AND([LogicalExpression1],[Logical Expression2],[LogicalExpression n])

    Each LogicalExpression is a rule that, when evaluated, returns either TRUE or FALSE.

    There can be 1 to 255 LogicalExpressions in any one And function.

    If all LogicalExpressions return TRUE, the And function will return TRUE.

    If at least one of the LogicalExpressions returns FALSE, the And function will return FALSE. AND(LengthTextBoxReturn>=6,WidthTextBox Return=

  • DriveWorks Ltd.

    102

    Boolean

    This function converts a value into a Boolean representation using standard US English spelling where decimal numbers must use . as the decimal separator.

    Boolean([Value]) Any number other than 0 will return TRUE. 0 will return FALSE.

    If Boolean(2.6)is entered, this will return TRUE. If Boolean(DWVariableNumberToConvert)is entered, it will return TRUE when DWVariableNumberToConvert is not 0, and will return FALSE when DWVariableNumberToConvert = 0.

    If

    This function specifies a logical test to perform.

    IF([Condition],[IfConditionIsTrue],[If ConditionIsFalse])

    Condition is any rule which, when calculated, returns either TRUE or FALSE. IfConditionIsTrue is a rule or value which is returned if the condition, when calculated, returns TRUE.

    IfConditionIsFalse is a rule or value which is returned if the condition, when calculated, returns FALSE. IF(FormSpinButtonReturn

  • The Little Book of Rules

    103

    Not

    The Not function reverses the logic of an argument.

    NOT(LogicalExpression) If the LogicalExpression returns TRUE, then the Not function will return FALSE.

    If the LogicalExpression returns FALSE, then the Not function will return TRUE.

    For example, NOT(ColorComboBoxReturn= "Blue")means that the return value of the Color Combo Box will be checked to see if it is equal to "Blue". If the Color Combo Box return value is equal to "Blue", the LogicalExpression will be evaluated as TRUE, therefore the Not function will return FALSE.

    Example Outcomes of the Not Function:

    ColorComboBoxReturn = "Blue" Result of the NOT function

    TRUE FALSE

    FALSE TRUE

    N.B. Check out the Rule Building Operators section (page 11 onwards) for more information on comparing values.

  • DriveWorks Ltd.

    104

    Or

    The Or function returns TRUE if any argument is TRUE.

    OR([LogicalExpression1],[Logical Expression2],[LogicalExpression n])

    LogicalExpressions are rules that return either TRUE or FALSE.

    There can be 1 to 255 LogicalExpressions in any one Or function.

    If at least one of the LogicalExpressions returns TRUE then the Or function will return TRUE.

    If all LogicalExpressions return FALSE then the Or function will return FALSE. OR(ProductComboBoxReturn="Door",ProductCode TextBox="D355")means that if the Product Combo Box return value is equal to "Door" or the Product Code Text Box return value is equal to "D355" then the Or function will return TRUE.

    Example Outcomes of the Or Function:

    N.B. Check out the Rule Building Operators section (page 11 onwards) for more information on comparing values.

    ProductCombo BoxReturn = "Door"

    ProductCode TextBox = "D355"

    Result of the OR function

    TRUE TRUE TRUE

    TRUE FALSE TRUE

    FALSE TRUE TRUE

    FALSE FALSE FALSE

  • The Little Book of Rules

    105

    ChooseFrom

    This function provides conversion functionality when a specific input value is returned. A value is selected based on a match with the input value. If no match is found the specified default value is returned.

    CHOOSEFROM([Input],[DefaultValue], [InputValue],[Value1],

    [InputValue2],[Value2],[InputValue n],[Value n])

    Input is the value or reference to a value that specifies which value argument to select.

    DefaultValue is the value to return when no InputValue is found.

    InputValue1, 2… n are the values being returned from the Input.

    Value 1, 2… n are the values to return when the corresponding InputValue is returned.

    InputValue and Value arguments work in pairs. CHOOSEFROM(ColorReturn,"0|0|0","Red","255|0|0","Blue","0|0|255", "White", "255|255|255")means that: 0|0|0 is returned when the Color control entered is not Red, Blue or White

    255|0|0 is returned when the Color control value entered is Red

    0|0|255 is returned when the Color control entered is Blue.

    255|255|255 is returned when the Color control entered is White.

  • DriveWorks Ltd.

    106

    Math Functions

    Abs

    This function returns the absolute value of a number (i.e. without regard to its sign).

    ABS([Number]) ABS(-488.9)uses the number -488.9 and return the absolute value of 488.9.

    ABS(723)uses the number 723 and return the absolute value of 723.

    ACos

    This function is used to calculate the arccosine (or inverse cosine) of a Number.

    ACOS([Number]) The value of Number can be a number between -1 and 1.

    ACOS(-1)uses the number -1 and calculates the resulting arccosine (inverse cosine), returning a value of 3.14159265358979.

    ACosD

    This function calculates the arccosine of a number. The result is measured in degrees.

    ACOSD([Number]) The value of Number can be any number between -1.0 to 1.0.

    ACOSD(1)uses the number 1 and returns its arccosine measured in degrees, giving a result of 0 degrees.

  • The Little Book of Rules

    107

    ACosH

    The ACosH function, when calculated, returns the inverse hyperbolic cosine, of the specified number.

    ACOSH([Number]) ACOSH(10)will return the inverse hyperbolic cosine of 10, which is 2.993222846.

    ASin

    This function is used to calculate the arcsine (or inverse sine) of the specified number.

    ASIN([Number]) The value of Number can be a number between -1 and 1.

    ASIN(-0.45)uses the number -0.45 and calculates the resulting arcsine giving a result of -0.466765339047296.

    ASinD

    This function calculates the arcsine of a specified number. The result is measured in degrees.

    ASIND( [Number] ) The value of Number can be any number between -1.0 and 1.0.

    ASIND(1)uses the number 1 and returns its arcsine measured in degrees. The result is 90.

  • DriveWorks Ltd.

    108

    ASinH

    The ASinH function returns the inverse hyperbolic sine of the specified number.

    ASINH([Number]) ASINH(20)returns the inverse hyperbolic sine of 20, which is 3.689503869.

    ATan

    This function is used to calculate the arctangent (or inverse tangent) of a specified number.

    ATAN([Number]) ATAN(0.78)uses the number 0.78 and calculates the resulting arctangent (inverse tangent). The result is 0.662426293833151.

    ATan2

    The ATan2 function, when calculated, returns the inverse tangent of the chosen point, specified by the x-coordinate and y-coordinate.

    ATAN2([XCoordinate],[YCoordinate]) XCoordinate is the x-coordinate of the point that you want to find the inverse tangent of.

    YCoordinate is the y-coordinate of the point that you want to find the inverse tangent of. ATAN2(XCoordinateTextBoxReturn,YCoordinate TextBoxReturn)will return the inverse tangent of the point that is specified by the return values from the x-coordinate and y-coordinate text boxes.

  • The Little Book of Rules

    109

    ATanD

    The ATanD function calculates the arctangent of a number. The result is measured in degrees.

    ATAND([Number]) ATAND(1)will return the arctangent of 1 measured in degrees. The result is 45.

    ATanH

    The ATanH function returns the inverse hyberbolic tangent of the specified number.

    ATANH([Number]) The Number must be between -1 and 1.

    ATANH(0.7)returns the inverse hyperbolic tangent of 0.7 which is 0.867300528.

    Ceiling

    This function rounds a number up to the nearest specified significance.

    CEILING([Number],[Significance]) Significance is the number to which this function fi