Bolt to a bent plate in Tekla

Hi,

I’m trying to add holes to a bent plate using the Tekla API within a Grasshopper node. Unfortunately, the AutoBolt feature doesn’t work in this case, and my custom solution isn’t working either — I can’t figure out why.

Any ideas or suggestions would be greatly appreciated!

Here the code:

// Grasshopper Script Instance
#region Usings
using System;
#r "C:\TeklaStructures\2024.0\bin\Tekla.Structures.dll"
#r "C:\TeklaStructures\2024.0\bin\Tekla.Structures.Model.dll"
#r "C:\TeklaStructures\2024.0\bin\Tekla.Structures.Ui.WpfKit.dll"
#r "C:\TeklaStructures\2024.0\bin\Tekla.Structures.Geometry3d.Compatibility.dll"
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;

using Rhino;
using Rhino.Geometry;

using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
#endregion
using Tekla.Structures;
using Tekla.Structures.Model;
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Model.UI;
using System.IO;

using System.Windows.Forms;

public class Script_Instance : GH_ScriptInstance
{
    #region Notes
    /* 
      Members:
        RhinoDoc RhinoDocument
        GH_Document GrasshopperDocument
        IGH_Component Component
        int Iteration

      Methods (Virtual & overridable):
        Print(string text)
        Print(string format, params object[] args)
        Reflect(object obj)
        Reflect(object obj, string method_name)
    */
    #endregion

    private void RunScript(
		object Parts,
		int Dim,
		List<Point3d> PointsIn,
		ref object PartOut)
    {
        var model = new Model();
        Tekla.Structures.Model.Part teklaPart = Parts as Tekla.Structures.Model.Part;
   
        Tekla.Structures.Model.BoltArray bolts = new Tekla.Structures.Model.BoltArray();
        bolts.AddBoltDistX(0);
        bolts.AddBoltDistY(0);
        bolts.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
        bolts.PartToBeBolted = teklaPart;
        //bolts.PartToBoltTo = teklaPart;
        bolts.FirstPosition = new Tekla.Structures.Geometry3d.Point(PointsIn[0].X, PointsIn[0].Y, PointsIn[0].Z);
        bolts.SecondPosition = new Tekla.Structures.Geometry3d.Point(PointsIn[1].X, PointsIn[1].Y, PointsIn[1].Z);
        bolts.BoltSize = 20;
        bolts.Tolerance = Dim - bolts.BoltSize;

        //bolts.BoltStandard = "EN-14399-4";

        //bolts.Position.Depth = Position.DepthEnum.MIDDLE;
        //bolts.Position.Plane = Position.PlaneEnum.MIDDLE;
        //bolts.Position.Rotation = Position.RotationEnum.TOP;
        
        if(!bolts.Insert())
        {
            Print("doesn't work");
        }

        PartOut = bolts;
        model.CommitChanges();
    }
}

I understand problem now:
it’s not a problem with a bentPlate, I had a problem with a points. My model Rhino has meter like unit, so points in input have it also, but Tekla works just with a mm. Solution:

var k = 1000;
B.FirstPosition  = new Tekla.Structures.Geometry3d.Point(PointsIn[0].X*k, PointsIn[0].Y*k, PointsIn[0].Z*k);
B.SecondPosition = new Tekla.Structures.Geometry3d.Point(PointsIn[1].X*k, PointsIn[1].Y*k, PointsIn[1].Z*k);
1 Like