Skip to content

Instantly share code, notes, and snippets.

@benkoshy
Created May 25, 2026 08:17
Show Gist options
  • Select an option

  • Save benkoshy/83095855bc5ce15486f8083f121ae07b to your computer and use it in GitHub Desktop.

Select an option

Save benkoshy/83095855bc5ce15486f8083f121ae07b to your computer and use it in GitHub Desktop.
The main bits of the Shed Builder program

Key Methods:

public class TeklaModelCreator : IBeamCreator
{

    Model model; 

    public TeklaModelCreator()
    {
        this.model = new Model();
    }

    public void CommitChanges()
    {
        model.CommitChanges();
    }

    public Beam CreateBeam(Point startPoint, Point endPoint, Position position, string profileString, string classString)
    {
        if (model.GetConnectionStatus())
        {
            Beam beam = new Beam(startPoint, endPoint);
            beam.Profile.ProfileString = profileString;
            beam.Position = position;
            beam.Class = classString;
            Material material = new Material();
            material.MaterialString = "450";

            beam.Material = material;
            beam.Insert();

            return beam;
        }
        else
        {
           throw new Exception("Not connected to Tekla model");
        }
    }
}

// and use it like so:
beamCreator.CreateBeam(new Point(0,0,0), new Point(0,0,0), new Position(), "UB310*32", "2");            
beamCreator.CommitChanges(); // don't forget to commit changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment