public static void Run(Tekla.Technology.Akit.IScript akit) { Model model = new Model(); ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects(); Tekla.Structures.Model.UI.Picker picker = new Tekla.Structures.Model.UI.Picker(); if (modelObjectEnum.GetSize() == 0) { modelObjectEnum = picker.PickObjects(Tekla.Structures.Model.UI.Picker.PickObjectsEnum.PICK_N_PARTS); } ArrayList arrayPoints = picker.PickPoints(Tekla.Structures.Model.UI.Picker.PickPointEnum.PICK_TWO_POINTS); Point point1 = (Tekla.Structures.Geometry3d.Point)arrayPoints[0]; Point point2 = (Tekla.Structures.Geometry3d.Point)arrayPoints[1]; Line line = new Tekla.Structures.Geometry3d.Line(point1, point2); while (modelObjectEnum.MoveNext()) { if (modelObjectEnum.Current is Beam) { Beam beam = (Beam)modelObjectEnum.Current; Line line2 = new Line(beam.StartPoint, beam.EndPoint); Point intersection = Intersection.LineToLine(line, line2).Point1; Tekla.Structures.Model.Operations.Operation.Split(beam, intersection); } } model.CommitChanges(); }
public override List <InputDefinition> DefineInput() { TSM.UI.Picker PointPicker = new TSM.UI.Picker(); List <InputDefinition> PointList = new List <InputDefinition>(); TSG.Point InputPoint = PointPicker.PickPoint(); InputDefinition InputDef = new InputDefinition(InputPoint); PointList.Add(InputDef); return(PointList); }
private void btnInquire_Click(object sender, EventArgs e) { try { akit.ValueChange("main_frame", "depth_position_om", "3"); Model model = new Model(); TransformationPlane transformationplane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane()); Tekla.Structures.Model.UI.Picker picker = new Tekla.Structures.Model.UI.Picker(); Tekla.Structures.Geometry3d.Point point = picker.PickPoint(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationplane); //MessageBox.Show("X = " + point.X.ToString("F02") + "\nY = " + point.Y.ToString("F02") + "\nZ = " + point.Z.ToString("F02")); textBox1.Text = point.X.ToString("F02"); textBox2.Text = point.Y.ToString("F02"); textBox3.Text = point.Z.ToString("F02"); } catch { } }
public static void Run(Tekla.Technology.Akit.IScript akit) { try { akit.ValueChange("main_frame", "depth_position_om", "3"); akit.CommandStart("ail_create_basic_view", "", "main_frame"); Model model = new Model(); TransformationPlane transformationplane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane()); Tekla.Structures.Model.UI.Picker picker = new Tekla.Structures.Model.UI.Picker(); Tekla.Structures.Geometry3d.Point point = picker.PickPoint(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(transformationplane); akit.ValueChange("Modelling create view", "v1_coordinate", point.Z.ToString("F02")); akit.PushButton("v1_create", "Modelling create view"); //akit.PushButton("v1_create_cancel", "Modelling create view"); } catch { } }
static void Main(string[] args) { var picker = new TSM.UI.Picker(); var result = picker.PickObject(TSM.UI.Picker.PickObjectEnum.PICK_ONE_PART); TSM.Part part = result as TSM.Part; string profileType = null; part.GetReportProperty("PROFILE_TYPE", ref profileType); string dstv = string.Empty; bool success = TSM.Operations.Operation.CreateNCFilesByPartId("DSTV - Shafts", "", part.Identifier, out dstv); string[] dstvLines = dstv.Split(new string[] { "\n" }, StringSplitOptions.None); string dstvCode = dstvLines[9].Trim(); Console.WriteLine($"PROFILE_TYPE: {profileType}"); Console.WriteLine($"DSTV CODE: {dstvCode}"); Console.ReadKey(); }
private void button1_Click(object sender, EventArgs e) { try { TransformationPlane currentTransformationPlane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane(); model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane()); Tekla.Structures.Model.UI.Picker picker = new Tekla.Structures.Model.UI.Picker(); Tekla.Structures.Model.ModelObject modelObject = picker.PickObject(Tekla.Structures.Model.UI.Picker.PickObjectEnum.PICK_ONE_PART); ArrayList array = new ArrayList(); array = picker.PickPoints(Tekla.Structures.Model.UI.Picker.PickPointEnum.PICK_TWO_POINTS, ""); Tekla.Structures.Model.Part beam = (Tekla.Structures.Model.Part)modelObject; Phase phase = new Phase(); beam.GetPhase(out phase); Tekla.Structures.Geometry3d.Point point1 = (Tekla.Structures.Geometry3d.Point)array[0]; Tekla.Structures.Geometry3d.Point point2 = (Tekla.Structures.Geometry3d.Point)array[1]; double offset = 0; double spacing = 0; double centres = 0; double.TryParse(textBox1.Text, out offset); double.TryParse(textBox2.Text, out spacing); double.TryParse(textBox3.Text, out centres); Tekla.Structures.Geometry3d.LineSegment lineSegment = new Tekla.Structures.Geometry3d.LineSegment(point1, point2); double count = (lineSegment.Length() - offset - 15) / spacing; count = Math.Truncate(count); if (checkBox1.Checked) { ArrayList PartDblRepPropNames = new ArrayList(); PartDblRepPropNames.Add("PROFILE.WIDTH"); Hashtable dblProps = new Hashtable(); beam.GetDoubleReportProperties(PartDblRepPropNames, ref dblProps); double length = (double)dblProps["PROFILE.WIDTH"]; if (length < 171) { MessageBox.Show("Warning: Flange to small"); } BoltXYList staggeredBolt = new BoltXYList(); staggeredBolt.FirstPosition = point1; staggeredBolt.SecondPosition = point2; staggeredBolt.PartToBoltTo = beam; staggeredBolt.PartToBeBolted = beam; staggeredBolt.BoltSize = 19.05; staggeredBolt.Tolerance = 2; staggeredBolt.BoltStandard = "NELSON"; staggeredBolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP; staggeredBolt.CutLength = 100; staggeredBolt.Length = 100; staggeredBolt.ExtraLength = 100; staggeredBolt.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_YES; staggeredBolt.Position.Depth = Position.DepthEnum.MIDDLE; staggeredBolt.Position.Plane = Position.PlaneEnum.MIDDLE; staggeredBolt.Position.Rotation = Position.RotationEnum.FRONT; staggeredBolt.Bolt = true; staggeredBolt.Washer1 = staggeredBolt.Washer2 = staggeredBolt.Washer3 = staggeredBolt.Nut1 = staggeredBolt.Nut2 = false; staggeredBolt.Hole1 = staggeredBolt.Hole2 = staggeredBolt.Hole3 = staggeredBolt.Hole4 = staggeredBolt.Hole5 = false; staggeredBolt.StartPointOffset.Dx = offset; staggeredBolt.AddBoltDistX(0); staggeredBolt.AddBoltDistY(centres / 2); int side = 1; for (int i = 1; i <= count; i++) { side = side * -1; staggeredBolt.AddBoltDistX(i * spacing); staggeredBolt.AddBoltDistY(side * (centres / 2)); } staggeredBolt.Insert(); staggeredBolt.SetPhase(phase); staggeredBolt.Modify(); } if (!checkBox1.Checked) { BoltArray bolt = new BoltArray(); bolt.FirstPosition = point1; bolt.SecondPosition = point2; bolt.PartToBoltTo = beam; bolt.PartToBeBolted = beam; bolt.BoltSize = 19.05; bolt.Tolerance = 2; bolt.BoltStandard = "NELSON"; bolt.BoltType = BoltGroup.BoltTypeEnum.BOLT_TYPE_WORKSHOP; bolt.CutLength = 100; bolt.Length = 100; bolt.ExtraLength = 100; bolt.ThreadInMaterial = BoltGroup.BoltThreadInMaterialEnum.THREAD_IN_MATERIAL_YES; bolt.Position.Depth = Position.DepthEnum.MIDDLE; bolt.Position.Plane = Position.PlaneEnum.MIDDLE; bolt.Position.Rotation = Position.RotationEnum.FRONT; bolt.Bolt = true; bolt.Washer1 = bolt.Washer2 = bolt.Washer3 = bolt.Nut1 = bolt.Nut2 = false; bolt.Hole1 = bolt.Hole2 = bolt.Hole3 = bolt.Hole4 = bolt.Hole5 = false; bolt.StartPointOffset.Dx = offset; bolt.AddBoltDistX(0); bolt.AddBoltDistY(centres); for (int i = 1; i <= count; i++) { bolt.AddBoltDistX(spacing); } bolt.Insert(); bolt.SetPhase(phase); bolt.Modify(); } model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTransformationPlane); model.CommitChanges(); } catch { } }