Пример #1
0
        public IList <Pipe> GetStored()
        {
            try
            {
                PipeTestResult result      = null;
                Inspector      inspector   = null;
                Certificate    certificate = null;
                Coat           coat        = null;
                Weld           weld        = null;
                Spool          spool       = null;

                var q = session.QueryOver <Pipe>()
                        .Where(n => ((n.Status == PipeMillStatus.Stocked) && (n.IsActive == true) && n.Railcar == null))
                        .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                        .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                        .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin)
                        .JoinAlias(r => r.Coats, () => coat, JoinType.LeftOuterJoin)
                        .JoinAlias(r => r.Welds, () => weld, JoinType.LeftOuterJoin)
                        .JoinAlias(r => r.Spools, () => spool, JoinType.LeftOuterJoin)
                        .TransformUsing(Transformers.DistinctRootEntity)
                        .List <Pipe>();

                return(q);
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("GetStored", ex);
            }
        }
Пример #2
0
        private static Weld GenerateWeld(long pipe1ID, long pipe2ID)
        {
            long weldID = GetNextID();

            Weld weld = new Weld()
            {
                WeldID          = weldID,
                JobID           = parsedArgs.JobID,
                Pipe1ID         = pipe1ID,
                Pipe2ID         = pipe2ID,
                WeldBarcode     = weldID + "_bc",
                WeldNumber      = weldID + "_nm",
                WpsNumber       = weldID + "wps",
                RepairWpsNumber = weldID + "_rwps",
                Longitude       = "30.25",
                Latitude        = "97.75",
                Station         = "Station W",
                CurrentLocation = "Springfield, OR",
                CreationDate    = DateTime.Now,
                LastUpdated     = DateTime.Now,
                Status          = WeldStatus.Active,
                Repaired        = false,
                Type            = "Fillet",
                ParentWeldID    = null,
                WeldCoating     = "FBE",
                WelderFirstName = "Rock",
                WelderLastName  = "Strongo"
            };

            return(weld);
        }
Пример #3
0
        public override void LoadContent()
        {
            _agent = new Agent(new Vector2(500, 500));
            _agent.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            //LoadObstacles();

            _weldedBody = new List <Body>();
            _weldedGeom = new List <Geom>();

            for (int i = 0; i < 128; i++)
            {
                _weldedBody.Add(BodyFactory.Instance.CreateRectangleBody(25, 25, 10.0f));
                _weldedGeom.Add(GeomFactory.Instance.CreateRectangleGeom(_weldedBody[i], 25, 25));
                _weldedGeom[i].RestitutionCoefficient = 0.0001f;
                _weldedGeom[i].FrictionCoefficient    = 0.999f;
                PhysicsSimulator.Add(_weldedBody[i]);
                PhysicsSimulator.Add(_weldedGeom[i]);
            }
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 16; y++)
                {
                    // Width*y + x
                    _weldedBody[8 * y + x].Position = new Vector2((x * 30) + 80, (y * 30) + 80);
                }
            }
            _weld = new Weld(PhysicsSimulator, _weldedGeom);


            base.LoadContent();
        }
Пример #4
0
 public override int GetHashCode()
 {
     return((Material?.GetHashCode() ?? 1)
            + (Surface?.GetHashCode() ?? 1)
            + (Weld?.GetHashCode() ?? 1)
            + (Grade?.GetHashCode() ?? 1)
            + (Manufacturer?.GetHashCode() ?? 1));
 }
 public static dynamic GetTSObject(Weld dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Пример #6
0
        public void SetWeld(Weld newState)
        {
            if (isWeldable == false)
            {
                return;
            }

            weldState = newState;
            weldSpriteHandler.ChangeSprite((int)weldState);
        }
Пример #7
0
    static void weld()
    {
//		file = EditorGUILayout.TextField ("Text Field", file);
        mesh = Selection.activeGameObject.GetComponent <MeshFilter> ().sharedMesh;

        weldedMesh = Weld.CopyMesh(mesh);
        AssetDatabase.CreateAsset(weldedMesh, file);
        AssetDatabase.SaveAssets();
//		WeldMesh window = (WeldMesh)EditorWindow.GetWindow (typeof (WeldMesh));
    }
Пример #8
0
        private void weldingHistoryGridView_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.IsValidRowHandle(e.RowHandle))
            {
                Weld weld = view.GetRow(e.RowHandle) as Weld;
                weld.Pipe = viewModel.Pipe;
                weld.Date = DateTime.Now;
            }
        }
        private void WeldFloor(Part mainPart, Part secondPart)
        {
            Weld weld = new Weld();

            weld.MainObject        = mainPart;
            weld.SecondaryObject   = secondPart;
            weld.ConnectAssemblies = false;
            weld.ShopWeld          = true;
            weld.AroundWeld        = true;
            weld.TypeAbove         = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            weld.Insert();
        }
Пример #10
0
 private void repositoryItemPopupWelders_Popup(object sender, EventArgs e)
 {
     weldingHistoryGridView.ClearSelection();
     if (weldingHistoryGridView.IsValidRowHandle(weldingHistoryGridView.FocusedRowHandle))
     {
         Weld weld = weldingHistoryGridView.GetRow(weldingHistoryGridView.FocusedRowHandle) as Weld;
         if (weld != null)
         {
             weldersSelectionControl.SelectWelders(weld.Welders);
         }
     }
 }
Пример #11
0
        private void repositoryItemPopupWelders_QueryPopUp(object sender, CancelEventArgs e)
        {
            Weld weld = weldingHistoryGridView.GetRow(weldingHistoryGridView.FocusedRowHandle) as Weld;

            if (weld == null || (weld != null && weld.Date == null))
            {
                weldingHistoryGridView.SetColumnError(weldingHistoryGridView.VisibleColumns[0],
                                                      Program.LanguageManager.GetString(StringResources.DateFirst));
                e.Cancel = true;
            }
            else
            {
                weldersSelectionControl.weldDate = weld.Date;
            }
        }
Пример #12
0
        public void SetWeld(Weld newState)
        {
            if (isWeldable == false)
            {
                return;
            }

            weldState = newState;

            if (isOnlySealedWhenWelded)
            {
                UpdateGasContainer();
            }

            weldSpriteHandler.ChangeSprite((int)weldState);
        }
Пример #13
0
 private void repositoryItemPopupWelders_CloseUp(object sender, DevExpress.XtraEditors.Controls.CloseUpEventArgs e)
 {
     if (weldingHistoryGridView.IsValidRowHandle(weldingHistoryGridView.FocusedRowHandle))
     {
         IList <Welder> selectedWelders = weldersSelectionControl.SelectedWelders;
         Weld           weld            = weldingHistoryGridView.GetRow(weldingHistoryGridView.FocusedRowHandle) as Weld;
         if (weld != null)
         {
             weld.Welders.Clear();
             foreach (Welder w in selectedWelders)
             {
                 weld.Welders.Add(w);
                 w.Welds.Add(weld);
             }
         }
     }
 }
Пример #14
0
        private static List <Weld> CreateWelds(List <long> pipeIDs)
        {
            List <Weld> welds = new List <Weld>();

            using (StreamWriter sw = File.CreateText(WELD_FILE))
            {
                int p = 0;

                for (int i = 0; i < parsedArgs.NumWelds; i++)
                {
                    long pipe1ID = pipeIDs[p];
                    p = (p + 1) % pipeIDs.Count;
                    long pipe2ID = pipeIDs[p];
                    Weld weld    = GenerateWeld(pipe1ID, pipe2ID);
                    welds.Add(weld);
                }
            }

            foreach (Weld weld in welds)
            {
                List <WeldPart> parts = new List <WeldPart>();

                for (int j = 0; j < NUM_WELD_PASSES; j++)
                {
                    WeldPart part = GenerateWeldPart(weld.WeldID);
                    parts.Add(part);
                }

                weld.WeldParts = parts.ToArray();
            }

            foreach (Weld weld in welds)
            {
                List <WeldInspection> inspections = new List <WeldInspection>();

                for (int j = 0; j < NUM_WELD_INSPECTIONS; j++)
                {
                    WeldInspection insp = GenerateWeldInspection(weld.WeldID);
                    inspections.Add(insp);
                }

                weld.WeldInspections = inspections.ToArray();
            }

            return(welds);
        }
Пример #15
0
    public Weld insert_weld(Part Main_part, Part Secandary_part)
    {
        Weld weld = new Weld();

        weld.MainObject      = (ModelObject)Main_part;
        weld.SecondaryObject = (ModelObject)Secandary_part;
        weld.SizeAbove       = this.data.weld_aboveline;
        weld.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
        weld.SizeBelow       = this.data.weld_aboveline;
        weld.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
        weld.ShopWeld        = true;
        weld.AroundWeld      = false;
        CoordinateSystem coordinateSystem = Secandary_part.GetCoordinateSystem();

        weld.Direction = coordinateSystem.AxisY;
        weld.Insert();
        return(weld);
    }
Пример #16
0
        private void btn_Weld_Click(object sender, EventArgs e)
        {
            TSMUI.Picker thisPicker       = new TSMUI.Picker();
            Part         firstPickedPart  = null;
            Part         secondPickedPart = null;

            try
            {
                firstPickedPart  = thisPicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as Part;
                secondPickedPart = thisPicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as Part;
            }
            catch
            {
                firstPickedPart  = null;
                secondPickedPart = null;
            }

            if (firstPickedPart != null && secondPickedPart != null)
            {
                Weld newWeld = new Weld();
                newWeld.MainObject      = firstPickedPart;
                newWeld.SecondaryObject = secondPickedPart;
                newWeld.SizeBelow       = 6.35;
                newWeld.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                newWeld.SizeAbove       = 0.0;
                newWeld.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_NONE;
                newWeld.AroundWeld      = false;
                newWeld.ShopWeld        = true;
                newWeld.ReferenceText   = "Typ.";
                newWeld.Placement       = BaseWeld.WeldPlacementTypeEnum.PLACEMENT_AUTO;

                if (newWeld.Insert())
                {
                    // Show the weld in the model but the user will never see the workplane chage
                    currentModel.CommitChanges();
                }
                else
                {
                    Tekla.Structures.Model.Operations.Operation.DisplayPrompt("Weld  was not created");
                }
            }
        }
Пример #17
0
        void Start()
        {
            finishedBuilding = false;
            nodes            = GetComponent <ON_NodeGraph> ().Nodes; // new List<ON_Node>();
            edges            = GetComponent <ON_NodeGraph> ().Edges; // new List<ON_Node>();

            if (!weld)
            {
                weldedMesh = mesh;
            }
            else
            {
                weldedMesh = Weld.CopyMesh(mesh);
            }

            Weld.AutoWeld(weldedMesh, .0000001f, 15f);

            if (GraphParent == null)
            {
                GraphParent = this.gameObject;
            }

            StartCoroutine(instanceNodes());
        }
        private void CreateConnection_Click(object sender, RoutedEventArgs e)
        {
            DtoDivision model = GetConnectionsModel();

            if (model == null)
            {
                return;
            }

            bool hasValues = GetElementAssemblies(false);

            if (!hasValues)
            {
                MessageBoxHelper.ShowInformation("Please create the objects first.", _parentWindow);
                return;
            }

            string propertyName = "ConnectionChild-Element";

            ProgressWindow.Text = "Create connections.";
            ProgressWindow.Show();
            bool hideProgressWindow = true;

            try
            {
                DtoCsgTree csgTree = new DtoCsgTree {
                    Color = (uint)Color.LightSteelBlue.ToArgb()
                };
                csgTree.Elements.Add(new Path
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                0, 300, 6.5
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0, 300, 15.5
                            }
                        },
                    }
                });

                csgTree.Elements.Add(new OuterContour
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                0, -40
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                290, -40
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                290, -550
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0, -550
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0.0, -40
                            }
                        },
                    }
                });

                SteelPlate Slab = new SteelPlate
                {
                    Name        = "Slab",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = csgTree
                };
                Slab.AddProperty(TableNames.tabAttribConstObjInstObj, propertyName, _bar0);

                DtoCsgTree rectangle = new DtoCsgTree {
                    Color = (uint)Color.IndianRed.ToArgb()
                };
                rectangle.Elements.Add(new Path
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                40, 300.0, 15.5
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                550, 300.0, 15.5
                            }
                        }
                    }
                });

                rectangle.Elements.Add(new OuterContour
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                20, 0.0
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0.0, 0.0
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0, 10
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                20, 0.0
                            }
                        }
                    }
                });

                Weld Weld_1 = new Weld
                {
                    Name        = "Weld_1",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = rectangle
                };

                Weld_1.AddProperty(TableNames.tabAttribConstObjInstObj, propertyName, _bar0);

                Weld Weld_2 = new Weld
                {
                    Name        = "Weld_2",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = rectangle
                };

                TmpMatrix matrix = new TmpMatrix
                {
                    Values = new[]
                    {
                        1, 0.0, 0.0, 0.0,
                        0.0, 1, 0.0, 0.0,
                        0.0, 0.0, -1, 9,  //-10
                        0.0, 0.0, 0.0, 1
                    }
                };

                Weld_2.AddProperty(TableNames.tabAttribConstObjInstObj, propertyName, _bar0);
                Weld_2.AddProperty("element", "matrix", matrix);

                DtoCsgTree cabin = new DtoCsgTree {
                    Color = (uint)Color.DarkBlue.ToArgb()
                };
                cabin.Elements.Add(new Path
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                0, 300, 30
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0, 300, 40
                            }
                        },
                    }
                });

                cabin.Elements.Add(new OuterContour
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                0.0, -10.0
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                8.666, -5
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                8.666, 5
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0.0, 10
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                -8.666, 5
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                -8.666, -5
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0.0, -10
                            }
                        }
                    }
                });

                DtoCsgTree CircularTree = new DtoCsgTree {
                    Color = (uint)Color.Gray.ToArgb()
                };
                CircularTree.Elements.Add(new Path
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                0, 300, -20
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0, 300, 30
                            }
                        }
                    },
                    CrossSection = "RD8"
                });

                ChildGeometryObject Cabin1 = new ChildGeometryObject
                {
                    Name     = "Cabin1",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = cabin
                };

                TmpMatrix matrix1 = new TmpMatrix
                {
                    Values = new[]
                    {
                        1, 0.0, 0.0, 100.0,
                        0.0, 1, 0.0, 200.0,
                        0.0, 0.0, 1, 0.0,
                        0.0, 0.0, 0.0, 1
                    }
                };

                Cabin1.AddProperty("element", "matrix", matrix1);

                ChildGeometryObject Circular1 = new ChildGeometryObject
                {
                    Name     = "Circular1",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = CircularTree
                };

                Circular1.AddProperty("element", "matrix", matrix1);

                MechanicalFastener Screw_1 = new MechanicalFastener
                {
                    Name        = "Screw_1",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                };

                Screw_1.Children = new List <DtObject>
                {
                    Cabin1,
                    Circular1
                };

                ChildGeometryObject Cabin2 = new ChildGeometryObject
                {
                    Name     = "Cabin2",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = cabin
                };

                TmpMatrix matrix2 = new TmpMatrix
                {
                    Values = new[]
                    {
                        1, 0.0, 0.0, 500,
                        0.0, 1, 0.0, 100.0,
                        0.0, 0.0, 1, 0.0,
                        0.0, 0.0, 0.0, 1
                    }
                };

                Cabin2.AddProperty("element", "matrix", matrix2);

                ChildGeometryObject Circular2 = new ChildGeometryObject
                {
                    Name     = "Circular2",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = CircularTree
                };

                Circular2.AddProperty("element", "matrix", matrix2);

                MechanicalFastener Screw_2 = new MechanicalFastener
                {
                    Name        = "Screw_2",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                };

                Screw_2.Children = new List <DtObject>
                {
                    Cabin2,
                    Circular2
                };

                ChildGeometryObject Cabin3 = new ChildGeometryObject
                {
                    Name     = "Cabin3",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = cabin
                };

                TmpMatrix matrix3 = new TmpMatrix
                {
                    Values = new[]
                    {
                        1, 0.0, 0.0, 100,
                        0.0, 1, 0.0, 100,
                        0.0, 0.0, 1, 0.0,
                        0.0, 0.0, 0.0, 1
                    }
                };

                Cabin3.AddProperty("element", "matrix", matrix3);

                ChildGeometryObject Circular_3 = new ChildGeometryObject
                {
                    Name     = "Circular_3",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = CircularTree
                };

                Circular_3.AddProperty("element", "matrix", matrix3);

                MechanicalFastener Screw_3 = new MechanicalFastener
                {
                    Name        = "Screw_3",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                };

                Screw_3.Children = new List <DtObject>
                {
                    Cabin3,
                    Circular_3
                };

                ChildGeometryObject Cabin4 = new ChildGeometryObject
                {
                    Name     = "Cabin4",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = cabin
                };

                TmpMatrix matrix4 = new TmpMatrix
                {
                    Values = new[]
                    {
                        1, 0.0, 0.0, 500,
                        0.0, 1, 0.0, 200,
                        0.0, 0.0, 1, 0.0,
                        0.0, 0.0, 0.0, 1
                    }
                };

                Cabin4.AddProperty("element", "matrix", matrix4);

                ChildGeometryObject Circular_4 = new ChildGeometryObject
                {
                    Name     = "Circular_4",
                    Parent   = model.TopologyDivisionId,
                    Division = model.Id,
                    CsgTree  = CircularTree
                };

                Circular_4.AddProperty("element", "matrix", matrix4);

                MechanicalFastener Screw_4 = new MechanicalFastener
                {
                    Name        = "Screw_4",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                };

                Screw_4.Children = new List <DtObject>
                {
                    Cabin4,
                    Circular_4
                };

                DtoCsgTree Hole = new DtoCsgTree {
                    Color = (uint)Color.Gray.ToArgb()
                };
                Hole.Elements.Add(new Path
                {
                    Rotation = 0,
                    Geometry = new List <CsgGeoElement>
                    {
                        new StartPolygon {
                            Point = new List <double> {
                                0, 300, -100
                            }
                        },
                        new Line {
                            Point = new List <double> {
                                0, 300, 200
                            }
                        }
                    },
                    CrossSection = "RD8"
                });

                Opening Hole_1 = new Opening
                {
                    Name        = "Hole_1",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = Hole
                };

                Hole_1.AddProperty("element", "matrix", matrix1);

                Opening Hole_2 = new Opening
                {
                    Name        = "Hole_2",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = Hole
                };

                Hole_2.AddProperty("element", "matrix", matrix2);

                Opening Hole_3 = new Opening
                {
                    Name        = "Hole_3",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = Hole
                };

                Hole_3.AddProperty("element", "matrix", matrix3);

                Opening Hole_4 = new Opening
                {
                    Name        = "Hole_4",
                    Parent      = model.TopologyDivisionId,
                    Division    = model.Id,
                    LogParentID = _integrationBase.CurrentProject.Id,
                    CsgTree     = Hole
                };

                Hole_4.AddProperty("element", "matrix", matrix4);

                DtoConnections connections = new DtoConnections
                {
                    ConnectionElement = new ConnectionElement(),
                    ElementIds        = new List <Guid>()
                };

                connections.ConnectionElement.Name        = _connectionElementName;
                connections.ConnectionElement.Description = "Connection_Part_Of_Test";
                connections.ElementIds.Add(_bar0.Id);
                connections.ElementIds.Add(_bar1.Id);

                connections.ConnectionElement.Children = new List <DtObject> {
                    Slab, Weld_1, Weld_2, Screw_1, Screw_2, Screw_3, Screw_4, Hole_1, Hole_2, Hole_3, Hole_4
                };

                _savedDtoConnections = _integrationBase.ApiCore.DtoConnection.CreateConnection(_integrationBase.CurrentProject.Id, connections);

                if (_savedDtoConnections == null)
                {
                    MessageBoxHelper.ShowInformation("DtoConnections could not be generated.", _parentWindow);
                }
                else
                {
                    _savedDtoConnectionsId = _savedDtoConnections.Id;
                    _integrationBase.ApiCore.Projects.ConvertGeometry(model.ProjectId);
                    hideProgressWindow = false;
                    NavigateToControl();
                    CreateConnection.IsEnabled = false;
                    DeleteConnection.IsEnabled = true;
                }
            }
            finally
            {
                if (hideProgressWindow)
                {
                    ProgressWindow.Hide();
                }
            }
        }
Пример #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MyModel.GetConnectionStatus())
            {
                double off1 = Convert.ToDouble(textBox4.Text);
                double off2 = Convert.ToDouble(textBox5.Text);
                TransformationPlane currentPlane = MyModel.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                Picker piku = new Picker();

                ArrayList info = new ArrayList();
                info = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ArrayList info2 = new ArrayList();
                info2 = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ModelObject part  = new Beam();
                ModelObject part2 = new Beam();
                Hashtable   p1    = new Hashtable();
                Hashtable   p2    = new Hashtable();
                part = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part.GetDoubleReportProperties(info, ref p1);
                double rotpart = (part as Part).Position.RotationOffset;
                part2 = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part2.GetDoubleReportProperties(info2, ref p2);
                double rotpart2 = (part2 as Part).Position.RotationOffset;


                Point st1 = new Point(Convert.ToDouble(p1["START_X"]), Convert.ToDouble(p1["START_Y"]), Convert.ToDouble(p1["START_Z"]));
                Point st2 = new Point(Convert.ToDouble(p2["END_X"]), Convert.ToDouble(p2["END_Y"]), Convert.ToDouble(p2["END_Z"]));
                Point st3 = new Point(Convert.ToDouble(p1["END_X"]), Convert.ToDouble(p1["END_Y"]), Convert.ToDouble(p1["END_Z"]));
                Point st4 = new Point(Convert.ToDouble(p2["START_X"]), Convert.ToDouble(p2["START_Y"]), Convert.ToDouble(p2["START_Z"]));

                LineSegment l1 = new LineSegment(st1, st2);
                LineSegment l3 = new LineSegment(st1, st3); Vector vl3 = l3.GetDirectionVector(); vl3.Normalize();
                LineSegment l4 = new LineSegment(st2, st1);
                LineSegment l5 = new LineSegment(st2, st4); Vector vl5 = l5.GetDirectionVector(); vl5.Normalize();

                st1.Translate(vl3.X * (off1 / vl3.GetLength()), vl3.Y * (off1 / vl3.GetLength()), vl3.Z * (off1 / vl3.GetLength()));
                st2.Translate(vl5.X * (off2 / vl5.GetLength()), vl5.Y * (off2 / vl5.GetLength()), vl5.Z * (off2 / vl5.GetLength()));


                ControlLine cl1 = new ControlLine(l1, true);
                cl1.Color = ControlLine.ControlLineColorEnum.YELLOW_RED;

                //cl1.Insert();

                CoordinateSystem cs1 = new CoordinateSystem();
                cs1 = part.GetCoordinateSystem();
                CoordinateSystem cs2 = new CoordinateSystem();
                cs2 = part2.GetCoordinateSystem();

                Tekla.Structures.Model.Plane pl1 = new Tekla.Structures.Model.Plane();
                pl1.AxisX  = cs1.AxisX;
                pl1.AxisY  = cs1.AxisY;
                pl1.Origin = cs1.Origin;

                Tekla.Structures.Model.Plane pl2 = new Tekla.Structures.Model.Plane();
                pl2.AxisX  = cs2.AxisX;
                pl2.AxisY  = cs2.AxisY;
                pl2.Origin = cs2.Origin;

                GeometricPlane gp1 = new GeometricPlane(cs1);
                GeometricPlane gp2 = new GeometricPlane(cs2);

                ControlPlane cp1 = new ControlPlane(pl1, true);
                //cp1.Insert();
                ControlPlane cp2 = new ControlPlane(pl2, true);
                //cp2.Insert();

                LineSegment l2 = Projection.LineSegmentToPlane(l1, gp1);
                LineSegment l6 = Projection.LineSegmentToPlane(l4, gp2);

                ControlLine cl2 = new ControlLine(l2, true);
                ControlLine cl3 = new ControlLine(l6, true);


                cl2.Color = ControlLine.ControlLineColorEnum.YELLOW_RED;
                //cl2.Insert();
                cl3.Color = ControlLine.ControlLineColorEnum.YELLOW_RED;
                //cl3.Insert();

                Part         p3   = part as Part;
                Solid        sl1  = p3.GetSolid();
                ArrayList    al1  = sl1.Intersect(l2);
                Point        px   = new Point(al1[1] as Point);
                ControlPoint cpp1 = new ControlPoint(px);
                //cpp1.Insert();

                Part         p4   = part2 as Part;
                Solid        sl2  = p4.GetSolid();
                ArrayList    al2  = sl2.Intersect(l6);
                Point        py   = new Point(al2[1] as Point);
                ControlPoint cpp4 = new ControlPoint(py);
                //cpp4.Insert();

                double distance  = Distance.PointToLineSegment(st3, l2);
                double distance1 = l3.Length();
                double cos       = distance / distance1;
                double distance2 = Distance.PointToLineSegment(st4, l6);
                double distance3 = l5.Length();
                double cos1      = distance2 / distance3;

                Point        p10  = dlugosc(st1, st3, 4, cos, px);
                ControlPoint cpp2 = new ControlPoint(p10);
                //cpp2.Insert();
                Point        p20  = dlugosc(st2, st4, 4, cos1, py);
                ControlPoint cpp5 = new ControlPoint(p20);
                //cpp5.Insert();


                Point  p5   = new Point(l2.StartPoint);
                Point  p6   = new Point(l2.EndPoint);
                Vector v1   = new Vector((p6.X - p5.X) / 10000, (p6.Y - p5.Y) / 10000, (p6.Z - p5.Z) / 10000);
                double v1d  = v1.GetLength();
                double dlbl = Convert.ToDouble(textBox2.Text);
                Point  p11  = new Point(px);
                p11.Translate(v1.X * (dlbl / v1d), v1.Y * (dlbl / v1d), v1.Z * (dlbl / v1d));
                Point        p12  = dlugosc(st1, st3, 4, cos, p11);
                ControlPoint cpp3 = new ControlPoint(p12);
                //cpp3.Insert();
                Point  p7    = new Point(l6.StartPoint);
                Point  p8    = new Point(l6.EndPoint);
                Vector v2    = new Vector((p8.X - p7.X) / 10000, (p8.Y - p7.Y) / 10000, (p8.Z - p7.Z) / 10000);
                double v2d   = v2.GetLength();
                double dlbl1 = Convert.ToDouble(textBox2.Text);
                Point  p21   = new Point(py);
                p21.Translate(v2.X * (dlbl1 / v2d), v2.Y * (dlbl1 / v2d), v2.Z * (dlbl1 / v2d));
                Point        p22  = dlugosc(st2, st4, 4, cos1, p21);
                ControlPoint cpp6 = new ControlPoint(p22);
                //cpp6.Insert();


                Beam blachast = CreateBlacha(p10, p12, rotpart, 0, textBox1.Text);
                blachast.Insert();
                int        id1  = blachast.Identifier.ID;
                Identifier id11 = new Identifier(id1);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject blachast3   = MyModel.SelectModelObject(id11);
                double      rotblachast = (blachast3 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                //textBox1.Text = Convert.ToString(rotblachast);
                blachast.Position.RotationOffset = -rotblachast;
                blachast.PartNumber.Prefix       = "PL";
                blachast.PartNumber.StartNumber  = 1001;
                blachast.Modify();


                Beam blachast2 = CreateBlacha(p20, p22, rotpart2, 1, textBox1.Text);
                blachast2.Insert();
                int        id2  = blachast2.Identifier.ID;
                Identifier id12 = new Identifier(id2);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject blachast4    = MyModel.SelectModelObject(id12);
                double      rotblachast2 = (blachast4 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                blachast2.Position.RotationOffset = -rotblachast2;
                blachast2.PartNumber.Prefix       = "PL";
                blachast2.PartNumber.StartNumber  = 1001;
                blachast2.Modify();

                Point p15 = new Point(p12);
                p15.Translate(v1.X * (-30 / v1d), v1.Y * (-30 / v1d), v1.Z * (-30 / v1d));
                ControlPoint cpp7 = new ControlPoint(p15);
                //cpp7.Insert();

                Point p16 = new Point(p22);
                p16.Translate(v2.X * (-30 / v2d), v2.Y * (-30 / v2d), v2.Z * (-30 / v2d));
                ControlPoint cpp8 = new ControlPoint(p16);
                //cpp8.Insert();

                Vector v11516 = new Vector((p16.X - p15.X) / 10000, (p16.Y - p15.Y) / 10000, (p16.Z - p15.Z) / 10000);

                Point p151 = new Point(p15); Point p152 = new Point(p15); Point p153 = new Point(p15);
                Point p161 = new Point(p16); Point p162 = new Point(p16); Point p163 = new Point(p16);

                p151.Translate(v11516.X * (-30 / v11516.GetLength()), v11516.Y * (-30 / v11516.GetLength()), v11516.Z * (-30 / v11516.GetLength()));
                p152.Translate(v11516.X * (120 / v11516.GetLength()), v11516.Y * (120 / v11516.GetLength()), v11516.Z * (120 / v11516.GetLength()));
                p153.Translate(v11516.X * (70 / v11516.GetLength()), v11516.Y * (70 / v11516.GetLength()), v11516.Z * (70 / v11516.GetLength()));

                p161.Translate(v11516.X * (30 / v11516.GetLength()), v11516.Y * (30 / v11516.GetLength()), v11516.Z * (30 / v11516.GetLength()));
                p162.Translate(v11516.X * (-120 / v11516.GetLength()), v11516.Y * (-120 / v11516.GetLength()), v11516.Z * (-120 / v11516.GetLength()));
                p163.Translate(v11516.X * (-70 / v11516.GetLength()), v11516.Y * (-70 / v11516.GetLength()), v11516.Z * (-70 / v11516.GetLength()));

                Beam BlSt1 = BlachaSt(p151, p152, 0);
                BlSt1.Insert();
                int        id3  = BlSt1.Identifier.ID;
                Identifier id13 = new Identifier(id3);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject blachast5 = MyModel.SelectModelObject(id13);
                double      rot5      = (blachast5 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                //textBox1.Text = Convert.ToString(rotblachast);
                BlSt1.Position.RotationOffset = -rot5;
                BlSt1.PartNumber.Prefix       = "PL";
                BlSt1.PartNumber.StartNumber  = 1001;
                BlSt1.Modify();

                Beam BlSt2 = BlachaSt(p161, p162, 1);
                BlSt2.Insert();
                int        id4  = BlSt2.Identifier.ID;
                Identifier id14 = new Identifier(id4);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject blachast6 = MyModel.SelectModelObject(id14);
                double      rot6      = (blachast6 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                //textBox1.Text = Convert.ToString(rotblachast);
                BlSt2.Position.RotationOffset = -rot6;
                BlSt2.PartNumber.Prefix       = "PL";
                BlSt2.PartNumber.StartNumber  = 1001;
                BlSt2.Modify();

                Beam St12 = CreateStezenie12(p153, p163);
                St12.Insert();
                int        id5  = St12.Identifier.ID;
                Identifier id15 = new Identifier(id5);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject stezenie1 = MyModel.SelectModelObject(id15);
                (stezenie1 as Beam).StartPointOffset.Dy    = 4;
                (stezenie1 as Part).PartNumber.Prefix      = "Pr";
                (stezenie1 as Part).PartNumber.StartNumber = 1001;
                stezenie1.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject stezenie2 = MyModel.SelectModelObject(id15);
                (stezenie2 as Beam).EndPointOffset.Dy      = -6;
                (stezenie2 as Part).PartNumber.Prefix      = "Pr";
                (stezenie2 as Part).PartNumber.StartNumber = 1001;
                stezenie2.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);

                double split      = Convert.ToDouble(textBox3.Text);
                Point  pointsplit = new Point(p163);
                pointsplit.Translate(v11516.X * (-split / v11516.GetLength()), v11516.Y * (-split / v11516.GetLength()), v11516.Z * (-split / v11516.GetLength()));


                BoltArray b1 = sruby(p151, p152, BlSt1, blachast);
                b1.Insert();
                int        id6  = b1.Identifier.ID;
                Identifier id16 = new Identifier(id6);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject b1m = MyModel.SelectModelObject(id16);
                (b1m as BoltArray).Position.RotationOffset = 0;
                (b1m as BoltArray).BoltStandard            = "4017-8.8";
                (b1m as BoltArray).ExtraLength             = 5;
                b1m.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);

                BoltArray b2 = sruby(p161, p162, BlSt2, blachast2);
                b2.Insert();
                int        id7  = b2.Identifier.ID;
                Identifier id17 = new Identifier(id7);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject b2m = MyModel.SelectModelObject(id17);
                (b2m as BoltArray).Position.RotationOffset = 180;
                b2m.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);


                Weld w  = new Weld();
                Weld w2 = new Weld();
                Weld w3 = new Weld();
                Weld w4 = new Weld();
                w.MainObject      = stezenie2;
                w.SecondaryObject = BlSt1;
                w.ShopWeld        = true;
                w.Insert();
                w2.MainObject      = stezenie2;
                w2.SecondaryObject = BlSt2;
                w2.ShopWeld        = true;
                w2.Insert();
                w3.MainObject      = part;
                w3.SecondaryObject = blachast;
                w3.ShopWeld        = true;
                w3.Insert();
                w4.MainObject      = part2;
                w4.SecondaryObject = blachast2;
                w4.ShopWeld        = true;
                w4.Insert();
                Beam       st122 = Operation.Split(stezenie2 as Beam, pointsplit);
                Connection sr    = new Connection();
                sr.Name   = "Połączenie śrubą rzymską";
                sr.Number = 126;
                sr.LoadAttributesFromFile("82269_M12");
                sr.SetPrimaryObject(stezenie2);
                sr.SetSecondaryObject(st122);
                sr.Insert();
            }


            MyModel.CommitChanges();
        }
 void OnEnable()
 {
     welder = weld.GetComponent <Weld>();
     helper = helpController.GetComponent <HelpController>();
     SetHelperActive();
 }
Пример #21
0
        public override void LoadContent()
        {
            _agent = new Agent(new Vector2(500, 500));
            _agent.Load(ScreenManager.GraphicsDevice, PhysicsSimulator);

            //LoadObstacles();

            _weldedBody = new List<Body>();
            _weldedGeom = new List<Geom>();

            for (int i = 0; i < 128; i++)
            {
                _weldedBody.Add(BodyFactory.Instance.CreateRectangleBody(25, 25, 10.0f));
                _weldedGeom.Add(GeomFactory.Instance.CreateRectangleGeom(_weldedBody[i], 25, 25));
                _weldedGeom[i].RestitutionCoefficient = 0.0001f;
                _weldedGeom[i].FrictionCoefficient = 0.999f;
                PhysicsSimulator.Add(_weldedBody[i]);
                PhysicsSimulator.Add(_weldedGeom[i]);
            }
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 16; y++)
                {
                    // Width*y + x
                    _weldedBody[8 * y + x].Position = new Vector2((x * 30) + 80, (y * 30) + 80);
                }
            }
            _weld = new Weld(PhysicsSimulator, _weldedGeom);

            base.LoadContent();
        }
Пример #22
0
        private void CreatePadFootings(object sender, EventArgs e)
        {
            // Always remember to check that you really have working connection
            if (MyModel.GetConnectionStatus())
            {
                double wsp3 = int.Parse(textBox1.Text);
                double wsp4 = double.Parse(textBox2.Text);

                Picker piku = new Picker();

                //askjdhygausgfdyzjusrgfafsa
                ArrayList info = new ArrayList();
                info = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ArrayList info2 = new ArrayList();
                info2 = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ModelObject part  = new Beam();
                ModelObject part2 = new Beam();
                Hashtable   p1    = new Hashtable();
                Hashtable   p2    = new Hashtable();

                part = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part.GetDoubleReportProperties(info, ref p1);
                part2 = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part2.GetDoubleReportProperties(info2, ref p2);
                Point st1 = new Point();
                Point st2 = new Point();
                st1 = piku.PickPoint();
                st2 = piku.PickPoint();
                Point st3 = new Point(st1);
                Point st4 = new Point(st2);

                //wektory belek
                Vector v1 = new Vector((Convert.ToDouble(p1["START_X"]) - Convert.ToDouble(p1["END_X"])) / 10000, (Convert.ToDouble(p1["START_Y"]) - Convert.ToDouble(p1["END_Y"])) / 10000, (Convert.ToDouble(p1["START_Z"]) - Convert.ToDouble(p1["END_Z"])) / 10000);
                Vector v2 = new Vector((Convert.ToDouble(p2["START_X"]) - Convert.ToDouble(p2["END_X"])) / 10000, (Convert.ToDouble(p2["START_Y"]) - Convert.ToDouble(p2["END_Y"])) / 10000, (Convert.ToDouble(p2["START_Z"]) - Convert.ToDouble(p2["END_Z"])) / 10000);
                double v1d = v1.GetLength(); double ile1 = 30 / v1d;
                double v2d = v2.GetLength(); double ile2 = 30 / v2d;
                double v1dd = v1.GetLength(); double ile3 = wsp4 / v1d;
                double v2dd = v2.GetLength(); double ile4 = wsp4 / v2d;

                st3.Translate((-v1.X) * ile3, (-v1.Y) * ile3, (-v1.Z) * ile3);
                st1.Translate((v1.X) * ile1, (v1.Y) * ile1, (v1.Z) * ile1);
                st4.Translate((-v2.X) * ile2, (-v2.Y) * ile2, (-v2.Z) * ile2);
                st2.Translate((v2.X) * ile4, (v2.Y) * ile4, (v2.Z) * ile4);

                Contour      testowy = new Contour();
                ContourPoint point1  = new ContourPoint(st1, null);
                ContourPoint point2  = new ContourPoint(st3, new Chamfer(45, 0, Chamfer.ChamferTypeEnum.CHAMFER_ROUNDING));
                ContourPoint point3  = new ContourPoint(st4, null);
                testowy.AddContourPoint(point1);
                testowy.AddContourPoint(point2);
                testowy.AddContourPoint(point3);

                Contour      testowy3 = new Contour();
                ContourPoint point10  = new ContourPoint(st4, null);
                ContourPoint point20  = new ContourPoint(st2, new Chamfer(45, 0, Chamfer.ChamferTypeEnum.CHAMFER_ROUNDING));
                ContourPoint point30  = new ContourPoint(st3, null);
                testowy3.AddContourPoint(point10);
                testowy3.AddContourPoint(point20);
                testowy3.AddContourPoint(point30);

                bool strona = radioButton1.Checked;

                ModelObject nb  = CreateBlacha(testowy, strona);
                ModelObject nb3 = CreateBlacha(testowy3, strona);
                nb.Insert();
                nb3.Insert();

                double l1 = 0.0;
                nb.GetReportProperty("LENGTH", ref l1);


                double l2 = 0.0;
                nb3.GetReportProperty("LENGTH", ref l2);

                nb.Delete();
                nb3.Delete();



                Contour testowy2 = new Contour();
                testowy2.AddContourPoint(point1);
                testowy2.AddContourPoint(point2);
                Point        point4v = new Point(dlugosc(point2, point3, l1));
                ContourPoint point4  = new ContourPoint(point4v, null);
                testowy2.AddContourPoint(point4);
                ModelObject nb2 = CreateBlacha(testowy2, strona);

                Contour testowy4 = new Contour();
                testowy4.AddContourPoint(point10);
                testowy4.AddContourPoint(point20);
                Point        point40v = new Point(dlugosc(point20, point30, l2));
                ContourPoint point40  = new ContourPoint(point40v, null);
                testowy4.AddContourPoint(point40);
                ModelObject nb4 = CreateBlacha(testowy4, strona);


                nb2.Insert();
                BoltArray b2 = sruby(point1, point2, nb2 as Part);
                b2.PartToBoltTo = part as Part;
                b2.BoltSize     = Convert.ToDouble(comboBox3.Text);
                b2.BoltStandard = comboBox2.Text;
                b2.Insert();
                nb4.Insert();
                BoltArray b4 = sruby(point10, point20, nb4 as Part);
                b4.BoltSize     = Convert.ToDouble(comboBox3.Text);
                b4.BoltStandard = comboBox2.Text;
                b4.PartToBoltTo = part2 as Part;
                b4.Insert();

                Point point4st  = new Point(dlugosc(point40, point4, 130));
                Point point40st = new Point(dlugosc(point4, point40, 130));

                Point pointsplit = new Point(dlugosc(point4st, point40st, wsp3 + 180));

                if (comboBox1.Text == "D16")
                {
                    Beam st16 = CreateStezenie16(point4st, point40st, strona);
                    st16.Insert();
                    Weld w  = new Weld();
                    Weld w2 = new Weld();
                    w.MainObject      = st16;
                    w.SecondaryObject = nb2;
                    w.ShopWeld        = true;
                    w.Insert();
                    w2.MainObject      = st16;
                    w2.SecondaryObject = nb4;
                    w2.ShopWeld        = true;
                    w2.Insert();
                    Beam       st161 = Operation.Split(st16, pointsplit);
                    Connection sr    = new Connection();
                    sr.Name   = "Po³¹czenie œrub¹ rzymsk¹";
                    sr.Number = 126;
                    sr.LoadAttributesFromFile("82269_M16");
                    sr.SetPrimaryObject(st161);
                    sr.SetSecondaryObject(st16);
                    sr.Insert();
                }
                if (comboBox1.Text == "D20")
                {
                    Beam st16 = CreateStezenie20(point4st, point40st, strona);
                    st16.Insert();
                    Weld w  = new Weld();
                    Weld w2 = new Weld();
                    w.MainObject      = st16;
                    w.SecondaryObject = nb2;
                    w.ShopWeld        = true;
                    w.Insert();
                    w2.MainObject      = st16;
                    w2.SecondaryObject = nb4;
                    w2.ShopWeld        = true;
                    w2.Insert();
                    Beam       st161 = Operation.Split(st16, pointsplit);
                    Connection sr    = new Connection();
                    sr.Name   = "Po³¹czenie œrub¹ rzymsk¹";
                    sr.Number = 126;
                    sr.LoadAttributesFromFile("82269_M20");
                    sr.SetPrimaryObject(st161);
                    sr.SetSecondaryObject(st16);
                    sr.Insert();
                }
                if (comboBox1.Text == "D12")
                {
                    Beam st16 = CreateStezenie12(point4st, point40st, strona);
                    st16.Insert();
                    Weld w  = new Weld();
                    Weld w2 = new Weld();
                    w.MainObject      = st16;
                    w.SecondaryObject = nb2;
                    w.ShopWeld        = true;
                    w.Insert();
                    w2.MainObject      = st16;
                    w2.SecondaryObject = nb4;
                    w2.ShopWeld        = true;
                    w2.Insert();
                    Beam       st161 = Operation.Split(st16, pointsplit);
                    Connection sr    = new Connection();
                    sr.Name   = "Po³¹czenie œrub¹ rzymsk¹";
                    sr.Number = 126;
                    sr.LoadAttributesFromFile("82269_M12");
                    sr.SetPrimaryObject(st161);
                    sr.SetSecondaryObject(st16);
                    sr.Insert();
                }
            }
            MyModel.CommitChanges();
        }
Пример #23
0
        private static Weld GenerateWeld()
        {
            Random rand = new Random();
            long weldID = NextInt64(rand);

            Weld weld = new Weld()
            {
                WeldID = weldID,
                Pipe1ID = 20130503065448923,
                Pipe2ID = 20130503065448925,
                WeldBarcode = weldID + "_bc",
                WeldNumber = weldID + "_nm",
                WpsNumber = weldID + "wps",
                RepairWpsNumber = weldID + "_rwps",
                Longitude = "30.25",
                Latitude = "97.75",
                Station = "Station W",
                CurrentLocation = "Springfield, OR",
                CreationDate = DateTime.Now,
                LastUpdated = DateTime.Now,
                Status = WeldStatus.Active,
                Repaired = false,
                Type = "Fillet",
                ParentWeldID = null,
                WeldCoating = "FBE",
            };

            return weld;
        }
Пример #24
0
        public void Create()
        {
            Point  Point1              = StartPoint;
            Point  Point2              = EndPoint;
            Vector mainVector          = new Vector(Point2.X - Point1.X, Point2.Y - Point1.Y, Point2.Z - Point1.Z);
            Vector zaxis               = new Vector(0, 0, -1);
            double height              = Point1.Z - Point2.Z;
            Vector heightStair         = zaxis * height;
            Point  heightStairEndPt    = new Point(Point1.X + heightStair.X, Point1.Y + heightStair.Y, Point1.Z + heightStair.Z);
            Vector subMainVector       = new Vector(Point2.X - heightStairEndPt.X, Point2.Y - heightStairEndPt.Y, Point2.Z - heightStairEndPt.Z);
            double stairLength         = height / Math.Tan(Ang * Math.PI / 180);
            Vector normallengthStair   = subMainVector.GetNormal();
            Vector lengthStair         = normallengthStair * stairLength;
            Point  lengthStairEndPoint = new Point(heightStairEndPt.X + lengthStair.X, heightStairEndPt.Y + lengthStair.Y, heightStairEndPt.Z + lengthStair.Z);
            Vector mainStairVector     = new Vector(lengthStairEndPoint.X - Point1.X, lengthStairEndPoint.Y - Point1.Y, lengthStairEndPoint.Z - Point1.Z);

            Vector leftOffsetVector       = Vector.Cross(heightStair, mainVector);
            Vector normalOffsetBeamVector = leftOffsetVector.GetNormal();

            leftOffsetVector = normalOffsetBeamVector * (Width / 2);
            Vector horizontalVector = normallengthStair * (-1);
            //   Vector horizontalVectorLength = horizontalVector * lengthStartSegment;
            Point leftBeamStartPt = new Point(Point1.X + leftOffsetVector.X, Point1.Y + leftOffsetVector.Y, Point1.Z + leftOffsetVector.Z);
            Point leftBeamEndPt   = new Point(lengthStairEndPoint.X + leftOffsetVector.X, lengthStairEndPoint.Y + leftOffsetVector.Y, lengthStairEndPoint.Z + leftOffsetVector.Z);
            // offset for fixture beam corner
            Vector offsetAlongStairVector = normallengthStair * 15;

            leftBeamStartPt = new Point(leftBeamStartPt.X + offsetAlongStairVector.X, leftBeamStartPt.Y + offsetAlongStairVector.Y, leftBeamStartPt.Z + offsetAlongStairVector.Z);
            leftBeamEndPt   = new Point(leftBeamEndPt.X + offsetAlongStairVector.X, leftBeamEndPt.Y + offsetAlongStairVector.Y, leftBeamEndPt.Z + offsetAlongStairVector.Z);

            Vector rightOffsetVector = leftOffsetVector * (-1);
            Point  rightBeamStartPt  = new Point(Point1.X + rightOffsetVector.X, Point1.Y + rightOffsetVector.Y, Point1.Z + rightOffsetVector.Z);
            Point  rightBeamEndPt    = new Point(lengthStairEndPoint.X + rightOffsetVector.X, lengthStairEndPoint.Y + rightOffsetVector.Y, lengthStairEndPoint.Z + rightOffsetVector.Z);

            // offset for fixture beam corner
            rightBeamStartPt = new Point(rightBeamStartPt.X + offsetAlongStairVector.X, rightBeamStartPt.Y + offsetAlongStairVector.Y, rightBeamStartPt.Z + offsetAlongStairVector.Z);
            rightBeamEndPt   = new Point(rightBeamEndPt.X + offsetAlongStairVector.X, rightBeamEndPt.Y + offsetAlongStairVector.Y, rightBeamEndPt.Z + offsetAlongStairVector.Z);

            TSM.Beam rightBeam = new TSM.Beam(leftBeamStartPt, leftBeamEndPt);
            rightBeam.Class                   = "11";
            rightBeam.Position.Plane          = TSM.Position.PlaneEnum.RIGHT;
            rightBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            rightBeam.Position.Rotation       = TSM.Position.RotationEnum.TOP;
            rightBeam.Profile.ProfileString   = Profile;
            rightBeam.Material.MaterialString = Material;
            rightBeam.Finish                  = "PAINT";
            rightBeam.Insert();

            MainStringer = rightBeam;
            //   TSM.Operations.Operation.DisplayPrompt($"Высота профиля: {hprofile}");

            TSM.Beam leftBeam = new TSM.Beam(rightBeamStartPt, rightBeamEndPt);
            leftBeam.Class                   = "11";
            leftBeam.Position.Plane          = TSM.Position.PlaneEnum.LEFT;
            leftBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            leftBeam.Position.Rotation       = TSM.Position.RotationEnum.BELOW;
            leftBeam.Profile.ProfileString   = Profile;
            leftBeam.Material.MaterialString = Material;
            leftBeam.Finish                  = "PAINT";
            leftBeam.Insert();

            SecondStringer = leftBeam;
            // fitting kosours

            Vector xaxis = normallengthStair;
            Vector yaxis = normalOffsetBeamVector;

            CuttingBeam(rightBeam, leftBeamStartPt, zaxis, yaxis);
            CuttingBeam(rightBeam, leftBeamEndPt, xaxis, yaxis);
            CuttingBeam(leftBeam, rightBeamStartPt, zaxis, yaxis);
            CuttingBeam(leftBeam, rightBeamEndPt, xaxis, yaxis);

            // add beam corner
            Vector offsetLeftStartCrossStairVector = normalOffsetBeamVector * ((Width / 2) - 20) * (-1);
            Vector offsetLeftEndCrossStairVector   = normalOffsetBeamVector * (100) * (-1);
            Vector offsetOrtVector          = zaxis * (-1) * 5;
            Point  offsetOrtPoint           = new Point(Point1.X + offsetOrtVector.X, Point1.Y + offsetOrtVector.Y, Point1.Z + offsetOrtVector.Z);
            Point  offsetCrossPoint         = new Point(offsetOrtPoint.X + offsetLeftStartCrossStairVector.X, offsetOrtPoint.Y + offsetLeftStartCrossStairVector.Y, offsetOrtPoint.Z + offsetLeftStartCrossStairVector.Z);
            Point  startLeftBeamCornerPoint = new Point(offsetCrossPoint.X + offsetAlongStairVector.X, offsetCrossPoint.Y + offsetAlongStairVector.Y, offsetCrossPoint.Z + offsetAlongStairVector.Z);
            Point  endLeftBeamCornerPoint   = new Point(startLeftBeamCornerPoint.X + offsetLeftEndCrossStairVector.X, startLeftBeamCornerPoint.Y + offsetLeftEndCrossStairVector.Y, startLeftBeamCornerPoint.Z + offsetLeftEndCrossStairVector.Z);

            TSM.Beam leftBeamCorner = new TSM.Beam(startLeftBeamCornerPoint, endLeftBeamCornerPoint);

            leftBeamCorner.Class                 = "8";
            leftBeamCorner.Position.Plane        = TSM.Position.PlaneEnum.LEFT;     // LEFT
            leftBeamCorner.Position.Depth        = Position.DepthEnum.BEHIND;
            leftBeamCorner.Position.Rotation     = TSM.Position.RotationEnum.BELOW; // BELOW
            leftBeamCorner.Profile.ProfileString = "L63X5_8509_93";
            leftBeamCorner.Finish                = "PAINT";
            leftBeamCorner.Insert();

            Vector offsetRightStartCrossStairVector = normalOffsetBeamVector * ((Width / 2) - 20);
            Vector offsetRightEndCrossStairVector   = normalOffsetBeamVector * (100);

            offsetCrossPoint = new Point(offsetOrtPoint.X + offsetRightStartCrossStairVector.X, offsetOrtPoint.Y + offsetRightStartCrossStairVector.Y, offsetOrtPoint.Z + offsetRightStartCrossStairVector.Z);
            Point startRightBeamCornerPoint = new Point(offsetCrossPoint.X + offsetAlongStairVector.X, offsetCrossPoint.Y + offsetAlongStairVector.Y, offsetCrossPoint.Z + offsetAlongStairVector.Z);
            Point endRightBeamCornerPoint   = new Point(startRightBeamCornerPoint.X + offsetRightEndCrossStairVector.X, startRightBeamCornerPoint.Y + offsetRightEndCrossStairVector.Y, startRightBeamCornerPoint.Z + offsetRightEndCrossStairVector.Z);

            TSM.Beam rightBeamCorner = new TSM.Beam(startRightBeamCornerPoint, endRightBeamCornerPoint);

            rightBeamCorner.Class                 = "8";
            rightBeamCorner.Position.Plane        = TSM.Position.PlaneEnum.RIGHT;   // LEFT
            rightBeamCorner.Position.Depth        = Position.DepthEnum.BEHIND;
            rightBeamCorner.Position.Rotation     = TSM.Position.RotationEnum.BACK; // BELOW
            rightBeamCorner.Profile.ProfileString = "L63X5_8509_93";
            rightBeamCorner.Finish                = "PAINT";
            rightBeamCorner.Insert();

            // calculate offsets

            //   var hprofile = GetHeightBeam(rightBeam, leftBeamStartPt);
            double hprofile = 0;

            rightBeam.GetReportProperty("HEIGHT", ref hprofile);
            var hoffset = hprofile / Math.Cos(Ang * Math.PI / 180);

            Vector hOrtVect = zaxis * hoffset;

            StartStepsPoint = new Point(Point1.X + offsetAlongStairVector.X, Point1.Y + offsetAlongStairVector.Y, Point1.Z + offsetAlongStairVector.Z);
            StairVector     = normallengthStair;
            // Height = height - hprofile;

            Weld rightWeldStringer = new Weld();

            rightWeldStringer.MainObject        = rightBeam;
            rightWeldStringer.SecondaryObject   = rightBeamCorner;
            rightWeldStringer.ConnectAssemblies = false;
            rightWeldStringer.ShopWeld          = true;
            rightWeldStringer.AroundWeld        = false;
            rightWeldStringer.TypeAbove         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            rightWeldStringer.TypeBelow         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            rightWeldStringer.SizeAbove         = -100;
            rightWeldStringer.SizeBelow         = -100;
            rightWeldStringer.Insert();

            Weld leftWeldStringer = new Weld();

            leftWeldStringer.MainObject        = leftBeam;
            leftWeldStringer.SecondaryObject   = leftBeamCorner;
            leftWeldStringer.ConnectAssemblies = false;
            leftWeldStringer.ShopWeld          = true;
            leftWeldStringer.AroundWeld        = false;
            leftWeldStringer.TypeAbove         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            leftWeldStringer.TypeBelow         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            leftWeldStringer.SizeAbove         = -100;
            leftWeldStringer.SizeBelow         = -100;
            leftWeldStringer.Insert();
        }
Пример #25
0
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                // 오버라이드 된 DefineInput에서 List를 가져옴
                // purlin = 중도리 지붕을 지탱하는 골조
                // flange = 플랜지 파이프를 연결하기 위한 배관?
                Beam Purlin1 = (Beam)_model.SelectModelObject((Identifier)Input[0].GetInput());
                Beam Purlin2 = (Beam)_model.SelectModelObject((Identifier)Input[1].GetInput());
                Beam OFlange = (Beam)_model.SelectModelObject((Identifier)Input[2].GetInput());
                Beam Web     = (Beam)_model.SelectModelObject((Identifier)Input[3].GetInput());
                Beam IFlange = (Beam)_model.SelectModelObject((Identifier)Input[4].GetInput());

                // 초기값 체크
                GetValuesFromDialog();

                double WebThick     = 0.0;
                double IFlangeWidth = 0.0;
                double IFlangeThick = 0.0;
                double OFlangeThick = 0.0;
                Web.GetReportProperty("WIDTH", ref WebThick);
                OFlange.GetReportProperty("WIDTH", ref OFlangeThick);
                IFlange.GetReportProperty("WIDTH", ref IFlangeThick);
                IFlange.GetReportProperty("HEIGHT", ref IFlangeWidth);

                if (IsDefaultValue(_PlateWidth) || _PlateWidth == 0)
                {
                    _PlateWidth = (IFlangeWidth - WebThick) * 0.5;
                }
                if (IsDefaultValue(_PlateLength) || _PlateLength == 0)
                {
                    _PlateLength = (IFlangeWidth - WebThick) * 0.5;
                }

                CoordinateSystem WebSys = Web.GetCoordinateSystem();

                // 평면(Web)과 선(purlin1의 시작과 끝점)이 만나는 교차점
                T3D.Point TopCenter = T3D.Intersection.LineToPlane(new Line(Purlin1.StartPoint, Purlin1.EndPoint), new GeometricPlane(WebSys.Origin, WebSys.AxisX, WebSys.AxisY));

                // 실제 좌표점(x,y,z)
                CoordinateSystem WorkSystem = new CoordinateSystem(TopCenter, WebSys.AxisX.Cross(WebSys.AxisY), WebSys.AxisY);

                // CoordinateSystem의 실좌표를 Plane 변경
                _model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(WorkSystem));

                Purlin1.Select();
                Purlin2.Select();
                Web.Select();
                OFlange.Select();
                IFlange.Select();

                CoordinateSystem PurSys        = Purlin1.GetCoordinateSystem();
                T3D.Point        TopClipCenter = T3D.Intersection.LineToPlane(new Line(OFlange.StartPoint, OFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY));
                T3D.Point        BottCenter    = T3D.Intersection.LineToPlane(new Line(IFlange.StartPoint, IFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY));

                T3D.Point LeftAngleFirstPoint   = new T3D.Point(-_UpperHorizontalDistance, _UpperVerticalDistance, 0);
                T3D.Point LeftAngleSecondPoint  = new T3D.Point(-_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0);
                T3D.Point RightAngleFirstPoint  = new T3D.Point(_UpperHorizontalDistance, _UpperVerticalDistance, 0);
                T3D.Point RightAngleSecondPoint = new T3D.Point(_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0);

                Beam         LeftAngle  = new Beam();
                Beam         RightAngle = new Beam();
                Beam         TopClip    = new Beam();
                ContourPlate LeftPlate  = new ContourPlate();
                ContourPlate RightPlate = new ContourPlate();

                TopClip.StartPoint = new T3D.Point(-_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0);
                TopClip.EndPoint   = new T3D.Point(_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0);

                if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisY.GetNormal() == new Vector(0, 1, 0))
                {
                    LeftAngle.StartPoint         = LeftAngleSecondPoint;
                    LeftAngle.EndPoint           = LeftAngleFirstPoint;
                    RightAngle.StartPoint        = RightAngleFirstPoint;
                    RightAngle.EndPoint          = RightAngleSecondPoint;
                    LeftAngle.Position.Plane     = Position.PlaneEnum.LEFT;
                    LeftAngle.Position.Rotation  = Position.RotationEnum.BELOW;
                    LeftAngle.Position.Depth     = Position.DepthEnum.BEHIND;
                    RightAngle.Position.Plane    = Position.PlaneEnum.LEFT;
                    RightAngle.Position.Rotation = Position.RotationEnum.BELOW;
                    RightAngle.Position.Depth    = Position.DepthEnum.BEHIND;
                    TopClip.Position.Plane       = Position.PlaneEnum.LEFT;
                    TopClip.Position.Rotation    = Position.RotationEnum.FRONT;
                    TopClip.Position.Depth       = Position.DepthEnum.BEHIND;
                    LeftPlate.Position.Depth     = Position.DepthEnum.FRONT;
                    RightPlate.Position.Depth    = Position.DepthEnum.FRONT;
                }
                else
                {
                    LeftAngle.StartPoint         = LeftAngleFirstPoint;
                    LeftAngle.EndPoint           = LeftAngleSecondPoint;
                    RightAngle.StartPoint        = RightAngleFirstPoint;
                    RightAngle.EndPoint          = RightAngleSecondPoint;
                    LeftAngle.Position.Plane     = Position.PlaneEnum.RIGHT;
                    LeftAngle.Position.Rotation  = Position.RotationEnum.TOP;
                    LeftAngle.Position.Depth     = Position.DepthEnum.FRONT;
                    RightAngle.Position.Plane    = Position.PlaneEnum.RIGHT;
                    RightAngle.Position.Rotation = Position.RotationEnum.FRONT;
                    RightAngle.Position.Depth    = Position.DepthEnum.FRONT;
                    TopClip.Position.Plane       = Position.PlaneEnum.LEFT;
                    TopClip.Position.Rotation    = Position.RotationEnum.FRONT;
                    TopClip.Position.Depth       = Position.DepthEnum.FRONT;
                    LeftPlate.Position.Depth     = Position.DepthEnum.BEHIND;
                    RightPlate.Position.Depth    = Position.DepthEnum.BEHIND;
                }

                LeftAngle.Profile.ProfileString   = _FlangeProfile;
                LeftAngle.Material.MaterialString = _FlangeMaterial;
                LeftAngle.Class = _FlangeClass;
                LeftAngle.Name  = _FlangeName;
                LeftAngle.Insert();

                RightAngle.Profile.ProfileString   = _FlangeProfile;
                RightAngle.Material.MaterialString = _FlangeMaterial;
                RightAngle.Class = _FlangeClass;
                RightAngle.Name  = _FlangeName;
                RightAngle.Insert();

                double BraceWidth     = 0.0;
                double BraceThickness = 0.0;
                RightAngle.GetReportProperty("WIDTH", ref BraceWidth);
                RightAngle.GetReportProperty("PROFILE.FLANGE_THICKNESS_1", ref BraceThickness);

                double BoltGauge = (BraceWidth + BraceThickness) * 0.5;
                LeftAngle.Position.PlaneOffset = -BoltGauge;
                LeftAngle.StartPointOffset.Dx  = _UpperBoltHorizontalDistance;
                LeftAngle.EndPointOffset.Dx    = _LowerBoltHorizontalDistance;
                LeftAngle.Modify();
                RightAngle.Position.PlaneOffset = -BoltGauge;
                RightAngle.StartPointOffset.Dx  = -_LowerBoltHorizontalDistance;
                RightAngle.EndPointOffset.Dx    = _UpperBoltHorizontalDistance;
                RightAngle.Modify();

                TopClip.Profile.ProfileString   = "PL" + _TopClipThickness + "*" + _TopClipWidth;
                TopClip.Material.MaterialString = _TopClipMaterial;
                TopClip.Name = _TopClipName;
                TopClip.Insert();

                Point        LeftPlatePoint1        = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y, 0);
                Point        LeftPlatePoint2        = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y + _PlateLength, 0);
                Point        LeftPlatePoint3        = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y + _PlateLength, 0);
                Point        LeftPlatePoint4        = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y, 0);
                ContourPoint LeftPlateContourPoint1 = new ContourPoint(LeftPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE));
                ContourPoint LeftPlateContourPoint2 = new ContourPoint(LeftPlatePoint2, new Chamfer());
                ContourPoint LeftPlateContourPoint3 = new ContourPoint(LeftPlatePoint3, new Chamfer());
                ContourPoint LeftPlateContourPoint4 = new ContourPoint(LeftPlatePoint4, new Chamfer());
                LeftPlate.AddContourPoint(LeftPlateContourPoint1);
                LeftPlate.AddContourPoint(LeftPlateContourPoint2);
                LeftPlate.AddContourPoint(LeftPlateContourPoint3);
                LeftPlate.AddContourPoint(LeftPlateContourPoint4);
                LeftPlate.Material.MaterialString = _PlateMaterial;
                LeftPlate.Profile.ProfileString   = "PL" + _PlateThickness.ToString();
                LeftPlate.Name = _PlateName;
                LeftPlate.Insert();

                Point        RightPlatePoint1        = new Point(BottCenter.X + WebThick * 0.5, BottCenter.Y, 0);
                Point        RightPlatePoint2        = new Point(RightPlatePoint1.X + _PlateWidth, RightPlatePoint1.Y, 0);
                Point        RightPlatePoint3        = new Point(RightPlatePoint2.X, RightPlatePoint2.Y + _PlateLength, 0);
                Point        RightPlatePoint4        = new Point(RightPlatePoint3.X - _PlateWidth, RightPlatePoint3.Y, 0);
                ContourPoint RightPlateContourPoint1 = new ContourPoint(RightPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE));
                ContourPoint RightPlateContourPoint2 = new ContourPoint(RightPlatePoint2, new Chamfer());
                ContourPoint RightPlateContourPoint3 = new ContourPoint(RightPlatePoint3, new Chamfer());
                ContourPoint RightPlateContourPoint4 = new ContourPoint(RightPlatePoint4, new Chamfer());
                RightPlate.AddContourPoint(RightPlateContourPoint1);
                RightPlate.AddContourPoint(RightPlateContourPoint2);
                RightPlate.AddContourPoint(RightPlateContourPoint3);
                RightPlate.AddContourPoint(RightPlateContourPoint4);
                RightPlate.Material.MaterialString = _PlateMaterial;
                RightPlate.Profile.ProfileString   = "PL" + _PlateThickness.ToString();
                RightPlate.Name = _PlateName;
                RightPlate.Insert();

                Beam LeftPurlin  = Purlin1;
                Beam RightPurlin = Purlin2;
                if ((Purlin1.StartPoint.X - Purlin2.StartPoint.X) > 1 || (Purlin1.StartPoint.Y - Purlin2.StartPoint.Y) > 1)
                {
                    RightPurlin = Purlin1;
                    LeftPurlin  = Purlin2;
                }

                Weld LeftPlateToIFlange = new Weld();
                LeftPlateToIFlange.MainObject      = IFlange;
                LeftPlateToIFlange.SecondaryObject = LeftPlate;
                LeftPlateToIFlange.ShopWeld        = true;
                LeftPlateToIFlange.Insert();
                Weld LeftPlateToWeb = new Weld();
                LeftPlateToWeb.MainObject      = Web;
                LeftPlateToWeb.SecondaryObject = LeftPlate;
                LeftPlateToWeb.ShopWeld        = true;
                LeftPlateToWeb.Insert();
                Weld RightPlateToIFlange = new Weld();
                RightPlateToIFlange.MainObject      = IFlange;
                RightPlateToIFlange.SecondaryObject = RightPlate;
                RightPlateToIFlange.ShopWeld        = true;
                RightPlateToIFlange.Insert();
                Weld RightPlateToWeb = new Weld();
                RightPlateToWeb.MainObject      = Web;
                RightPlateToWeb.SecondaryObject = RightPlate;
                RightPlateToWeb.ShopWeld        = true;
                RightPlateToWeb.Insert();

                PolygonWeld ClipToFlange = new PolygonWeld();
                ClipToFlange.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                ClipToFlange.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                ClipToFlange.SizeAbove       = _ClipWeldSize;
                ClipToFlange.SizeBelow       = _ClipWeldSize;
                ClipToFlange.MainObject      = OFlange;
                ClipToFlange.SecondaryObject = TopClip;
                ClipToFlange.ShopWeld        = true;
                ClipToFlange.Polygon.Points.Add(TopClip.StartPoint);
                ClipToFlange.Polygon.Points.Add(TopClip.EndPoint);
                ClipToFlange.Insert();

                // Bolting Brace with Plate or Purlin
                BoltArray UpperLeftBolt = new BoltArray();
                UpperLeftBolt.PartToBoltTo   = LeftPurlin;
                UpperLeftBolt.PartToBeBolted = LeftAngle;
                UpperLeftBolt.FirstPosition  = LeftAngle.StartPoint;
                UpperLeftBolt.SecondPosition = LeftAngle.EndPoint;
                UpperLeftBolt.AddBoltDistX(0.0);
                UpperLeftBolt.AddBoltDistY(0.0);
                UpperLeftBolt.BoltSize          = _BraceBoltSize;
                UpperLeftBolt.Tolerance         = 0.0625 * 25.4;
                UpperLeftBolt.BoltStandard      = _BraceBoltStandard;
                UpperLeftBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                UpperLeftBolt.CutLength         = 76.2;
                UpperLeftBolt.Bolt              = true;
                UpperLeftBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray LowerLeftBolt = new BoltArray();
                LowerLeftBolt.PartToBoltTo   = LeftPlate;
                LowerLeftBolt.PartToBeBolted = LeftAngle;
                LowerLeftBolt.FirstPosition  = LeftAngle.EndPoint;
                LowerLeftBolt.SecondPosition = LeftAngle.StartPoint;
                LowerLeftBolt.AddBoltDistX(0.0);
                LowerLeftBolt.AddBoltDistY(0.0);
                LowerLeftBolt.BoltSize          = _BraceBoltSize;
                LowerLeftBolt.BoltStandard      = _BraceBoltStandard;
                LowerLeftBolt.Tolerance         = 0.0625 * 25.4;
                LowerLeftBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                LowerLeftBolt.CutLength         = 76.2;
                LowerLeftBolt.Bolt              = true;
                LowerLeftBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray UpperRightBolt = new BoltArray();
                UpperRightBolt.PartToBoltTo   = RightPurlin;
                UpperRightBolt.PartToBeBolted = RightAngle;
                UpperRightBolt.FirstPosition  = RightAngle.EndPoint;
                UpperRightBolt.SecondPosition = RightAngle.StartPoint;
                UpperRightBolt.AddBoltDistX(0.0);
                UpperRightBolt.AddBoltDistY(0.0);
                UpperRightBolt.BoltSize          = _BraceBoltSize;
                UpperRightBolt.Tolerance         = 0.0625 * 25.4;
                UpperRightBolt.BoltStandard      = _BraceBoltStandard;
                UpperRightBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                UpperRightBolt.CutLength         = 76.2;
                UpperRightBolt.Bolt              = true;
                UpperRightBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray LowerRightBolt = new BoltArray();
                LowerRightBolt.PartToBoltTo   = RightPlate;
                LowerRightBolt.PartToBeBolted = RightAngle;
                LowerRightBolt.FirstPosition  = RightAngle.StartPoint;
                LowerRightBolt.SecondPosition = RightAngle.EndPoint;
                LowerRightBolt.AddBoltDistX(0.0);
                LowerRightBolt.AddBoltDistY(0.0);
                LowerRightBolt.BoltSize          = _BraceBoltSize;
                LowerRightBolt.Tolerance         = 0.0625 * 25.4;
                LowerRightBolt.BoltStandard      = _BraceBoltStandard;
                LowerRightBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                LowerRightBolt.CutLength         = 76.2;
                LowerRightBolt.Bolt              = true;
                LowerRightBolt.Position.Rotation = Position.RotationEnum.FRONT;

                // Bolting ClipPlate with purlin
                BoltArray ClipBolts1 = new BoltArray();
                ClipBolts1.PartToBoltTo        = LeftPurlin;
                ClipBolts1.PartToBeBolted      = TopClip;
                ClipBolts1.FirstPosition       = TopClip.StartPoint;
                ClipBolts1.SecondPosition      = TopClip.EndPoint;
                ClipBolts1.StartPointOffset.Dx = 31.75;
                ClipBolts1.AddBoltDistX(0);
                ClipBolts1.AddBoltDistY(76.2);
                ClipBolts1.StartPointOffset.Dy = 76.2;
                ClipBolts1.EndPointOffset.Dy   = 76.2;
                ClipBolts1.BoltSize            = _ClipBoltSize;
                ClipBolts1.Tolerance           = 0.0625 * 25.4;
                ClipBolts1.BoltStandard        = _CliptBoltStandard;
                ClipBolts1.BoltType            = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                ClipBolts1.CutLength           = 76.2;
                ClipBolts1.Bolt = true;
                ClipBolts1.Position.Rotation = Position.RotationEnum.FRONT;

                BoltArray ClipBolts2 = new BoltArray();
                ClipBolts2.PartToBoltTo        = RightPurlin;
                ClipBolts2.PartToBeBolted      = TopClip;
                ClipBolts2.FirstPosition       = TopClip.StartPoint;
                ClipBolts2.SecondPosition      = TopClip.EndPoint;
                ClipBolts2.StartPointOffset.Dx = _TopClipLength - 31.75;
                ClipBolts2.AddBoltDistX(0);
                ClipBolts2.AddBoltDistY(76.2);
                ClipBolts2.StartPointOffset.Dy = 76.2;
                ClipBolts2.EndPointOffset.Dy   = 76.2;
                ClipBolts2.BoltSize            = _ClipBoltSize;
                ClipBolts2.Tolerance           = 0.0625 * 25.4;
                ClipBolts2.BoltStandard        = _CliptBoltStandard;
                ClipBolts2.BoltType            = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                ClipBolts2.CutLength           = 76.2;
                ClipBolts2.Bolt = true;
                ClipBolts2.Position.Rotation = Position.RotationEnum.FRONT;

                if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisX.GetNormal() == new Vector(0, 1, 0))
                {
                    UpperLeftBolt.FirstPosition      = LeftAngle.EndPoint;
                    UpperLeftBolt.SecondPosition     = LeftAngle.StartPoint;
                    UpperLeftBolt.Position.Rotation  = Position.RotationEnum.BACK;
                    LowerLeftBolt.FirstPosition      = LeftAngle.StartPoint;
                    LowerLeftBolt.SecondPosition     = LeftAngle.EndPoint;
                    LowerLeftBolt.Position.Rotation  = Position.RotationEnum.BACK;
                    UpperRightBolt.FirstPosition     = RightAngle.StartPoint;
                    UpperRightBolt.SecondPosition    = RightAngle.EndPoint;
                    UpperRightBolt.Position.Rotation = Position.RotationEnum.BACK;
                    LowerRightBolt.FirstPosition     = RightAngle.StartPoint;
                    LowerRightBolt.SecondPosition    = RightAngle.EndPoint;
                    LowerRightBolt.Position.Rotation = Position.RotationEnum.BACK;
                    ClipBolts1.Position.Rotation     = Position.RotationEnum.BACK;
                    ClipBolts2.Position.Rotation     = Position.RotationEnum.BACK;
                }
                UpperLeftBolt.Insert();
                LowerLeftBolt.Insert();
                UpperRightBolt.Insert();
                LowerRightBolt.Insert();
                ClipBolts1.Insert();
                ClipBolts2.Insert();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }

            return(true);
        }