コード例 #1
0
 public int SaveCutPlaneDetails(int cutPlaneId, string cutPlaneName, string cutPlaneDescription, string cutPlaneType, int mapId)
 {
     try
     {
         int cpid = 0;
         //string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["EpicDB"].ConnectionString;
         //EpicCutPlanes epicCutPlanes = new EpicCutPlanes(ConnectionString);
         //  EpicMembershipUser user = EpicMembership.GetUser(Context.User.Identity.Name);
         //Log.Debug("SaveCutPlaneDetails: Saving record for cutplane " + cutplaneId);
         CutPlane cutplane = new CutPlane();
         cutplane.Id            = cutPlaneId; //.ToInt32();
         cutplane.DateCreated   = DateTime.Now;
         cutplane.Name          = cutPlaneName;
         cutplane.Description   = cutPlaneDescription;
         cutplane.TypeId        = EpicCutPlanes.GetCutPlaneTypeId(cutPlaneType); //.SelectedValue.ToInt32();
         cutplane.MapId         = mapId;
         cutplane.UserCreatedId = 1;                                             //  user.EpicUserId;
         //cutplane.UserUpdatedId =  user.EpicUserId;
         cpid = EpicCutPlanes.SaveCutPlanebyID(cutplane);
         //cpid = cutplane.Id;
         //Log.Debug("CutPlaneManagement::SaveCutPlaneDetails: Save successful for cutplane " + cpid);
         return(cpid);
     }
     catch (Exception ex)
     {
         //Log.Error("CutPlaneManagement::SaveCutPlaneDetails: Exception" + ex.Message + ex.StackTrace);
         throw;
     }
 }
コード例 #2
0
        private void TryApplyCuts(Part part, List <Tuple <Tuple <Point, Point, Point>, Plane> > cutPlanes)
        {
            if (null == cutPlanes)
            {
                return;
            }

            var partBox = part.GetSolid();

            // check collision
            foreach (var cutPlaneDef in cutPlanes)
            {
                var operativePart = cutPlaneDef.Item2;
                var pps           = cutPlaneDef.Item1;
                var intersection  = partBox.IntersectAllFaces(pps.Item1, pps.Item2, pps.Item3);
                if (intersection.IsNullOrEmpty())
                {
                    continue;
                }

                var cutPlane = new CutPlane();
                cutPlane.Father = part;
                cutPlane.Plane  = operativePart;
                if (!cutPlane.Insert())
                {
                    Tracer._trace("Insert failed!");
                }
                //Tracer._trace($"Cut solid: {part.Name}.");
            }
        }
コード例 #3
0
 public List <CutPlane> GetAllCutPlanes()
 {
     try
     {
         List <CutPlane> cutPlanes             = EpicCutPlanes.GetCutPlanes();
         List <CutPlane> serializableCutPlanes = new List <CutPlane>();
         foreach (CutPlane cutPlane in cutPlanes)
         {
             CutPlane serializablecutPlane = new CutPlane();
             serializablecutPlane.Id            = cutPlane.Id;
             serializablecutPlane.DateCreated   = cutPlane.DateCreated;
             serializablecutPlane.DateUpdated   = cutPlane.DateUpdated;
             serializablecutPlane.Description   = cutPlane.Description;
             serializablecutPlane.Name          = cutPlane.Name;
             serializablecutPlane.TypeId        = cutPlane.TypeId;
             serializablecutPlane.UserCreatedId = cutPlane.UserCreatedId;
             serializablecutPlane.UserUpdatedId = cutPlane.UserUpdatedId;
             serializableCutPlanes.Add(serializablecutPlane);
         }
         return(serializableCutPlanes);
     }
     catch (Exception ex)
     {
         //Log.Error("CutPlaneManagement::GetAllCutPlanes: Exception" + ex.Message + ex.StackTrace);
         throw;
     }
 }
コード例 #4
0
        public Beam CutBeamByPart(Beam beam, Part part, bool startSideCut = true)
        {
            // вырезаем ThasBeam по MainBeam
            var         partClass = part.Class;
            BooleanPart Beam      = new BooleanPart();

            Beam.Father = beam;
            part.Class  = BooleanPart.BooleanOperativeClassName;
            Beam.SetOperativePart(part);
            Beam.Insert();
            part.Class = partClass;
            part.Modify();

            // создаем режущую плоскость, чтобы отбросить
            //..(левую) часть ThisBeam по плоскости MainBeam
            CutPlane BeamLineCut = new CutPlane();

            BeamLineCut.Father = beam;
            Plane BeamCutPlane = new Plane();
            var   cs           = part.GetCoordinateSystem();

            if (startSideCut)
            {
                cs.AxisX *= -1;
            }
            BeamCutPlane.AxisX  = cs.AxisX;
            BeamCutPlane.AxisY  = cs.AxisY;
            BeamCutPlane.Origin = cs.Origin;
            BeamLineCut.Plane   = BeamCutPlane;
            BeamLineCut.Insert();

            Model.CommitChanges();

            return(beam);
        }
コード例 #5
0
 /// <summary>
 /// Inserts the input CutPlane Object into the Db or updates the existing CutPlane object (based on ID)
 /// </summary>
 /// <param name="substation">CutPlane Object</param>
 /// <returns>db identity</returns>
 public void SaveCutPlanebyID(CutPlane cp)
 {
     if (cp == null)
     {
         return;
     }
     EpicCutPlanes.SaveCutPlanebyID(cp);
 }
コード例 #6
0
 public static dynamic GetTSObject(CutPlane dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
コード例 #7
0
        public override MapItem Deserialize(BinaryReader r)
        {
            var plane = new CutPlane(false);

            ReadKdopItem(r, plane);

            plane.Nodes = ReadNodeRefList(r);

            return(plane);
        }
コード例 #8
0
        public void CK10_ApplyFitting()
        {
            // Current Workplane. Reminder how the user had the model before you did stuff.
            TransformationPlane CurrentPlane = Model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

            Picker Picker     = new Picker();
            Beam   PickedBeam = null;

            try
            {
                PickedBeam = (Beam)Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
            }
            catch { PickedBeam = null; }
            if (PickedBeam != null)
            {
                // Change the workplane to the coordinate system of the Beam
                var psk = new TransformationPlane(PickedBeam.GetCoordinateSystem());
                Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(psk);

                // Applyfitting
                Fitting BeamFitting = new Fitting();
                BeamFitting.Father = PickedBeam;
                Plane FittingPlane = new Plane();
                FittingPlane.Origin = new T3D.Point(500, 0, 0);
                FittingPlane.AxisX  = new T3D.Vector(0, 0, 500);
                FittingPlane.AxisY  = new T3D.Vector(0, -500, 0);
                BeamFitting.Plane   = FittingPlane;
                BeamFitting.Insert();

                // Apply Line Cut
                CutPlane BeamLineCut = new CutPlane();
                BeamLineCut.Father = PickedBeam;
                Plane BeamCutPlane = new Plane();
                BeamCutPlane.Origin = new T3D.Point(200, 0, 0);
                BeamCutPlane.AxisX  = new T3D.Vector(0, 0, 500);
                // Changing the positive vs. negative value here determines which direction
                // the line cut will take away material where as fitting looks at which end
                // of beam it is closest to figure out how to cut.
                BeamCutPlane.AxisX = new T3D.Vector(0, -500, 0);
                BeamLineCut.Plane  = BeamCutPlane;
                BeamLineCut.Insert();

                // SetWorkplane back to what user had before
                Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentPlane);

                // Show the plate in the model and the workplane change
                Model.CommitChanges();

                // Draw Positive Z axis.
                GraphicsDrawer Drawer = new GraphicsDrawer();
                var            red    = new Color(1, 0, 0);
                Drawer.DrawLineSegment(new T3D.Point(0, 0, 0), new T3D.Point(0, 0, 500), red);
            }
            Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
        }
コード例 #9
0
        public void UT_CutBeamByLine()
        {
            // Пример 1: из TeklaAPI CutPlate Example
            //.. создает балку в [0,0 - 1000,0] и обрезает ее по CutPlate
            Point Point  = new Point(0, 0, 0);
            Point Point2 = new Point(1000, 0, 0);

            ThisBeam                       = new Beam();
            ThisBeam.StartPoint            = Point;
            ThisBeam.EndPoint              = Point2;
            ThisBeam.Profile.ProfileString = "HEA400";
            ThisBeam.Finish                = "PAINT";
            ThisBeam.Insert();
            Model.CommitChanges();

            CutPlane CutPlane = new CutPlane();

            CutPlane.Plane        = new Plane();
            CutPlane.Plane.Origin = new Point(400, 0, 0);
            CutPlane.Plane.AxisX  = new Vector(0, 500, 0);
            CutPlane.Plane.AxisY  = new Vector(0, 0, -1000);
            CutPlane.Father       = ThisBeam;
            CutPlane.Insert();
            Model.CommitChanges();
            // В результате на экране Tekla создается балка вдоль оси Х
            //..и стирается ее часть, ближняя к точке (0,0) на Х=400.
            //..Чтобы стирать другую часть балки, поменяйте

            // test 0: создаем балку вдоль оси Х, а потом ее стираем
            Point p1 = new Point(0, 2500, 0);
            Point p2 = new Point(2500, 0, 0);

            MainBeam = _TS.CreateBeam("MainBeam", "I50B1_20_93", p1, p2);

            // создаем режущую плоскость
            CutPlane BeamLineCut = new CutPlane();

            // Father - Объект модели над которым выполняется действие
            BeamLineCut.Father = this.MainBeam;
            Plane BeamCutPlane = new Plane();

            BeamCutPlane.Origin = new Point(1000, 0, 0);
            BeamCutPlane.AxisX  = new Vector(0, 0, 500);
            // Changing the positive vs. negative value here determines which direction
            // the line cut will take away material where as fitting looks at which end
            // of beam it is closest to figure out how to cut.
            BeamCutPlane.AxisY = new Vector(0, -500, 0);
            BeamLineCut.Plane  = BeamCutPlane;
            BeamLineCut.Insert();

            Model.CommitChanges();
        }
コード例 #10
0
        private void btnApplyFitting_Click(object sender, EventArgs e)
        {
            // Current workplane. Remember how the user had the model before you changed things.
            TransformationPlane currentPlane = currentModel.GetWorkPlaneHandler().GetCurrentTransformationPlane();

            TSMUI.Picker myPicker    = new TSMUI.Picker();
            Beam         currentBeam = null;

            try
            {
                currentBeam = myPicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as Beam;
            }
            catch
            {
                currentBeam = null;
            }

            if (currentBeam != null)
            {
                // Change the workplane to the coordinate system of the beam.
                currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(currentBeam.GetCoordinateSystem()));

                // Apply fitting
                Fitting beamFitting = new Fitting();
                beamFitting.Father = currentBeam;
                Plane fittingPlane = new Plane();
                fittingPlane.Origin = new T3D.Point(500, 0, 0);
                fittingPlane.AxisX  = new T3D.Vector(0, 0, 500);
                fittingPlane.AxisY  = new T3D.Vector(0, 500, 0);
                beamFitting.Plane   = fittingPlane;
                beamFitting.Insert();

                // Apply cut line
                CutPlane beamLineCut = new CutPlane();
                beamLineCut.Father = currentBeam;
                Plane beamCutPlane = new Plane();
                beamCutPlane.Origin = new T3D.Point(2000, 0, 0);
                beamCutPlane.AxisX  = new T3D.Vector(0, 0, 500);
                // Changing positive vs. negative value here determines which direction
                // the line cut will take away material where as fittin glooks at which end
                // of the beam it is closest to to figure out how to cut
                beamCutPlane.AxisY = new T3D.Vector(0, -500, 0);
                beamLineCut.Plane  = beamCutPlane;
                beamLineCut.Insert();

                // Setworkplane back to what user had before
                currentModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);

                // Show the fitting in the model but the user will never see the workplane change
                currentModel.CommitChanges();
            }
        }
コード例 #11
0
ファイル: MbdFile.cs プロジェクト: anodern/route-making-tool
        public void ReadFile()
        {
            origins = new Origin[originCount];
            for (uint i = 0; i < originCount; i++)
            {
                uint nodeType = br.ReadUInt32();
                switch (nodeType)
                {
                case 0x02: origins[i] = new Road(br); break;

                case 0x03: origins[i] = new Prefab(br); break;

                case 0x01: origins[i] = new Building(br); break;

                case 0x04: origins[i] = new Model(br); break;

                case 0x07: origins[i] = new CutPlane(br); break;

                case 0x08: origins[i] = new Mover(br); break;

                case 0x0B: origins[i] = new City(br); break;

                case 0x0D: origins[i] = new QuestPoint(br); break;

                case 0x0A: origins[i] = new NoWeather(br); break;

                case 0x0E: origins[i] = new BusStop(br); break;

                //case 0x0F: System.Diagnostics.Debug.WriteLine("原点:"+i+"|AnimatedModel:"+nodeType); break;
                case 0x10: origins[i] = new MissionModel(br); break;

                default: {
                    //System.Diagnostics.Debug.WriteLine("原点:"+i+"|错误的原点类型:"+nodeType);
                    //System.Diagnostics.Debug.WriteLine("\t\t|位置:"+br.BaseStream.Position);
                    continue;
                }
                }
                //System.Diagnostics.Debug.WriteLine("原点:"+i+"|类型:"+origins[i].ToString()+"|位置:"+br.BaseStream.Position);
            }
            nodes = new Node[nodeCount];
            for (uint i = 0; i < nodeCount; i++)
            {
                nodes[i] = new Node(br);
            }
        }
コード例 #12
0
        //PKh 7/6/18
        public Beam CutBeamByLine(Beam beam, CutPlane cutPlane)
        {
            // Apply Line Cut
            CutPlane BeamLineCut = new CutPlane();

            BeamLineCut.Father = beam;
            Plane BeamCutPlane = new Plane();

            BeamCutPlane.Origin = new T3D.Point(200, 0, 0);
            BeamCutPlane.AxisX  = new T3D.Vector(0, 0, 500);
            // Changing the positive vs. negative value here determines which direction
            // the line cut will take away material where as fitting looks at which end
            // of beam it is closest to figure out how to cut.
            BeamCutPlane.AxisX = new T3D.Vector(0, -500, 0);
            BeamLineCut.Plane  = BeamCutPlane;
            BeamLineCut.Insert();
            return(beam);
        }
コード例 #13
0
        /// <summary>
        /// Inserts a new CutPlane object to Db or updates any existing CutPlane object (based on CutPlane ID)
        /// </summary>
        /// <param name="cutplane">Cutplane object</param>
        public int SaveCutPlanebyID(CutPlane cutplane)
        {
            CutPlane currentCutplane = (from s in this.Context.CutPlanes.Where(cp => cp.Id.Equals(cutplane.Id))
                                        select s).FirstOrDefault();

            if (currentCutplane != null)
            {
                currentCutplane.DateUpdated   = cutplane.DateCreated; // DateTime.Now;
                currentCutplane.UserUpdatedId = cutplane.UserCreatedId;
                currentCutplane.Name          = cutplane.Name;
                currentCutplane.TypeId        = cutplane.TypeId;
                currentCutplane.Description   = cutplane.Description;
                cutplane.Id = currentCutplane.Id;
            }
            else
            {
                this.Context.CutPlanes.Add(cutplane);
            }
            this.Context.SaveChanges();
            return(cutplane.Id);
        }
コード例 #14
0
 public CutPlane GetCutPlane(int cutPlaneID)
 {
     try
     {
         CutPlane cutplane             = EpicCutPlanes.GetCutPlane(cutPlaneID);
         CutPlane serializablecutplane = new CutPlane();
         serializablecutplane.Id            = cutplane.Id;
         serializablecutplane.DateCreated   = cutplane.DateCreated;
         serializablecutplane.DateUpdated   = cutplane.DateUpdated;
         serializablecutplane.Description   = cutplane.Description;
         serializablecutplane.Name          = cutplane.Name;
         serializablecutplane.TypeId        = cutplane.TypeId;
         serializablecutplane.MapId         = cutplane.MapId;
         serializablecutplane.UserCreatedId = cutplane.UserCreatedId;
         serializablecutplane.UserUpdatedId = cutplane.UserUpdatedId;
         return(serializablecutplane);
     }
     catch (Exception ex)
     {
         //Log.Error("CutPlaneManagement::GetCutPlane: Exception" + ex.Message + ex.StackTrace);
         throw;
     }
 }
コード例 #15
0
        public static void Main(string[] args)
        {
            var model          = new Model();
            var graphicsDrawer = new GraphicsDrawer();
            var picker         = new Picker();
            var red            = new Color(1, 0, 0);
            var white          = new Color(1, 1, 1);
            var blue           = new Color(0, 0, 1);
            var green          = new Color(0, 1, 0);
            var black          = new Color(0, 0, 0);

            try
            {
                var savedPlane = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());

                var part1 = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "Pick Part") as Part;
                var solid = part1.GetSolid();

                var maximumPoint = solid.MaximumPoint;
                var minimumPoint = solid.MinimumPoint;

                graphicsDrawer.DrawText(maximumPoint, maximumPoint.ToString(), white);
                graphicsDrawer.DrawText(minimumPoint, maximumPoint.ToString(), white);

                var part2 = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "Pick Part") as Part;

                var part2CoordinateSystem = part2.GetCoordinateSystem();
                var origin     = part2CoordinateSystem.Origin;
                var xDirection = origin + part2CoordinateSystem.AxisX;
                var yDirection = origin + part2CoordinateSystem.AxisY;

                var xAxis = new LineSegment(origin, xDirection);
                var yAxis = new LineSegment(origin, yDirection);

                graphicsDrawer.DrawLineSegment(xAxis, blue);
                graphicsDrawer.DrawLineSegment(yAxis, red);

                graphicsDrawer.DrawText(origin, "ORIGIN", white);
                graphicsDrawer.DrawText(xDirection, "XAXIS", blue);
                graphicsDrawer.DrawText(yDirection, "YAXIS", red);


                var intersectionPoints = solid.GetAllIntersectionPoints(part2CoordinateSystem.Origin, part2CoordinateSystem.AxisX, part2CoordinateSystem.AxisY);

                while (intersectionPoints.MoveNext())
                {
                    var point = intersectionPoints.Current as Point;
                    graphicsDrawer.DrawText(point, point.ToString(), green);
                }

                var plane = new Plane()
                {
                    Origin = origin,
                    AxisX  = part2CoordinateSystem.AxisX,
                    AxisY  = part2CoordinateSystem.AxisY,
                };

                var cut = new CutPlane()
                {
                    Father     = part1,
                    Identifier = new Identifier(new Guid()),
                    Plane      = plane,
                };

                cut.Insert();
                model.CommitChanges();

                var part2Centerline = part2.GetCenterLine(false);
                var intersect       = solid.Intersect(new LineSegment(part2Centerline[0] as Point, part2Centerline[1] as Point));

                var point1 = intersect[0] as Point;
                var point2 = intersect[1] as Point;

                graphicsDrawer.DrawText(point1, "POINT1", red);
                graphicsDrawer.DrawText(point2, "POINT2", blue);

                model.GetWorkPlaneHandler().SetCurrentTransformationPlane(savedPlane);

                var currentViews = ViewHandler.GetAllViews();
                while (currentViews.MoveNext())
                {
                    var currentView = currentViews.Current;
                    currentView.Select();
                    currentView.VisibilitySettings.WeldsVisible                = false;
                    currentView.VisibilitySettings.WeldsVisibleInComponents    = false;
                    currentView.VisibilitySettings.ComponentsVisible           = false;
                    currentView.VisibilitySettings.FittingsVisible             = false;
                    currentView.VisibilitySettings.FittingsVisibleInComponents = false;
                    currentView.Modify();
                }

                var faces    = picker.PickFace("Pick Face");
                var vertices = faces.OfType <InputItem>().ToList()[1].GetData() as ArrayList;
                foreach (Point vertex in vertices)
                {
                    graphicsDrawer.DrawText(vertex, vertex.ToString(), black);
                }

                plane = new Plane
                {
                    Origin = vertices[0] as Point,
                    AxisX  = new Vector((vertices[1] as Point) - (vertices[0] as Point)),
                    AxisY  = new Vector((vertices[2] as Point) - (vertices[0] as Point)),
                };

                cut = new CutPlane
                {
                    Father     = part1,
                    Identifier = new Identifier(new Guid()),
                    Plane      = plane,
                };

                cut.Insert();
                model.CommitChanges();
            }
            catch (Exception ex)
            {
                // ignored
            }
        }
コード例 #16
0
ファイル: Vliering.cs プロジェクト: domagalec/KneeWallPlugin
        private void SetUpRafters(Point StartPoint, Point EndPoint, Point DirectionPoint)
        {
            Phase phase = new Phase();

            phase.PhaseNumber = 3;

            Rafters        = new Beam[5];
            TopBeam        = new Beam();
            BottomBeam     = new Beam();
            SheatingPanels = new Beam[2];

            for (int i = 0; i < Rafters.Length; i++)
            {
                Rafters[i] = new Beam(Beam.BeamTypeEnum.BEAM);
                Rafters[i].Profile.ProfileString = _BeamProfile;
                Rafters[i].Name = _BeamName;
                Rafters[i].Material.MaterialString = _BeamMaterial;
                Rafters[i].PartNumber.Prefix       = "Sp";
                Rafters[i].AssemblyNumber.Prefix   = "Sp";
                Rafters[i].Finish = _BeamFinish;
                Rafters[i].Class  = _BeamClass;
            }

            TopBeam = new Beam(Beam.BeamTypeEnum.BEAM);
            TopBeam.Profile.ProfileString = _BeamProfile;
            TopBeam.Name = _BeamName;
            TopBeam.Material.MaterialString = _BeamMaterial;
            TopBeam.PartNumber.Prefix       = "Sp";
            TopBeam.AssemblyNumber.Prefix   = "Sp";
            TopBeam.Finish = _BeamFinish;
            TopBeam.Class  = _BeamClass;

            BottomBeam = new Beam(Beam.BeamTypeEnum.BEAM);
            BottomBeam.Profile.ProfileString = _BeamProfile;
            BottomBeam.Name = _BeamName;
            BottomBeam.Material.MaterialString = _BeamMaterial;
            BottomBeam.PartNumber.Prefix       = "Sp";
            BottomBeam.AssemblyNumber.Prefix   = "Sp";
            BottomBeam.Finish = _BeamFinish;
            BottomBeam.Class  = _BeamClass;

            Drukregel = new Beam(Beam.BeamTypeEnum.BEAM);
            Drukregel.Profile.ProfileString = _DrukregelProfile;
            Drukregel.Name = _DrukregelName;
            Drukregel.Material.MaterialString = _DrukregelMaterial;
            Drukregel.PartNumber.Prefix       = "Dr";
            Drukregel.AssemblyNumber.Prefix   = "Dr";
            Drukregel.Finish = _DrukregelFinish;
            Drukregel.Class  = _DrukregelClass;

            if (DirectionPoint.Y > StartPoint.Y)
            {
                Rafters.First().Position.Plane = Position.PlaneEnum.LEFT;
                Rafters.First().Position.Rotation = Position.RotationEnum.TOP;
                Rafters.First().Position.Depth = Position.DepthEnum.BEHIND;
                Rafters.First().StartPoint = new Point(StartPoint);
                Rafters.First().EndPoint   = new Point(EndPoint);
                Rafters.First().Insert();
                Rafters.First().SetPhase(phase);

                //TransformationPlane tp = new TransformationPlane(Rafters.First().GetCoordinateSystem());
                //Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(tp);

                double MinimumX = Rafters.First().GetSolid().MinimumPoint.X;
                double MinimumY = Rafters.First().GetSolid().MinimumPoint.Y;
                double MinimumZ = Rafters.First().GetSolid().MinimumPoint.Z;
                double MaximumX = Rafters.First().GetSolid().MaximumPoint.X;
                double MaximumY = Rafters.First().GetSolid().MaximumPoint.Y;
                double MaximumZ = Rafters.First().GetSolid().MaximumPoint.Z;

                Rafters.Last().Position.Plane = Position.PlaneEnum.LEFT;
                Rafters.Last().Position.Rotation = Position.RotationEnum.TOP;
                Rafters.Last().Position.Depth = Position.DepthEnum.FRONT;
                Rafters.Last().StartPoint = new Point(MinimumX + _Length, MinimumY, MinimumZ);
                Rafters.Last().EndPoint   = new Point(MinimumX + _Length, MinimumY, MaximumZ);
                Rafters.Last().Insert();
                Rafters.Last().SetPhase(phase);

                TopBeam.Position.Plane    = Position.PlaneEnum.LEFT;
                TopBeam.Position.Rotation = Position.RotationEnum.BELOW;
                TopBeam.Position.Depth    = Position.DepthEnum.FRONT;
                TopBeam.StartPoint        = new Point(MinimumX, MinimumY, MaximumZ);
                TopBeam.EndPoint          = new Point(MinimumX + _Length, MinimumY, MaximumZ);

                if (!TopBeam.Insert())
                {
                    MessageBox.Show("Failed to insert topbeam");
                }

                TopBeam.SetPhase(phase);

                BottomBeam.Position.Plane    = Position.PlaneEnum.LEFT;
                BottomBeam.Position.Rotation = Position.RotationEnum.BELOW;
                BottomBeam.Position.Depth    = Position.DepthEnum.BEHIND;
                BottomBeam.StartPoint        = new Point(MinimumX, MinimumY, MinimumZ);
                BottomBeam.EndPoint          = new Point(MinimumX + _Length, MinimumY, MinimumZ);

                if (!BottomBeam.Insert())
                {
                    MessageBox.Show("Failed to insert bottombeam");
                }

                BottomBeam.SetPhase(phase);

                //INTERMEDIATE
                for (int j = 1; j < Rafters.Length - 1; j++)
                {
                    Rafters[j].Position.Plane    = Position.PlaneEnum.LEFT;
                    Rafters[j].Position.Rotation = Position.RotationEnum.TOP;
                    Rafters[j].Position.Depth    = Position.DepthEnum.MIDDLE;
                    //Rafters[j].StartPoint = tp.TransformationMatrixToLocal.Transform(StartPoint) - new Point(0, j * _Spacing, 0);
                    //Rafters[j].EndPoint = tp.TransformationMatrixToLocal.Transform(EndPoint) - new Point(0, j * _Spacing, 0);

                    Rafters[j].StartPoint = new Point(MinimumX + j * _Spacing, MinimumY, MinimumZ);
                    Rafters[j].EndPoint   = new Point(MinimumX + j * _Spacing, MinimumY, MaximumZ);
                    Rafters[j].Insert();
                    Rafters[j].SetPhase(phase);
                }

                TopBeam.SetUserProperty("USER_FIELD_1", "x");
                BottomBeam.SetUserProperty("USER_FIELD_1", "x");
                Rafters.First().SetUserProperty("USER_FIELD_1", "x");
                Rafters.Last().SetUserProperty("USER_FIELD_1", "x");

                MinimumX = BottomBeam.GetSolid().MinimumPoint.X;
                MinimumY = BottomBeam.GetSolid().MinimumPoint.Y;
                MinimumZ = BottomBeam.GetSolid().MinimumPoint.Z;
                MaximumX = BottomBeam.GetSolid().MaximumPoint.X;
                MaximumY = BottomBeam.GetSolid().MaximumPoint.Y;
                MaximumZ = TopBeam.GetSolid().MaximumPoint.Z;

                for (int i = 0; i < SheatingPanels.Length; i++)
                {
                    SheatingPanels[i] = new Beam(Beam.BeamTypeEnum.BEAM);
                    SheatingPanels[i].Position.Plane          = Position.PlaneEnum.LEFT;
                    SheatingPanels[i].Position.Rotation       = Position.RotationEnum.TOP;
                    SheatingPanels[i].Position.Depth          = Position.DepthEnum.BEHIND;
                    SheatingPanels[i].Profile.ProfileString   = _SheatingProfile;
                    SheatingPanels[i].Material.MaterialString = _SheatingMaterial;
                    SheatingPanels[i].PartNumber.Prefix       = "PL";
                    SheatingPanels[i].AssemblyNumber.Prefix   = "R";
                    SheatingPanels[i].Finish = _SheatingFinish;
                    SheatingPanels[i].Name   = _SheatingName;
                    SheatingPanels[i].Class  = _SheatingClass;

                    if (_SheatingType == 0)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT";
                        SheatingPanels[i].Class = "4";
                    }

                    if (_SheatingType == 1)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT     (wit)";
                        SheatingPanels[i].Class = "5";
                    }
                }

                SheatingPanels.First().StartPoint = new Point(BottomBeam.GetSolid().MinimumPoint.X, BottomBeam.GetSolid().MaximumPoint.Y, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.First().EndPoint   = new Point(BottomBeam.GetSolid().MinimumPoint.X, BottomBeam.GetSolid().MaximumPoint.Y, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.First().Insert();
                SheatingPanels.First().SetPhase(phase);

                SheatingPanels.Last().StartPoint = new Point(BottomBeam.GetSolid().MinimumPoint.X + 1222, BottomBeam.GetSolid().MaximumPoint.Y, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.Last().EndPoint   = new Point(BottomBeam.GetSolid().MinimumPoint.X + 1222, BottomBeam.GetSolid().MaximumPoint.Y, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.Last().Insert();
                SheatingPanels.Last().SetPhase(phase);

                Drukregel.Position.Plane    = Position.PlaneEnum.LEFT;
                Drukregel.Position.Rotation = Position.RotationEnum.BACK;
                Drukregel.Position.Depth    = Position.DepthEnum.FRONT;

                Drukregel.Position.RotationOffset = -90 + _DrukregelAngle;

                Drukregel.StartPoint = new Point(MinimumX, MinimumY - _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));
                Drukregel.EndPoint   = new Point(MinimumX + _Length, MinimumY - _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));

                if (!Drukregel.Insert())
                {
                    MessageBox.Show("Failed to insert drukregel");
                }

                String drukregelComment = Math.Abs(Math.Round(_DrukregelAngle)).ToString();

                Drukregel.SetUserProperty("comment", drukregelComment);
                Drukregel.SetPhase(phase);

                if (_SheatingType == 0)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Naturel");
                    SheatingPanels.Last().SetUserProperty("comment", "Naturel");
                }
                if (_SheatingType == 1)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Wit spanolak");
                    SheatingPanels.Last().SetUserProperty("comment", "Wit spanolak");
                }

                for (int i = 0; i < Rafters.Length; i++)
                {
                    Rafters[i].SetUserProperty("comment", "");
                }

                CutPlane DrukregelCut1 = new CutPlane();
                DrukregelCut1.Plane        = new Plane();
                DrukregelCut1.Plane.Origin = new Point(MinimumX, MaximumY, MaximumZ);
                DrukregelCut1.Plane.AxisX  = new Vector(0, 0, 1);
                DrukregelCut1.Plane.AxisY  = new Vector(1, 0, 0);
                DrukregelCut1.Father       = Drukregel;
                DrukregelCut1.Insert();

                CutPlane DrukregelCut3 = new CutPlane();
                DrukregelCut3.Plane        = new Plane();
                DrukregelCut3.Plane.Origin = new Point(MinimumX, MinimumY, MaximumZ);
                DrukregelCut3.Plane.AxisX  = new Vector(0, 1, 0);
                DrukregelCut3.Plane.AxisY  = new Vector(1, 0, 0);
                DrukregelCut3.Father       = Drukregel;
                DrukregelCut3.Insert();
            }

            else if (DirectionPoint.Y < StartPoint.Y)
            {
                Rafters.First().Position.Plane = Position.PlaneEnum.RIGHT;
                Rafters.First().Position.Rotation = Position.RotationEnum.BELOW;
                Rafters.First().Position.Depth = Position.DepthEnum.FRONT;
                Rafters.First().StartPoint = new Point(StartPoint);
                Rafters.First().EndPoint   = new Point(EndPoint);
                Rafters.First().Insert();
                Rafters.First().SetPhase(phase);

                //TransformationPlane tp = new TransformationPlane(Rafters.First().GetCoordinateSystem());
                //Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(tp);

                double MinimumX = Rafters.First().GetSolid().MinimumPoint.X;
                double MinimumY = Rafters.First().GetSolid().MinimumPoint.Y;
                double MinimumZ = Rafters.First().GetSolid().MinimumPoint.Z;
                double MaximumX = Rafters.First().GetSolid().MaximumPoint.X;
                double MaximumY = Rafters.First().GetSolid().MaximumPoint.Y;
                double MaximumZ = Rafters.First().GetSolid().MaximumPoint.Z;

                Rafters.Last().Position.Plane = Position.PlaneEnum.LEFT;
                Rafters.Last().Position.Rotation = Position.RotationEnum.BELOW;
                Rafters.Last().Position.Depth = Position.DepthEnum.BEHIND;
                Rafters.Last().StartPoint = new Point(MaximumX - _Length, MinimumY, MinimumZ);
                Rafters.Last().EndPoint   = new Point(MaximumX - _Length, MinimumY, MaximumZ);
                Rafters.Last().Insert();
                Rafters.Last().SetPhase(phase);

                TopBeam.Position.Plane    = Position.PlaneEnum.RIGHT;
                TopBeam.Position.Rotation = Position.RotationEnum.BELOW;
                TopBeam.Position.Depth    = Position.DepthEnum.FRONT;
                TopBeam.StartPoint        = new Point(MaximumX, MinimumY, MaximumZ);
                TopBeam.EndPoint          = new Point(MaximumX - _Length, MinimumY, MaximumZ);

                if (!TopBeam.Insert())
                {
                    MessageBox.Show("Failed to insert topbeam");
                }

                TopBeam.SetPhase(phase);

                BottomBeam.Position.Plane    = Position.PlaneEnum.LEFT;
                BottomBeam.Position.Rotation = Position.RotationEnum.BELOW;
                BottomBeam.Position.Depth    = Position.DepthEnum.BEHIND;
                BottomBeam.StartPoint        = new Point(MaximumX, MaximumY, MinimumZ);
                BottomBeam.EndPoint          = new Point(MaximumX - _Length, MaximumY, MinimumZ);

                if (!BottomBeam.Insert())
                {
                    MessageBox.Show("Failed to insert bottombeam");
                }

                BottomBeam.SetPhase(phase);

                //INTERMEDIATE
                for (int j = 1; j < Rafters.Length - 1; j++)
                {
                    Rafters[j].Position.Plane    = Position.PlaneEnum.LEFT;
                    Rafters[j].Position.Rotation = Position.RotationEnum.TOP;
                    Rafters[j].Position.Depth    = Position.DepthEnum.MIDDLE;
                    //Rafters[j].StartPoint = tp.TransformationMatrixToLocal.Transform(StartPoint) - new Point(0, j * _Spacing, 0);
                    //Rafters[j].EndPoint = tp.TransformationMatrixToLocal.Transform(EndPoint) - new Point(0, j * _Spacing, 0);

                    Rafters[j].StartPoint = new Point(MaximumX - j * _Spacing, MinimumY, MinimumZ);
                    Rafters[j].EndPoint   = new Point(MaximumX - j * _Spacing, MinimumY, MaximumZ);
                    Rafters[j].Insert();
                    Rafters[j].SetPhase(phase);
                }

                TopBeam.SetUserProperty("USER_FIELD_1", "x");
                BottomBeam.SetUserProperty("USER_FIELD_1", "x");
                Rafters.First().SetUserProperty("USER_FIELD_1", "x");
                Rafters.Last().SetUserProperty("USER_FIELD_1", "x");

                MinimumX = BottomBeam.GetSolid().MinimumPoint.X;
                MinimumY = BottomBeam.GetSolid().MinimumPoint.Y;
                MinimumZ = BottomBeam.GetSolid().MinimumPoint.Z;
                MaximumX = BottomBeam.GetSolid().MaximumPoint.X;
                MaximumY = BottomBeam.GetSolid().MaximumPoint.Y;
                MaximumZ = TopBeam.GetSolid().MaximumPoint.Z;

                for (int i = 0; i < SheatingPanels.Length; i++)
                {
                    SheatingPanels[i] = new Beam(Beam.BeamTypeEnum.BEAM);
                    SheatingPanels[i].Position.Plane          = Position.PlaneEnum.RIGHT;
                    SheatingPanels[i].Position.Rotation       = Position.RotationEnum.BELOW;
                    SheatingPanels[i].Position.Depth          = Position.DepthEnum.FRONT;
                    SheatingPanels[i].Profile.ProfileString   = _SheatingProfile;
                    SheatingPanels[i].Material.MaterialString = _SheatingMaterial;
                    SheatingPanels[i].PartNumber.Prefix       = "PL";
                    SheatingPanels[i].AssemblyNumber.Prefix   = "R";
                    SheatingPanels[i].Finish = _SheatingFinish;
                    SheatingPanels[i].Name   = _SheatingName;
                    SheatingPanels[i].Class  = _SheatingClass;

                    if (_SheatingType == 0)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT";
                        SheatingPanels[i].Class = "4";
                    }

                    if (_SheatingType == 1)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT     (wit)";
                        SheatingPanels[i].Class = "5";
                    }
                }

                SheatingPanels.First().StartPoint = new Point(BottomBeam.GetSolid().MaximumPoint.X, BottomBeam.GetSolid().MinimumPoint.Y, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.First().EndPoint   = new Point(BottomBeam.GetSolid().MaximumPoint.X, BottomBeam.GetSolid().MinimumPoint.Y, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.First().Insert();
                SheatingPanels.First().SetPhase(phase);

                SheatingPanels.Last().StartPoint = new Point(BottomBeam.GetSolid().MaximumPoint.X - 1222, BottomBeam.GetSolid().MinimumPoint.Y, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.Last().EndPoint   = new Point(BottomBeam.GetSolid().MaximumPoint.X - 1222, BottomBeam.GetSolid().MinimumPoint.Y, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.Last().Insert();
                SheatingPanels.Last().SetPhase(phase);

                Drukregel.Position.Plane    = Position.PlaneEnum.LEFT;
                Drukregel.Position.Rotation = Position.RotationEnum.BACK;
                Drukregel.Position.Depth    = Position.DepthEnum.FRONT;

                Drukregel.Position.RotationOffset = -90 + _DrukregelAngle;

                Drukregel.StartPoint = new Point(MaximumX, MaximumY + _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));
                Drukregel.EndPoint   = new Point(MaximumX - _Length, MaximumY + _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));

                if (!Drukregel.Insert())
                {
                    MessageBox.Show("Failed to insert drukregel");
                }

                String drukregelComment = Math.Abs(Math.Round(_DrukregelAngle)).ToString();

                Drukregel.SetUserProperty("comment", drukregelComment);
                Drukregel.SetPhase(phase);

                if (_SheatingType == 0)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Naturel");
                    SheatingPanels.Last().SetUserProperty("comment", "Naturel");
                }
                if (_SheatingType == 1)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Wit spanolak");
                    SheatingPanels.Last().SetUserProperty("comment", "Wit spanolak");
                }

                for (int i = 0; i < Rafters.Length; i++)
                {
                    Rafters[i].SetUserProperty("comment", "");
                }

                CutPlane DrukregelCut1 = new CutPlane();
                DrukregelCut1.Plane        = new Plane();
                DrukregelCut1.Plane.Origin = new Point(MinimumX, MinimumY, MaximumZ);
                DrukregelCut1.Plane.AxisX  = new Vector(1, 0, 0);
                DrukregelCut1.Plane.AxisY  = new Vector(0, 0, 1);
                DrukregelCut1.Father       = Drukregel;
                DrukregelCut1.Insert();

                CutPlane DrukregelCut3 = new CutPlane();
                DrukregelCut3.Plane        = new Plane();
                DrukregelCut3.Plane.Origin = new Point(MinimumX, MinimumY, MaximumZ);
                DrukregelCut3.Plane.AxisX  = new Vector(0, 1, 0);
                DrukregelCut3.Plane.AxisY  = new Vector(1, 0, 0);
                DrukregelCut3.Father       = Drukregel;
                DrukregelCut3.Insert();
            }

            else if (DirectionPoint.X > StartPoint.X)
            {
                Rafters.First().Position.Plane = Position.PlaneEnum.RIGHT;
                Rafters.First().Position.Rotation = Position.RotationEnum.FRONT;
                Rafters.First().Position.Depth = Position.DepthEnum.BEHIND;
                Rafters.First().StartPoint = new Point(StartPoint);
                Rafters.First().EndPoint   = new Point(EndPoint);
                Rafters.First().Insert();
                Rafters.First().SetPhase(phase);

                //TransformationPlane tp = new TransformationPlane(Rafters.First().GetCoordinateSystem());
                //Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(tp);

                double MinimumX = Rafters.First().GetSolid().MinimumPoint.X;
                double MinimumY = Rafters.First().GetSolid().MinimumPoint.Y;
                double MinimumZ = Rafters.First().GetSolid().MinimumPoint.Z;
                double MaximumX = Rafters.First().GetSolid().MaximumPoint.X;
                double MaximumY = Rafters.First().GetSolid().MaximumPoint.Y;
                double MaximumZ = Rafters.First().GetSolid().MaximumPoint.Z;

                Rafters.Last().Position.Plane = Position.PlaneEnum.LEFT;
                Rafters.Last().Position.Rotation = Position.RotationEnum.FRONT;
                Rafters.Last().Position.Depth = Position.DepthEnum.BEHIND;
                Rafters.Last().StartPoint = new Point(MinimumX, MaximumY - _Length, MinimumZ);
                Rafters.Last().EndPoint   = new Point(MinimumX, MaximumY - _Length, MaximumZ);
                Rafters.Last().Insert();
                Rafters.Last().SetPhase(phase);

                TopBeam.Position.Plane    = Position.PlaneEnum.LEFT;
                TopBeam.Position.Rotation = Position.RotationEnum.BELOW;
                TopBeam.Position.Depth    = Position.DepthEnum.FRONT;
                TopBeam.StartPoint        = new Point(MinimumX, MaximumY, MaximumZ);
                TopBeam.EndPoint          = new Point(MinimumX, MaximumY - _Length, MaximumZ);

                if (!TopBeam.Insert())
                {
                    MessageBox.Show("Failed to insert topbeam");
                }

                TopBeam.SetPhase(phase);

                BottomBeam.Position.Plane    = Position.PlaneEnum.LEFT;
                BottomBeam.Position.Rotation = Position.RotationEnum.BELOW;
                BottomBeam.Position.Depth    = Position.DepthEnum.BEHIND;
                BottomBeam.StartPoint        = new Point(MinimumX, MaximumY, MinimumZ);
                BottomBeam.EndPoint          = new Point(MinimumX, MaximumY - _Length, MinimumZ);

                if (!BottomBeam.Insert())
                {
                    MessageBox.Show("Failed to insert bottombeam");
                }

                BottomBeam.SetPhase(phase);

                //INTERMEDIATE
                for (int j = 1; j < Rafters.Length - 1; j++)
                {
                    Rafters[j].Position.Plane    = Position.PlaneEnum.MIDDLE;
                    Rafters[j].Position.Rotation = Position.RotationEnum.FRONT;
                    Rafters[j].Position.Depth    = Position.DepthEnum.BEHIND;
                    //Rafters[j].StartPoint = tp.TransformationMatrixToLocal.Transform(StartPoint) - new Point(0, j * _Spacing, 0);
                    //Rafters[j].EndPoint = tp.TransformationMatrixToLocal.Transform(EndPoint) - new Point(0, j * _Spacing, 0);

                    Rafters[j].StartPoint = new Point(MinimumX, MaximumY - j * _Spacing, MinimumZ);
                    Rafters[j].EndPoint   = new Point(MinimumX, MaximumY - j * _Spacing, MaximumZ);
                    Rafters[j].Insert();
                    Rafters[j].SetPhase(phase);
                }

                TopBeam.SetUserProperty("USER_FIELD_1", "x");
                BottomBeam.SetUserProperty("USER_FIELD_1", "x");
                Rafters.First().SetUserProperty("USER_FIELD_1", "x");
                Rafters.Last().SetUserProperty("USER_FIELD_1", "x");

                MinimumX = BottomBeam.GetSolid().MinimumPoint.X;
                MinimumY = BottomBeam.GetSolid().MinimumPoint.Y;
                MinimumZ = BottomBeam.GetSolid().MinimumPoint.Z;
                MaximumX = BottomBeam.GetSolid().MaximumPoint.X;
                MaximumY = BottomBeam.GetSolid().MaximumPoint.Y;
                MaximumZ = TopBeam.GetSolid().MaximumPoint.Z;

                for (int i = 0; i < SheatingPanels.Length; i++)
                {
                    SheatingPanels[i] = new Beam(Beam.BeamTypeEnum.BEAM);
                    SheatingPanels[i].Position.Plane          = Position.PlaneEnum.RIGHT;
                    SheatingPanels[i].Position.Rotation       = Position.RotationEnum.FRONT;
                    SheatingPanels[i].Position.Depth          = Position.DepthEnum.BEHIND;
                    SheatingPanels[i].Profile.ProfileString   = _SheatingProfile;
                    SheatingPanels[i].Material.MaterialString = _SheatingMaterial;
                    SheatingPanels[i].PartNumber.Prefix       = "PL";
                    SheatingPanels[i].AssemblyNumber.Prefix   = "R";
                    SheatingPanels[i].Finish = _SheatingFinish;
                    SheatingPanels[i].Name   = _SheatingName;
                    SheatingPanels[i].Class  = _SheatingClass;

                    if (_SheatingType == 0)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT";
                        SheatingPanels[i].Class = "4";
                    }

                    if (_SheatingType == 1)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT     (wit)";
                        SheatingPanels[i].Class = "5";
                    }
                }

                SheatingPanels.First().StartPoint = new Point(BottomBeam.GetSolid().MaximumPoint.X, BottomBeam.GetSolid().MaximumPoint.Y, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.First().EndPoint   = new Point(BottomBeam.GetSolid().MaximumPoint.X, BottomBeam.GetSolid().MaximumPoint.Y, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.First().Insert();
                SheatingPanels.First().SetPhase(phase);

                SheatingPanels.Last().StartPoint = new Point(BottomBeam.GetSolid().MaximumPoint.X, BottomBeam.GetSolid().MaximumPoint.Y - 1222, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.Last().EndPoint   = new Point(BottomBeam.GetSolid().MaximumPoint.X, BottomBeam.GetSolid().MaximumPoint.Y - 1222, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.Last().Insert();
                SheatingPanels.Last().SetPhase(phase);

                Drukregel.Position.Plane    = Position.PlaneEnum.LEFT;
                Drukregel.Position.Rotation = Position.RotationEnum.BACK;
                Drukregel.Position.Depth    = Position.DepthEnum.FRONT;

                Drukregel.Position.RotationOffset = -90 + _DrukregelAngle;

                Drukregel.StartPoint = new Point(MinimumX - _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MaximumY, MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));
                Drukregel.EndPoint   = new Point(MinimumX - _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MaximumY - _Length, MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));

                if (!Drukregel.Insert())
                {
                    MessageBox.Show("Failed to insert drukregel");
                }

                String drukregelComment = Math.Abs(Math.Round(_DrukregelAngle)).ToString();

                Drukregel.SetUserProperty("comment", drukregelComment);
                Drukregel.SetPhase(phase);

                if (_SheatingType == 0)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Naturel");
                    SheatingPanels.Last().SetUserProperty("comment", "Naturel");
                }
                if (_SheatingType == 1)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Wit spanolak");
                    SheatingPanels.Last().SetUserProperty("comment", "Wit spanolak");
                }

                for (int i = 0; i < Rafters.Length; i++)
                {
                    Rafters[i].SetUserProperty("comment", "");
                }

                CutPlane DrukregelCut1 = new CutPlane();
                DrukregelCut1.Plane        = new Plane();
                DrukregelCut1.Plane.Origin = new Point(MaximumX, MaximumY, MaximumZ);
                DrukregelCut1.Plane.AxisX  = new Vector(0, 1, 0);
                DrukregelCut1.Plane.AxisY  = new Vector(0, 0, 1);
                DrukregelCut1.Father       = Drukregel;
                DrukregelCut1.Insert();

                CutPlane DrukregelCut3 = new CutPlane();
                DrukregelCut3.Plane        = new Plane();
                DrukregelCut3.Plane.Origin = new Point(MinimumX, MinimumY, MaximumZ);
                DrukregelCut3.Plane.AxisX  = new Vector(0, 1, 0);
                DrukregelCut3.Plane.AxisY  = new Vector(1, 0, 0);
                DrukregelCut3.Father       = Drukregel;
                DrukregelCut3.Insert();
            }

            else if (DirectionPoint.X < StartPoint.X)
            {
                Rafters.First().Position.Plane = Position.PlaneEnum.LEFT;
                Rafters.First().Position.Rotation = Position.RotationEnum.BACK;
                Rafters.First().Position.Depth = Position.DepthEnum.FRONT;
                Rafters.First().StartPoint = new Point(StartPoint);
                Rafters.First().EndPoint   = new Point(EndPoint);
                Rafters.First().Insert();
                Rafters.First().SetPhase(phase);

                //TransformationPlane tp = new TransformationPlane(Rafters.First().GetCoordinateSystem());
                //Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(tp);

                double MinimumX = Rafters.First().GetSolid().MinimumPoint.X;
                double MinimumY = Rafters.First().GetSolid().MinimumPoint.Y;
                double MinimumZ = Rafters.First().GetSolid().MinimumPoint.Z;
                double MaximumX = Rafters.First().GetSolid().MaximumPoint.X;
                double MaximumY = Rafters.First().GetSolid().MaximumPoint.Y;
                double MaximumZ = Rafters.First().GetSolid().MaximumPoint.Z;

                Rafters.Last().Position.Plane = Position.PlaneEnum.RIGHT;
                Rafters.Last().Position.Rotation = Position.RotationEnum.BACK;
                Rafters.Last().Position.Depth = Position.DepthEnum.BEHIND;
                Rafters.Last().StartPoint = new Point(MinimumX, MinimumY + _Length, MinimumZ);
                Rafters.Last().EndPoint   = new Point(MinimumX, MinimumY + _Length, MaximumZ);
                Rafters.Last().Insert();
                Rafters.Last().SetPhase(phase);

                TopBeam.Position.Plane    = Position.PlaneEnum.RIGHT;
                TopBeam.Position.Rotation = Position.RotationEnum.BELOW;
                TopBeam.Position.Depth    = Position.DepthEnum.FRONT;
                TopBeam.StartPoint        = new Point(MinimumX, MinimumY, MaximumZ);
                TopBeam.EndPoint          = new Point(MinimumX, MinimumY + _Length, MaximumZ);

                if (!TopBeam.Insert())
                {
                    MessageBox.Show("Failed to insert topbeam");
                }

                TopBeam.SetPhase(phase);

                BottomBeam.Position.Plane    = Position.PlaneEnum.RIGHT;
                BottomBeam.Position.Rotation = Position.RotationEnum.BELOW;
                BottomBeam.Position.Depth    = Position.DepthEnum.BEHIND;
                BottomBeam.StartPoint        = new Point(MinimumX, MinimumY, MinimumZ);
                BottomBeam.EndPoint          = new Point(MinimumX, MinimumY + _Length, MinimumZ);

                if (!BottomBeam.Insert())
                {
                    MessageBox.Show("Failed to insert bottombeam");
                }

                BottomBeam.SetPhase(phase);

                //INTERMEDIATE
                for (int j = 1; j < Rafters.Length - 1; j++)
                {
                    Rafters[j].Position.Plane    = Position.PlaneEnum.MIDDLE;
                    Rafters[j].Position.Rotation = Position.RotationEnum.BACK;
                    Rafters[j].Position.Depth    = Position.DepthEnum.BEHIND;
                    //Rafters[j].StartPoint = tp.TransformationMatrixToLocal.Transform(StartPoint) - new Point(0, j * _Spacing, 0);
                    //Rafters[j].EndPoint = tp.TransformationMatrixToLocal.Transform(EndPoint) - new Point(0, j * _Spacing, 0);

                    Rafters[j].StartPoint = new Point(MinimumX, MinimumY + j * _Spacing, MinimumZ);
                    Rafters[j].EndPoint   = new Point(MinimumX, MinimumY + j * _Spacing, MaximumZ);
                    Rafters[j].Insert();
                    Rafters[j].SetPhase(phase);
                }

                TopBeam.SetUserProperty("USER_FIELD_1", "x");
                BottomBeam.SetUserProperty("USER_FIELD_1", "x");
                Rafters.First().SetUserProperty("USER_FIELD_1", "x");
                Rafters.Last().SetUserProperty("USER_FIELD_1", "x");

                MinimumX = BottomBeam.GetSolid().MinimumPoint.X;
                MinimumY = BottomBeam.GetSolid().MinimumPoint.Y;
                MinimumZ = BottomBeam.GetSolid().MinimumPoint.Z;
                MaximumX = BottomBeam.GetSolid().MaximumPoint.X;
                MaximumY = BottomBeam.GetSolid().MaximumPoint.Y;
                MaximumZ = TopBeam.GetSolid().MaximumPoint.Z;

                for (int i = 0; i < SheatingPanels.Length; i++)
                {
                    SheatingPanels[i] = new Beam(Beam.BeamTypeEnum.BEAM);
                    SheatingPanels[i].Position.Plane          = Position.PlaneEnum.LEFT;
                    SheatingPanels[i].Position.Rotation       = Position.RotationEnum.BACK;
                    SheatingPanels[i].Position.Depth          = Position.DepthEnum.FRONT;
                    SheatingPanels[i].Profile.ProfileString   = _SheatingProfile;
                    SheatingPanels[i].Material.MaterialString = _SheatingMaterial;
                    SheatingPanels[i].PartNumber.Prefix       = "PL";
                    SheatingPanels[i].AssemblyNumber.Prefix   = "R";
                    SheatingPanels[i].Finish = _SheatingFinish;
                    SheatingPanels[i].Name   = _SheatingName;
                    SheatingPanels[i].Class  = _SheatingClass;

                    if (_SheatingType == 0)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT";
                        SheatingPanels[i].Class = "4";
                    }

                    if (_SheatingType == 1)
                    {
                        SheatingPanels[i].Name  = "SPAANPLAAT     (wit)";
                        SheatingPanels[i].Class = "5";
                    }
                }

                SheatingPanels.First().StartPoint = new Point(BottomBeam.GetSolid().MinimumPoint.X, BottomBeam.GetSolid().MinimumPoint.Y, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.First().EndPoint   = new Point(BottomBeam.GetSolid().MinimumPoint.X, BottomBeam.GetSolid().MinimumPoint.Y, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.First().Insert();
                SheatingPanels.First().SetPhase(phase);

                SheatingPanels.Last().StartPoint = new Point(BottomBeam.GetSolid().MinimumPoint.X, BottomBeam.GetSolid().MinimumPoint.Y + 1222, BottomBeam.GetSolid().MinimumPoint.Z);
                SheatingPanels.Last().EndPoint   = new Point(BottomBeam.GetSolid().MinimumPoint.X, BottomBeam.GetSolid().MinimumPoint.Y + 1222, TopBeam.GetSolid().MaximumPoint.Z + _SheatingOverhang);
                SheatingPanels.Last().Insert();
                SheatingPanels.Last().SetPhase(phase);

                Drukregel.Position.Plane    = Position.PlaneEnum.LEFT;
                Drukregel.Position.Rotation = Position.RotationEnum.BACK;
                Drukregel.Position.Depth    = Position.DepthEnum.FRONT;

                Drukregel.Position.RotationOffset = -90 + _DrukregelAngle;

                Drukregel.StartPoint = new Point(MaximumX + _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MinimumY, MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));
                Drukregel.EndPoint   = new Point(MaximumX + _DrukregelMovement * Math.Cos((90 - _DrukregelAngle) * Math.PI / 180), MinimumY + _Length, MaximumZ + _DrukregelMovement * Math.Sin((90 - _DrukregelAngle) * Math.PI / 180));

                if (!Drukregel.Insert())
                {
                    MessageBox.Show("Failed to insert drukregel");
                }

                String drukregelComment = Math.Abs(Math.Round(_DrukregelAngle)).ToString();

                Drukregel.SetUserProperty("comment", drukregelComment);
                Drukregel.SetPhase(phase);

                if (_SheatingType == 0)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Naturel");
                    SheatingPanels.Last().SetUserProperty("comment", "Naturel");
                }
                if (_SheatingType == 1)
                {
                    SheatingPanels.First().SetUserProperty("comment", "Wit spanolak");
                    SheatingPanels.Last().SetUserProperty("comment", "Wit spanolak");
                }

                for (int i = 0; i < Rafters.Length; i++)
                {
                    Rafters[i].SetUserProperty("comment", "");
                }

                CutPlane DrukregelCut1 = new CutPlane();
                DrukregelCut1.Plane        = new Plane();
                DrukregelCut1.Plane.Origin = new Point(MinimumX, MaximumY, MaximumZ);
                DrukregelCut1.Plane.AxisX  = new Vector(0, 0, 1);
                DrukregelCut1.Plane.AxisY  = new Vector(0, 1, 0);
                DrukregelCut1.Father       = Drukregel;
                DrukregelCut1.Insert();

                CutPlane DrukregelCut3 = new CutPlane();
                DrukregelCut3.Plane        = new Plane();
                DrukregelCut3.Plane.Origin = new Point(MinimumX, MinimumY, MaximumZ);
                DrukregelCut3.Plane.AxisX  = new Vector(0, 1, 0);
                DrukregelCut3.Plane.AxisY  = new Vector(1, 0, 0);
                DrukregelCut3.Father       = Drukregel;
                DrukregelCut3.Insert();
            }

            else
            {
                MessageBox.Show("Invalid points");
            }

            Assembly assembly = BottomBeam.GetAssembly();

            assembly.Add(TopBeam);
            assembly.Add(Drukregel);

            foreach (Beam rafter in Rafters)
            {
                assembly.Add(rafter);
            }
            foreach (Beam sheating in SheatingPanels)
            {
                assembly.Add(sheating);
            }

            if (!assembly.Modify())
            {
                MessageBox.Show("Assembly Modify Failed!");
            }

            Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
        }
コード例 #17
0
        /// <summary>
        /// Gets Cut Plane object by ID.
        /// </summary>
        /// <returns>CutPlane object.</returns>
        public CutPlane GetCutPlane(int cutPlaneID)
        {
            CutPlane cutplane = EpicCutPlanes.GetCutPlane(cutPlaneID);

            return(cutplane);
        }