Skip to content

Instantly share code, notes, and snippets.

View benkoshy's full-sized avatar

Ben Koshy benkoshy

View GitHub Profile
@benkoshy
benkoshy / personal_summary_art_of_unit_testing.md
Last active September 28, 2026 06:46
Roy Osherove - The Art of Unit Testing - How to Introduce a Seam.

Introducing a Seam:

I purchased Roy Osherove's book on Unit Testing, which was where I learned the trade. Thank you. Here is a summary which I wished existed. Produced via Gemini. If you're interested get the book at any good book shop. I do not get paid to promote this: https://www.artofunittesting.com/


1. Constructor Injection (Book pp. 57–60)[cite: 2]

Pass the dependency as an interface parameter into the class constructor so the test can inject a fake instance[cite: 2].

@benkoshy
benkoshy / tekla-api-numbering-precast-panel.md
Last active September 25, 2026 05:50
How to number a precast panel using the Tekla API.

Here is quiz for you.

  • We have a precast panel
  • We have an identifier which is actually the identifier of the panel part's assembly.
  • Which of the following will allow us to 'number' the panel?
                foreach (PanelNamer.PanelIdentifier id in renamedPanels)
                {
@benkoshy
benkoshy / tekla-api-precast-wall-panel-sample.md
Created September 19, 2026 06:46
Tekla API - How to Create a Precast Panel
Beam panel = new Beam(Beam.BeamTypeEnum.PANEL)
 {
     StartPoint = startPoint,
     EndPoint = endPoint,
     Name = "Ben Koshy’s Precast Panel"
 };

panel.Profile.ProfileString  = getWallPanelProfileString(height, thickness);
// The profile string is simple a height*thickness encoded in the string. 
@benkoshy
benkoshy / tekla-api-spot-the-bug.md
Created June 28, 2026 23:24
Tekla API - Spot the Bug - MoveObject

If you enjoy trying to spot bugs in the API, with unexpected behaviour: checkout the Tekla API.

The following does not move the object. Can you discern why?

 // set up second beam_moved_geometrically
 Beam beam2manuallyTransformed = beamFactory(startPointFactory(), endPointFactory(), "2"); // orange class string            
 beam2manuallyTransformed.Insert();
@benkoshy
benkoshy / tekla-api-mutating-without-telling-me.md
Last active June 27, 2026 22:50
Tekla API Move Object - Mutates Points Without Telling me!

Watch out!

Another one of those "gotcha's" by Tekla.

I got bitten. I couldn't work out why this was failing. And then I realised. They're mutating. Watch out!

        [Test]
        public void TestMutationOfPointsWhenApplyingMoveOperations()
        {
@benkoshy
benkoshy / tekla-api-matrix-transformations-summary.md
Last active June 25, 2026 00:39
Tekla API Matrix Transformations explained

Key Take Out

WorldCoordinateSystem

The world Coordinate system is a Coordinate System with Origin defined as (0,0,0) and the XAxis defined as (1,0,0) and the YAxis as: (0,1,0).

FromCoordinateSystem

FromCoordinateSystem(beamCS) is the same as ByCoordinateSystems(beamCS, worldCS)

@benkoshy
benkoshy / tekla-api-hello-world.md
Last active May 30, 2026 07:09
Tekla Open API - hello world application

A hello world program.

Ensure you have the Australasia environment loaded. Or otherwise change the profile string to a profile in your environment

Model model =  new Model();

if (model.GetConnectionStatus())
@benkoshy
benkoshy / shed_builder-get-profiles.md
Last active May 25, 2026 08:21
Get All Profiles with a Height Property - using the Tekla Open API
public static List<string> getProfiles()
        {
            List<string> profiles = new List<string>();
            CatalogHandler catalogHandler = new CatalogHandler();

            if (catalogHandler.GetConnectionStatus())
            {
                ProfileItemEnumerator profileItemEnumerator = catalogHandler.GetLibraryProfileItems();
@benkoshy
benkoshy / shed_builder.md
Created May 25, 2026 08:17
The main bits of the Shed Builder program

Key Methods:

public class TeklaModelCreator : IBeamCreator
{

    Model model; 

    public TeklaModelCreator()
    {
        this.model = new Model();
@benkoshy
benkoshy / tekla-api-access-a-profiles-properties.md
Created May 14, 2026 00:27
Tekla API - How to access a profile's property information e.g. Height, Width etc.
        public double getHeight(string profileString)
        {
            LibraryProfileItem libraryProfileItem = new LibraryProfileItem();
            libraryProfileItem.Select(profileString);

            List<ProfileItemParameter> parameters = libraryProfileItem.aProfileItemParameters.Cast<ProfileItemParameter>().ToList();
            double height = parameters.First(p => p.Property.ToUpper() == "HEIGHT").Value;

 return height;