Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Created June 28, 2026 23:24
Show Gist options
  • Select an option

  • Save benkoshy/0b839cb9849deb0445be7c05ea97d3c9 to your computer and use it in GitHub Desktop.

Select an option

Save benkoshy/0b839cb9849deb0445be7c05ea97d3c9 to your computer and use it in GitHub Desktop.
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();

 Matrix matrix = BeamExtensions.FromObjectToObjectTransformationMatrix(cs1, cs2);
 Operation.MoveObject(beam2manuallyTransformed, cs1, cs2);
 beam2manuallyTransformed.Modify();
 beam2manuallyTransformed.Select(); // update memory                        
 model.CommitChanges();
// set up second beam_moved_geometrically
Beam beam2manuallyTransformed = beamFactory(startPointFactory(), endPointFactory(), "2"); // orange class string            
beam2manuallyTransformed.Insert();

Matrix matrix = BeamExtensions.FromObjectToObjectTransformationMatrix(cs1, cs2);
Operation.MoveObject(beam2manuallyTransformed, cs1, cs2);
beam2manuallyTransformed.Modify(); //  <----------------------------------- THIS IS THE CULPRIT! - Remove it!
beam2manuallyTransformed.Select(); // update memory                        
model.CommitChanges();

So you have transformed an object. But it is not moving. Why not?

You called Modify. And that negates the entire operation. In fairness to Tekla, they do have a note in the documentation:

Note that the object is moved and updated in the view so ModelObject.Modify() is not needed. Call Modify() only after the object's data has been updated with the ModelObject.Select() method.

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