Skip to content

Instantly share code, notes, and snippets.

View benkoshy's full-sized avatar

Ben Koshy benkoshy

View GitHub Profile
@benkoshy
benkoshy / tekla-open-api-matrixFactory.FromCoordinateSystem-explained.md
Last active October 13, 2026 04:14
Tekla Open API - MatrixFactory.FromCoordinateSystem explained

Assuming we have an arbitrary workplane that is not at the global coordinate system, and if we did the following - this came as a surprise to me:

        [Test]
        public void TestFromCoordinateSystem()
        {
            // Current Coordinate system is at some arbitrary point that is not at the global coordinate system
            Point origin = new Point(0, 0, 0);
            Vector xAxis = new Vector(1, 0, 0);
 Vector yAxis = new Vector(0, 1, 0);
@benkoshy
benkoshy / tekla-api-set-workplane-to-arbitrary-coordinate-system.md
Last active October 8, 2026 01:12
Tekla Open API - Setting the work plane to an arbitrary Coordinate System
 [Test]
 public void failsToChangeWorkPlane()
 {
     // approach 1.
     // set working plane to something crazy.
     Model model = new Model();
     WorkPlaneHandler workPlaneHandler = model.GetWorkPlaneHandler();
     CoordinateSystem world = new CoordinateSystem(new Point(0, 0, 0), new Vector(1, 0, 0), new Vector(0, 1, 0));
     TransformationPlane transformationPlane = new TransformationPlane(new Point(0,0,0), new Vector(1,0,0), new Vector(0,1,0));
@benkoshy
benkoshy / tekla-api-list-component-attribute-files.md
Created October 2, 2026 03:56
Tekla Open API - List the Attribute / Profiles associated with a custom Component

If you're wanting to target the attribute file of a specific component - this code snippet should help you out:

        public void ListComponentFileNames()
        {
            foreach (string attributeFileName in getCustomComponentFileNames())
            {
                Debug.WriteLine($"{attributeFileName}");
            }
        }
@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())