Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Last active June 27, 2026 22:50
Show Gist options
  • Select an option

  • Save benkoshy/3f94dc3852c1c46d4bba81c2dfcf4266 to your computer and use it in GitHub Desktop.

Select an option

Save benkoshy/3f94dc3852c1c46d4bba81c2dfcf4266 to your computer and use it in GitHub Desktop.
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()
        {
            Model model = new Model();

            if (model.GetConnectionStatus())
            {
                CoordinateSystem cs1 = getCoordinateSystem1();
                CoordinateSystem cs2 = getCoordinateSystem2();

                // move by operation
                Point startPoint = new Point(300, 0, 0);
                Point endPoint = new Point(400, 0, 0);

                Beam beam = beamFactory(startPoint, endPoint, "1"); // we need factory methods because the same points mutate
                beam.Insert();
                Operation.MoveObject(beam, cs1, cs2);
                beam.Select(); // gray       
                    
                model.CommitChanges();
                
                Assert.That(startPoint, Is.EqualTo(new Point(300, 0, 0))); // it fails when it should be equal
                Assert.That(endPoint, Is.EqualTo(new Point(400, 0, 0))); // it fails when it should be equal
            }
        }

For more visit: Tek1's Tekla API blogs

To visit the Github Project - Checkout Tekla Extension Methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment