Advanced Selection ( Modeling )
Tool summary :
Also see :
- Modeling (where Advanced Selection is a tool)
- Advanced Selection Dictionary
- model (a parametric module)
- selection files (alternative to Advanced Selection )
- Open View (sets selectable items to items shown in the view)
- advanced_selection/SDS2 (default files provided by SDS2 are contained in)
- Select Items (mode for Advanced Selection in Modeling )
- MultiMemberLocate (using Advanced Selection for a parametric)
- Python resources (about writing Python code)
- Selection count (gives results of Advanced Selection )
- Model Tree (selected items are highlighted in)
- Primary selection surface color ( User and Site Options > Modeling > )
- Selection Filter by Expression (alternative way to run an Advanced Selection script)
- Advanced Selection Run (alternative way to run an Advanced Selection script)
- Launcher icon (icon for running for a particular Advanced Selection script)
- Selection Launchers (where in Toolbar Configuration to look for a launcher icon)
page 1 | contents | dictionary | edit > | selection | selection (index) | top
To open this window :
In Modeling :
Method 1 : Click the Advanced Selection icon. The icon can be taken from the group named ' Selection ' and placed on a toolbar (classic) or the ribbon (lightning).
Method 2 : If " Modeling layout style " is ' Classic ', you can use the menu system to choose Edit > Advanced Selection .
Method 3, 4 or 5 : Advanced Selection can also be configured to be invoked using a keyboard shortcut , the context menu , or a mode . For the lightning interface, this configuration is done using Customize Interface .
Method 6 : Select ' By Expression ' as the selection filter.
page 1 | contents | dictionary | edit > | selection | selection (index) | top
The Advanced Selection window :
Tip: To review examples of the settings on this window that are required to perform various selection operations, press the " Open ... " button and select an advanced selection script (a .sel file).
Select: Members ("m") or Components ("c") or Ends ("e") or Material ("mt") or Holes ("h") or Bolts ("b") or Welds ("w"). This is the class of item that will be selected by the " Selection Code " that is entered. See the examples for more information.
Operation: Set or Add or Remove or Toggle . See example 1 .
' Set ' clears the current selection and replaces it with the selection dictated by the " Selection Code " and, if selected, the ' Dialog '.
' Add ' adds to the current selection.
' Remove ' subtracts from the current selection.
' Toggle ' inverts the current selection per the " Selection Code ."
If this box is checked ( ), you can press to open the Parametric Dialog Edit window and create a dialog.
A dialog box creates a dictionary. In the example shown under " Save ," the code between # dialog begin and # dialog end is the dialog box. The statement m.section_size == x['section_size'] is " Selection Code " that selects those members that have the section size that the user selects in the dialog. If the box is not checked ( ), a dialog box is not automatically created.
Imports and Initialization Code (not required) : This text-entry area is for importing modules and writing initialization code. Leave this area blank unless the " Selection Code " that you are writing requires the import of a specific module or specific initialization code.
# Example of an entry you might make:
|
Selection Code: This a text-entry area that defines what is to be selected. You can define a selection by using expression or by a group of statements that return a True value. Use Enter to create a line break between lines in your code. Tab indents four spaces. Ctrl + c copies selected text. Ctrl + v pastes selected text.
See examples of selection code |
( Ctrl + o ) opens a previously defined selection script (.sel file). It opens to the advanced_selection folder, which probably contains many of the .sel files that SDS2 supplies. The advanced_selection/SDS2 folder should have all updated versions of .sel files that SDS2 supplies, since it is updated with each new installation of SDS2 programs. This means that, if you want to modify one of the advanced_selection/SDS2 .sel files, you should copy-and-rename that file into the advanced_selection folder, or you should modify the version that is found in the advanced_selection folder.
( Ctrl + s ) saves the code that is defined on this window as a selection script (.sel file) so that you can " Open ... " it later. You can also use Edit > Advanced Selection Run to run a saved selection script.
.sel file format | |
[select] | Class of selected items. For example, ' Members '. |
[prompt] | The ' Dialog '. Include only when needed. |
[init] | " Imports and Initialization Code ." Include only when needed. |
[code] | The " Selection Code ." |
# Example of a .sel file.
[select] Members [prompt] # dialog begin dlg1 = Dialog() dlg1.mtrl_browse('SectionSize', ["All material"], "W12x50", "Select a section size") x = dlg1.done() # dialog end # there is no [init] section since none is required [code] m.SectionSize == x['SectionSize'] |
evaluates the code written on this window, closes this window, runs the code.
Possibility 1 : Advanced Selection recognizes an error on one of the lines in the code and reports a syntax error. This window remains open until you fix that line. The offending line is highlighted in red .
Possibility 2 : This window closes, but an error is found when running the code. A warning dialog reports that there is an " Error evaluating advanced selection code ." Read the warning carefully -- it may help you to correct the problem.
Possibility 3 : Advanced Selection finds nothing wrong with your code, closes this window, and runs the code. But the code still does not work in your current view, and therefore nothing is selected. There may still be a problem with the code, or it may be that the view does not contain the items that the code selects.
Possibility 4 : The window closes, and items are selected in your current view in Modeling per the instructions in the advanced selection code.
Note: The entries made to this window are remembered during a Modeling session.
closes this window. Your current selection will be unaffected by any of the choices you have made on this window. The entries shown on this window when you first opened it will be shown on this window when you next open it during your current Modeling session.
clears all text that is entered to " Imports and Initialization Code " and " Selection Code ."
page 1 | contents | dictionary | edit > | selection | selection (index) | top
Troubleshooting and script composition tips :
Tip 1: Know the truth! Advanced selection selects those members, materials or etc. for which the expression you enter as the " Selection Code " is true. For example, set " Select " to ' Members ' and type in True (or 1) as the " Selection Code ." When you press " OK ," all members in your model are selected.
# Selects all members in your view.
|
When and is used to join parts of an expression, all parts of that expression must be true in order for the entire expression to return True. Since the two parts of the following script are mutually exclusive (a member can't be both a beam and a column), the script selects nothing:
# Selects nothing.
|
When or is used to join parts of an expression, each part of the expression can return True. Since a member can be a beam or a column, the following script selects every member in your current view that is a beam or a column:
# Selects beams and columns.
|
Tip 2: Choose the right path! Attributes of members belong with members. Attributes of materials belong with materials. Beams may have some attributes that columns also have, but may have other attributes that no other member types have. If you use an attribute that applies to a member in order to select a material or a member of a different type that does not have that attribute, you will get an error that states: " No attribute ... on modelobject object ."
# Generates an attribute error.
|
# Selects all W tee materials in your current view.
|
You also get the " No attribute ... " error if the path to that attribute is not correct or if you made an inappropriate choice to " Select ." Some useful paths are shown in the following table. Set " Select " to ' Members ' to use most of these examples. For the Hole example, set " Select " to ' Material '. See the Advanced Selection Dictionary for an explanation of the attributes Type , description , DesignHasChanged , MaterialType , BoltDiameter , IsFieldBolt and Length .
Name | Attribute | Example | |
Member | m. | m.Type == Misc | |
Component | c. | c.description == "Base Plate Shear Key" | |
End | e. | Ends | any (m.Ends).DesignHasChanged == True |
Material | mt. | Material | any (m.Material).MaterialType == WTee |
Hole | h. | Hole | any (mt.Hole).BoltDiameter > dim("3/4") |
Bolt | b. | Bolt | all (m.Bolt).IsFieldBolt == True |
Weld | w. | Weld | any (m.Weld).Length > dim("2-0") |
Note: A hole can be an attribute of a material. An end, material, bolt or weld can be an attribute of a member. |
Tip 3: Be grammatical! Computers are worst than English teachers. At least English teachers know what you're trying to say. With a computer, your script has to be syntactically perfect. Fortunately, Advanced Selection tells you when it detects a syntax problem. For example, it makes sure that parentheses and quotes are in pairs, that attributes are separated with periods, and that lines are joined with and or or .
# Generates a syntax error.
any (m.Ends.ConnectionHasFailed == True |
# Selects members with failed connections on either end.
any (m.Ends).ConnectionHasFailed == True |
Tip 4: Know your limits! If you want to use Advanced Selection with multi-edit, you'll probably want to limit members and materials to particular types. Here's a couple of examples:
#Selects beams with a failed connection on either end.
m.Type == Beam and any (m.Ends).ConnectionHasFailed == True # Tip: Right-click > "Edit" opens the Beam Edit window |
# Selects 6 inch plates that are 1/4 inch thick.
|
Another reason to limit the scope of an advanced selection is so that you get a selection that makes sense. In the underlying code of an SDS2 program, some materials and members have attributes that are always the same value (e.g. zero). You should construct your scripts so that these materials with null values are filtered out. The following script does this by ensuring that only HSS (pipe or tube) vertical braces are selected. Parentheses around the section size limitations cause Python to evaluate those three lines as a single block.
# Selects pipe/tube vertical braces with a 'Welded' end fitting.
|
Tip 5: Define your range! If you can't catch that fish, try using a bigger net. The stored value that Advanced Selection looks at may be slightly different than the displayed value that you, the user, sees. For example, a Beam Edit window might report " WP to WP length: plan " to be '25-0' when, in fact, the stored value for this distance is 300.00099 inches. This means that the following script would not select that beam:
# May not select all beams whose "WP to WP: plan" is 25-0 feet.
|
One way to select that beam is to enter a range as shown in the following example:
# Selects all beams whose "WP to WP: plan" is 25-0 feet.
|
Another way to select that beam is to use the built-in close(arg1, arg2) function, which tests two values for approximate equality and returns True if they are closer together than 0.001 units.
# Selects members whose "WP to WP: plan" is 25-0 feet.
m.Type == Beam
and close(m.WorkpointToWorkpointLevel, dim("25-0"))These next two scripts illustrate how close the two arguments in the close() function need to be in order to return True. The first example returns True, and therefore it selects all members in the view. The second example returns False and therefore selects nothing.
# Selects all members when "Select" is set to 'Members'.
close (25, 25.000999)
# Selects nothing
close (25, 25.001)
page 1 | contents | dictionary | edit > | selection | selection (index) | top
Examples of " Selection Code " (members) :
Tip: For more complex examples, look in the advanced_selection folder that is used by your current version of this program. Print out a copy of these files then " Open ... " them here to figure out how they work. Also see the examples in the Advanced Selection Dictionary . |
Example 1: Here are two sets of " Selection Code ," each of which selects all beams in your current view. Set " Select " to ' Members ' and leave " Imports and Initialization Code " blank, then press " OK " to run either of these examples. Note that "is" is substituted for "==" in the second example. The member attribute Type is explained in the Advaned Selection Dictionary.
# Selects all beams in your current view.
|
# Selects all beams in your current view.
|
For a ' Set ' operation, this code selects all beams that are in your current view. For an ' Add ' operation, this code adds all beams in your current view to your current selection. For a ' Remove ' operation, this code removes all beams from your current selection. For a ' Toggle ' operation, this adds to the selection all beams in your current view that are not currently selected and deselects all currently selected beams.
Example 2: Here's two sets of " Selection Code ," each of which selects beams with auto standard clip angles. The first is an expression ; the second is a series of statements . Compare these with example 6 and example 7 .
# Selects beams with auto standard clip angles on left end.
|
# Selects beams with auto standard clip angles on left end.
|
Example 3: Here's two examples of " Selection Code " for selecting beams whose " Input connection type " on the left end is a ' Clip angle ' that has its " Attachment " set to ' Bolted '. Compare these with example 4 .
# Selects beams with bolted clip angles on left end.
|
# Selects beams with bolted clip angles on left end.
|
Example 4: Here's two examples of " Selection Code " for selecting beams whose " Input connection type " on the right end is a ' Clip angle ' that has its " Attachment " set to ' Welded '. Compare these with example 3 .
# Selects beams with welded clip angles on the right end.
|
# Selects beams with welded clip angles on the right end.
|
Example 5: Here's an expression that select from all members, regardless of their type. Note that the section sizes have to be in quotes since they are strings.
# Selects members with section size W10x49 or W18x35.
|
Example 6: Here's two examples of " Selection Code " for selecting beams with auto standard clip angles on both their left and right ends. The second example selects the same beams as the first example, but is simpler. The third script generates a slightly different selection than the other two -- it selects beams with an auto standard clip angle on either end.
# Selects beams with auto standard clip angles on both ends.
|
# Selects beams with auto standard clip angles on both ends.
|
# Selects beams with an auto standard clip angle on either end.
|
Example 7: Here's " Selection Code " that selects beams with a clip angle on either their left or right end. Unlike the above script, this script will select more than just auto standard clip angles.
# Selects beams with clip angles on either end.
|
page 1 | contents | dictionary | edit > | selection | selection (index) | top
Examples of " Selection Code " (material) :
Example 1: This expression selects all clip angles in your current view. To select materials in this manner, all members must be displayed in a solid form . The Advanced Selection Dictionary provides more information about MaterialUse . " Select " must be set to ' Material ' for this expression to work.
# Selects near side and far side clip angles.
|
Example 2: This expression selects all near side clip angles that are in your current view and on the left ends of members. The Advanced Selection Dictionary lists the strings that you can enter for MemberConnectionEnd . " Select " must be set to ' Material ' for this expression to work.
# Selects near side clip angles on the left ends of members.
|
Example 3: This expression selects HSS/TS material with left-end setbacks greater than 7 units (inches or mm). The Advanced Selection Dictionary lists the strings you can enter for MaterialType .
# Selects HSS/TS material with setbacks of 7 units or greater.
|
Example 4: This script selects all angles whose " Piecemark " is a6. Since the piecemark needs to be in quotes, it is marked as "string" in the Advanced Selection Dictionary .
# Selects angles with submaterial mark a6.
|
page 1 | contents | dictionary | edit > | selection | selection (index) | top
Examples of " Selection Code " (holes) :
Example 1: The following expression selects all holes in all clip angles when " Select " is set to ' Holes '. When " Select " is set to ' Material ', it selects all clip angles (not their holes).
# Selects near side and far side clip angles.
|
Example 2: This expression selects plates with 6 or more holes when " Select " is set to ' Material '. The Advanced Selection Dictionary explains both ImperialDescription and HoleCount .
# Selects plates with 6 or more holes.
|
Example 3: When " Select " is set to ' Material ', this next expression selects plates whose holes are all user-added or user-edited -- if any were used instead of all in this expresson, the selection could also include plates with at least one system-generated hole. When " Select " is set to ' Holes ', the expression selects all of the holes in those plates -- if any were used instead of all , even system-generated holes would be selected. See MaterialType and SystemGenerated for more information on these attributes.
# Selects plates with user-added or user-edited holes.
|
page 1 | contents | dictionary | edit > | selection | selection (index) | top
Examples of " Selection Code " (bolts) :
Example 1: For this next script to get a useful selection, " Select " needs to be set to ' Members '. One way to confirm that the total bolt count is more than 8 is to open the member detail, then Edit Bill and add together the quantity of shop and field bolts.
# Selects members with more than 8 shop and field bolts.
|
Example 2: This next script assumes that 3/4 inches is the standard bolt size. It gives you the described selection only if " Select " is set to ' Members ' .
# Selects beams with non-standard bolt sizes.
|
page 1 | contents | dictionary | edit > | selection | selection (index) | top
Examples of " Selection Code " (ends) :
Example 1: The following expression selects ends with a connection design change when " Select " is set to ' Ends '.
# Selects ends whose design has changed.
|
Example 2: The next expression also selects ends with a connection design change when " Select " is set to ' Ends '. But because it selects members, both ends of members are selected, even if only a single end has this attribute.
# Selects members whose design has changed, either end.
|
If " Select " was set to ' Members ', entire members would be selected, as in this selection.
page 1 | contents | dictionary | edit > | selection | selection (index) | top