• No results found

Ladder custom part

In this example you create a ladder custom part and edit the part’s dialog box to be intuitive and easy to use. As the custom part is intelligent, you can adjust its variables to suit different situations.

Adding the exclamation marks in the conditions determines that the unavailable variables are hidden instead of dimmed.

The example consists of the following sections:

Defining a ladder part (p. 66)

Opening the ladder part in custom component editor (p. 68) Creating distance variables to control the ladder length (p. 69)

Creating variables to control the number and spacing of the rungs (p. 70) Creating variables to control the bottom rung offset (p. 72)

Creating variables to control the ladder width (p. 73)

Creating variables to control the stringer and rung profiles (p. 75) Creating a variable to control the rung connections (p. 76) Testing the ladder part (p. 77)

Creating an image for the ladder part dialog box (p. 77) Adding the image to the ladder part dialog box (p. 78) Positioning the image and parameters (p. 80)

Renaming and adding a tab page (p. 82)

Testing changes in the ladder part dialog box (p. 83)

A custom part creates a group of objects which may contain connections and details. A custom part gets no symbol and has same position properties as beams.

Defining a ladder part

To define a ladder part:

1. Click Detailing > Component > Define Custom Component... to open the Custom Component Wizard.

2. Select Part in the Type list.

3. Enter a name for the custom part in the Name box.

4. Click Next.

5. Select all the objects that belong to the part.

Before you start, ensure that you have the example model Ladder open.

Use area selection (right to left) to select the objects.

6. Click Next.

7. Select the grid intersection as the first position and the second position 4200 mm above the first.

Use relative coordinates to select the second position.

8. Click Finish to finish defining the part.

Tekla Structures displays a component symbol for the new component and the ladder part is added to the component catalog.

Opening the ladder part in custom component editor

Use the custom component editor to modify the custom component.

To open the ladder part in the custom component editor:

1. Select the ladder part in the model.

2. Right-click and select Edit Custom Component.

The custom component editor opens showing the custom component editor toolbar, the component browser and four views of the custom component.

Creating distance variables to control the ladder length

To create distance variables to control the ladder length:

1. Select Component planes in the custom component editor.

A custom part which has not been edited appears in its predefined size despite the points picked for creating it.

To control the ladder height with the second input point, bind the stringer top handles to the component plane.

2. Select both stringers.

3. Hold down the Alt key and use area selection (left to right) to select both stringer handles.

4. Right-click and select Bind to Plane.

5. Highlight the component plane at the end of the stringers.

6. Click the plane to bind the stringer handles.

Creating variables to control the number and spacing of the rungs

The bottom rung was created manually and it was multiplied with the Array of objects component. Create variables for the rung number and spacing and link the variables with the component. Then use the component to automatically calculate the number of the rungs.

To create variables to control the number and spacing of the rungs:

1. Click the Display variables button to open the Variables dialog box.

2. Click Add four times to create four new variables.

3. Rename the new variables, change their visibility and change the Value type to Number for variable P4.

4. Right-click one of the stringers in the custom component editor and select Inquire in the list.

5. Copy the stringer ID value in the Inquire Object dialog box.

6. Change Formula to =fTpl("LENGTH",<stringer ID>) for variable Stringer Length.

7. Change Formula values for variables P2 and P3.

8. Change Formula to =floor((P1-P2-P3)/P3) for variable P4. The variables created by the user get the prefix P (parameter).

Reference functions consist of the following syntax:

fTpl("template attribute", object ID)

Always check the ID number of the object that you use with the reference function.

The formula counts the number of rungs. First, the rung spacing and distance to the first rung is subtracted from the stringer length. Then the remaining value is divided by the rung spacing and rounded down by using the floor() function.

9. Link variables P3 and P4 to the properties of the Array of objects component in the custom component browser.

You have created the variables that control the number and spacing of the rungs.

Creating variables to control the bottom rung offset

Create variables to control the distance from the floor level to the bottom rung.

To create the variables:

1. Select the bottom rung.

2. Hold down the Alt key and use area selection (left to right) to select the bottom rung

3. Bind the handles to the component plane at the bottom of the stringers.

4. Change Formula to =P2 for the two new variables and hide both variables.

You have created the variables that control the bottom rung offset.

Creating variables to control the ladder width

To create variables to control the ladder width:

1. Create a new variable in the Variables dialog box.

2. Change Formula to 450 and Visibility to Show for the new variable.

3. Enter a name for the new variable in Label in dialog box.

4. Select both the stringers and the bottom rung in the custom component editor.

5. Hold-down the Alt key and use area selection (left to right) to select the handles.

6. Bind the handles to the central component plane.

Six new distance variables appear in the Variables dialog box.

7. Change Formula to =P5/2 for all the new variables and change their Visibility to Hide.

You have created the variables that control the ladder width.

Creating variables to control the stringer and rung profiles

To create the variables to control the stringer and rung profiles:

1. Create two new variables in the Variables dialog box.

2. Change Value type to Profile for both variables and enter a name for the new variables in Label in dialog box.

3. Copy the rung and stringer profile values from the custom component browser and paste them to corresponding Formula of the new variables.

4. Link variable P6 to both stringers and variable P7 to the bottom rung in the custom component browser.

You have created the variables that control the stringer and rung profiles.

Creating a variable to control the rung connections

Create a variable to control the connections between the stringers and rungs.

To create the variable:

1. Click Add to create a new variable in the Variables dialog box.

2. Enter a name for the variable in Label in dialog box. 3. Change Value type to Component name.

4. Right-click Name under Connection in the custom component browser and select Copy Value in the list.

5. Paste the value to Formula of the P8_name variable.

6. Link variable P8_name to both connections in the custom component browser.

The variable automatically receives the suffix _name when Value type is set to Component name.

You have created the variable that controls the connections between the stringers and rungs.

Testing the ladder part

Test the ladder part by changing values in the ladder dialog box.

To test the ladder part:

1. Save the ladder part in the custom component editor.

2. Exit the custom component editor.

3. Double-click the ladder part to open the ladder dialog box.

4. Save the default values as Standard.

You can then later easily load the default values.

5. Change values in the ladder dialog box and click Modify to see the changes in the ladder part.

Creating an image for the ladder part dialog box

Create a new image for the ladder part dialog box by using an existing component image as a basis.

To create an image:

1. Open the dialog box of the component Ladder (S35). 2. Take a snapshot of the image in the dialog box.

3. Edit the image in an image editor.

4. Save the image as a bitmap file (file extension .bmp) in the ..\Tekla Structures\<version>\nt\bitmaps folder.

Adding the image to the ladder part dialog box

To add the image:

1. Click File > Open Model Folder to open the folder that contains the model files.

2. Go to the CustomComponentDialogFiles folder.

3. Open the .inp file with a text editor.

The first pixel in the top left corner of a bitmap must be of the same color (gray) as the background of the dialog box.

4. Add the following line in the input file:

picture ("ladder", 65, 260, 100, 50)

The input (.inp) file controls the contents of the dialog box.

Image name Image width Image height

5. Save the input file.

6. Close and reopen the model to see the changes in the dialog box.

Positioning the image and parameters

Change the position of the image so that it is completely visible and move some parameters onto the image to make the dialog box easier to use.

To position the image and parameters:

1. Open the input file with a text editor.

2. Remove the parameter names from variables P2, P3 and P5.

3. Enter x and y coordinates and change the text box length for variables P2, P3 and P5. X distance from left edge of dialog

Y distance from top edge of dialog

The number of parameter rows affects the size of the dialog box. A tab page can contain 25 parameter rows. If there are more than 25 visible parameter rows, Tekla Structures creates another tab page.

4. Change the row number for variables P6, P7 and P8_name.

5. Save the input file.

6. Close and reopen the model to see the changes in the dialog box.

X coordinate Y coordinate Length of text box

Renaming and adding a tab page

Rename a tab page and add another to the ladder part dialog box.

To rename and add a tab page:

1. Open the input file with a text editor.

2. Replace the text Parameters 1 with Picture in the tab_page row.

3. Enter the following line to add another tab page:

tab_page("", " Parts ", 2)

4. Move variables P6, P7 and P8_name inside the parentheses under the new tab page.

5. Change the row number for variables P6, P7 and P8_name.

6. Save the input file.

7. Close and reopen the model to see the changes in the dialog box.

Testing changes in the ladder part dialog box

To test the changes:

1. Enter Standard in the Save as box in the dialog box.

2. Click Save as to save the default values.

3. Change values in the dialog box and click Modify to see the changes in the ladder part.

Related documents