Ejemplo n.º 1
0
        public static void Run(Tekla.Technology.Akit.IScript akit)
        {
            ModelViewEnumerator ViewEnum = ViewHandler.GetVisibleViews();

            while (ViewEnum.MoveNext())
            {
                ;
            }
            {
                View ActiveView = ViewEnum.Current;
                ClipPlaneCollection ClipPlanes = ActiveView.GetClipPlanes();
                if (ClipPlanes.Count > 0)
                {
                    IEnumerator PlaneEnum = ClipPlanes.GetEnumerator();
                    while (PlaneEnum.MoveNext())
                    {
                        ClipPlane CPlane = PlaneEnum.Current as ClipPlane;
                        if (CPlane != null)
                        {
                            CPlane.Delete();
                        }
                    }
                }
            }
        }
 public static dynamic GetTSObject(ModelViewEnumerator dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            ModelViewEnumerator viewEnum = ViewHandler.GetTemporaryViews();

            while (viewEnum.MoveNext())
            {
                var currentView = viewEnum.Current;
                ViewHandler.HideView(currentView);
            }

            var picker     = new Picker();
            var connection = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT) as Connection;

            if (connection == null)
            {
                return;
            }

            var origin = connection.GetCoordinateSystem().Origin;

            var minPoint = new Point
            {
                X = origin.X - 200,
                Y = origin.Y - 200,
                Z = origin.Z - 300
            };

            var maxPoint = new Point
            {
                X = origin.X + 200,
                Y = origin.Y + 200,
                Z = origin.Z + 300
            };
            var name = $"Connection: {connection.Name} ({connection.Identifier.ID})";
            var view = new View
            {
                Name = name,
                ViewCoordinateSystem =
                {
                    AxisX  = new Vector(1, 0, 0),
                    AxisY  = new Vector(0, 1, 0),
                    Origin = origin
                },
                DisplayCoordinateSystem = new CoordinateSystem()
                {
                    AxisX  = new Vector(1, -.7, 0),
                    AxisY  = new Vector(0, 1, 2),
                    Origin = origin
                },
                WorkArea =
                {
                    MinPoint = minPoint,
                    MaxPoint = maxPoint
                },
                ViewDepthUp   = 500,
                ViewDepthDown = 500,
            };

            view.Insert();

            var views = ViewHandler.GetAllViews();

            while (views.MoveNext())
            {
                var currentView = views.Current;
                if (currentView.Name == name)
                {
                    ViewHandler.ShowView(currentView);
                }
            }
        }