Exercise 1: Create pad footings
You will learn how to create pad footings in Tekla Structures through the API.
After downloading the TSOpenAPISelfLearningExercises package from GitHub (button above), find the example code for this exercise at \Exercise1-PadFootings\ folder.
Before you start:
-
In Tekla Structures, create new model using default environment or open this model: Exercise-model.zip
-
Extract the .zip file to \C:\TeklaStructuresModels\ for easy access.
-
-
Start Microsoft Visual Studio.
Create pad footings
Create pad footings on each grid intersections on grid lines A, E, 1 and 6. So create 18 pad footings in total. Follow these steps to create your application:
-
Create a new Model object that represents the Tekla Structures model you have opened in Tekla Structures.
-
Add a button "Create Pad Footings" to the application form and pad footing creation to the Click-event. The Click-event should include the following:
-
Check if you have a Tekla Structures model open that you can connect to.
-
Create two for loops to cycle through the X and Y directions of the positions and create pad footings with the method mentioned in step 3.
-
Commit changes to Tekla Structures using CommitChanges().
-
-
Create a method that creates and inserts one pad footing based on the two input positions using the Beam class. Set up the following properties to your pad footings:
Name = "FOOTING" Profile.ProfileString = "1500*1500" Material.MaterialString = "C50/60" Class = "8" StartPoint EndPoint (change Z coordinate 500.0 mm lower than StartPoint) Position.Rotation = Position.RotationEnum.FRONT Position.Plane = Position.PlaneEnum.MIDDLE Position.Depth = Position.DepthEnum.MIDDLE
Note, that these values might need to be localized and profile and material needs to be found in environment.
-
Test your application:
-
On the Debug menu, click Start Debugging to run the project and show your form with the Create Pad Footings button.
-
Click Create Pad Footings.
-
The result should look similar to this:
Run example code
-
Open Microsoft Visual Studio.
-
On the File menu, point to Open and click on Project/Solution.
-
Open the \Exercise1-PadFootings\ folder and click Exercise1.csproj, to open the project.
-
On the Debug menu, click Start debugging, to run the project and show your form with the Create Pad Footings button.
-
Click Create Pad Footings, to place pad footings at the grid intersections of the model in Tekla Structures.