Created
October 11, 2017 14:34
-
-
Save dalenicholls/bcd676997bbb31dcbdf9408aa6201ceb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// these are references that Tekla Structures need to understand the code we've written. | |
using Tekla.Structures; | |
using Tekla.Structures.Model; | |
using Tekla.Structures.Drawing; | |
namespace Tekla.Technology.Akit.UserScript | |
{ | |
public class Script | |
{ | |
public static void Run(Tekla.Technology.Akit.IScript akit) | |
{ | |
// this try/catch statement basically tries to stop the program if it breaks. | |
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); | |
// here we've replaced "1000.000000" with point.Z.ToString("F02"). | |
// this takes the Z coordinate of the point the user picks and inserts it into the dialog for them | |
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 { } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment