Exemplo n.º 1
0
        public static void Beam(int index, Vector3 nodeStart, Vector3 nodeEnd, float width, float hight, GameObject parent, int elemNum)
        {
            // かぶり、鉄筋径はとりあえずで設定
            float kaburi     = 50 / 1000f;
            float bandD      = 10 / 1000f;
            float mainD      = 25 / 1000f;
            float barSpace   = Mathf.Max(1.5f * mainD, 25 / 1000f); // 鉄筋のあき
            float bandSpace  = 2 * kaburi + bandD;
            float main1Space = bandSpace + bandD + mainD;
            float main2Space = main1Space + 2 * (mainD + barSpace);
            float main3Space = main2Space + 2 * (mainD + barSpace);

            Vector3[,] strupPos = GetBeamCorner(nodeStart, nodeEnd, width - bandSpace, hight, bandSpace / 2);
            Vector3[,] main1Pos = GetBeamCorner(nodeStart, nodeEnd, width - main1Space, hight, main1Space / 2);
            Vector3[,] main2Pos = GetBeamCorner(nodeStart, nodeEnd, width - main1Space, hight, main2Space / 2);
            Vector3[,] main3Pos = GetBeamCorner(nodeStart, nodeEnd, width - main1Space, hight, main3Space / 2);

            string     name   = string.Format("Bar" + "{0}", elemNum);
            GameObject barObj = new GameObject(name);

            barObj.transform.parent = parent.transform;

            CreateBar.Stirrup(strupPos, bandD, index, barObj);
            CreateBar.BeamMainBar(main1Pos, main2Pos, main3Pos, barSpace, mainD, index, barObj);
        }
Exemplo n.º 2
0
        void MakeElementMesh(XDocument xDoc, string xDateTag, string structType)
        {
            Vector3 nodeStart, nodeEnd;
            float   height = 0;
            float   width = 0;
            int     elemNum = 0;
            int     stbSecIndex = 0;
            int     nodeIndexStart, nodeIndexEnd, xNodeStart, xNodeEnd, xElementIdSection, idSection;
            var     xElements = xDoc.Root.Descendants(xDateTag);
            string  shape, xKind;
            string  shapeType = "";

            GameObject elements = new GameObject(xDateTag + "s");
            GameObject barObj   = new GameObject(xDateTag + "Bar");

            elements.transform.parent = GameObject.Find("StbData").transform;
            barObj.transform.parent   = GameObject.Find("StbData").transform;
            foreach (var xElement in xElements)
            {
                switch (structType)
                {
                case "Girder":
                case "Beam":
                case "Brace":
                    xNodeStart = (int)xElement.Attribute("idNode_start");
                    xNodeEnd   = (int)xElement.Attribute("idNode_end");
                    break;

                case "Column":
                case "Post":
                    xNodeStart = (int)xElement.Attribute("idNode_bottom");
                    xNodeEnd   = (int)xElement.Attribute("idNode_top");
                    break;

                default:
                    xNodeStart = 0;
                    xNodeEnd   = 0;
                    break;
                }
                xElementIdSection = (int)xElement.Attribute("id_section");
                xKind             = (string)xElement.Attribute("kind_structure");

                // 始点と終点の座標取得
                nodeIndexStart = _nodes.Id.IndexOf(xNodeStart);
                nodeIndexEnd   = _nodes.Id.IndexOf(xNodeEnd);
                nodeStart      = _nodes.Vertex[nodeIndexStart];
                nodeEnd        = _nodes.Vertex[nodeIndexEnd];

                if (xKind == "RC")
                {
                    switch (structType)
                    {
                    case "Girder":
                    case "Beam":
                        stbSecIndex = _secBeamRC.Id.IndexOf(xElementIdSection);
                        height      = _secBeamRC.Depth[stbSecIndex];
                        width       = _secBeamRC.Width[stbSecIndex];
                        break;

                    case "Column":
                    case "Post":
                        stbSecIndex = _secColumnRC.Id.IndexOf(xElementIdSection);
                        height      = _secColumnRC.Height[stbSecIndex];
                        width       = _secColumnRC.Width[stbSecIndex];
                        break;

                    default:
                        break;
                    }
                    if (height == 0)
                    {
                        shapeType = "Pipe";
                    }
                    else
                    {
                        shapeType = "BOX";
                    }
                }
                else if (xKind == "S")
                {
                    switch (structType)
                    {
                    case "Girder":
                    case "Beam":
                        idSection = _secBeamS.Id.IndexOf(xElementIdSection);
                        shape     = _secBeamS.Shape[idSection];
                        break;

                    case "Column":
                    case "Post":
                        idSection = _secColumnS.Id.IndexOf(xElementIdSection);
                        shape     = _secColumnS.Shape[idSection];
                        break;

                    case "Brace":
                        idSection = _secBraceS.Id.IndexOf(xElementIdSection);
                        shape     = _secBraceS.Shape[idSection];
                        break;

                    default:
                        shape = "";
                        break;
                    }
                    stbSecIndex = _xStName.IndexOf(shape);
                    height      = _xStParamA[stbSecIndex] / 1000f;
                    width       = _xStParamB[stbSecIndex] / 1000f;
                    shapeType   = _xStType[stbSecIndex];
                }
                _shapeMesh = MakeElementsMeshFromVertex(nodeStart, nodeEnd, height, width, shapeType, structType, elemNum, elements, xKind);
                // 配筋の作成
                if (xKind == "RC")
                {
                    if (shapeType == "BOX")
                    {
                        switch (structType)
                        {
                        case "Column":
                        case "Post":
                            CreateBar.Column(stbSecIndex, nodeStart, nodeEnd, width, height, barObj, elemNum);
                            break;

                        case "Girder":
                        case "Beam":
                            CreateBar.Beam(stbSecIndex, nodeStart, nodeEnd, width, height, barObj, elemNum);
                            break;

                        default:
                            break;
                        }
                    }
                }
                elemNum++;
            }
            _shapeMesh.Clear();
        }