Example #1
0
        private void CreateBrep()
        {
            StbMembers member      = _stBridge.StbModel.StbMembers;
            var        brepFromStb = new CreateMemberBrepListFromStb(_stBridge.StbModel.StbSections, _stBridge.StbModel.StbNodes, new[] { DocumentTolerance(), DocumentAngleTolerance() });

            _brepList[0] = brepFromStb.Column(member.StbColumns);
            _brepList[1] = brepFromStb.Girder(member.StbGirders);
            _brepList[2] = brepFromStb.Post(member.StbPosts);
            _brepList[3] = brepFromStb.Beam(member.StbBeams);
            _brepList[4] = brepFromStb.Brace(member.StbBraces);
            _brepList[5] = brepFromStb.Slab(member.StbSlabs);
            _brepList[6] = brepFromStb.Wall(member.StbWalls, member.StbOpens);
        }
Example #2
0
        public static Dictionary <string, string>[][] GetAllSectionInfoArray(StbMembers members, StbSections sections)
        {
            var allTagList = new Dictionary <string, string> [7][];

            var memberArray = new object[][] { members.StbColumns, members.StbGirders, members.StbPosts, members.StbBeams, members.StbBraces, members.StbSlabs, members.StbWalls };

            for (var i = 0; i < 7; i++)
            {
                allTagList[i] = memberArray[i] != null?StbMembersToDictArray(memberArray[i], sections) : Array.Empty <Dictionary <string, string> >();
            }

            return(allTagList);
        }
Example #3
0
        public static List <BuilderBeam> BuilderBeams(StbModel model, List <string>[] k3dIds)
        {
            var k3dBeams = new List <BuilderBeam>();

            StbNode[]  nodes   = model.StbNodes;
            StbMembers members = model.StbMembers;

            k3dBeams.AddRange(StbColumnToK3dBeam(k3dIds[0], nodes, members.StbColumns));
            k3dBeams.AddRange(StbGirderToK3dBeam(k3dIds[1], nodes, members.StbGirders));
            k3dBeams.AddRange(StbBraceToK3dBeam(k3dIds[2], nodes, members.StbBraces));

            return(k3dBeams);
        }
Example #4
0
        public StbModel SetByAngle(double colMaxAngle)
        {
            // TODO: リストが大量にあるの直す
            var columns      = new List <StbColumn>();
            var girders      = new List <StbGirder>();
            var braces       = new List <StbBrace>();
            var secBeams_S   = new List <StbSecBeam_S>();
            var secBeams_Rc  = new List <StbSecBeam_RC>();
            var secColumn_S  = new List <StbSecColumn_S>();
            var secColumn_Rc = new List <StbSecColumn_RC>();
            var secBrace_S   = new List <StbSecBrace_S>();
            var secSteel     = new K2SSecSteelItems();

            foreach (ModelElement elem in _kModel.elems)
            {
                if (!(elem is ModelElementStraightLine))
                {
                    continue;
                }
                Karamba.Geometry.Point3 to   = _kModel.nodes[elem.node_inds[0]].pos;
                Karamba.Geometry.Point3 from = _kModel.nodes[elem.node_inds[1]].pos;
                var    elemLine = new Line(new Point3d(to.X, to.Y, to.Z), new Point3d(from.X, from.Y, from.Z));
                double pAngle   = Vector3d.VectorAngle(elemLine.Direction, Vector3d.ZAxis);
                double nAngle   = Vector3d.VectorAngle(elemLine.Direction, -Vector3d.ZAxis);

                switch (elem)
                {
                case ModelBeam modelBeam:
                    ModelBeamToStbColumnAndGirder(secBeams_Rc, secBeams_S, secColumn_Rc, secColumn_S, secSteel, colMaxAngle, columns, girders, pAngle, nAngle, modelBeam);
                    break;

                case ModelTruss modelTruss:
                    ModelTrussToStbBrace(secBrace_S, secSteel, braces, modelTruss);
                    break;

                default:
                    throw new ArgumentException("Karamba3D model parse error.");
                }
            }

            StbMembers  members  = BindMemberProps(columns, girders, braces);
            StbSections sections = BindSectionProps(secBeams_S, secBeams_Rc, secColumn_S, secColumn_Rc, secBrace_S, secSteel);

            return(new StbModel()
            {
                StbNodes = _kModel.nodes.ToStb(), StbMembers = members, StbSections = sections
            });
        }
Example #5
0
        public static List <string>[] GetIndex(ST_BRIDGE stBridge)
        {
            var        k3dIds  = new[] { new List <string>(), new List <string>(), new List <string>() };
            StbMembers members = stBridge.StbModel.StbMembers;

            if (members.StbColumns != null)
            {
                k3dIds[0].AddRange(members.StbColumns.Select(column => "Id" + column.id_section));
            }
            if (members.StbGirders != null)
            {
                k3dIds[1].AddRange(members.StbGirders.Select(girder => "Id" + girder.id_section));
            }
            if (members.StbBraces != null)
            {
                k3dIds[2].AddRange(members.StbBraces.Select(brace => "Id" + brace.id_section));
            }

            return(k3dIds);
        }
Example #6
0
        protected override void SolveInstance(IGH_DataAccess dataAccess)
        {
            var path     = string.Empty;
            var isOutput = false;
            var nodes    = new List <StbNode>();
            var axes     = new StbAxes();
            var stories  = new List <StbStory>();
            var members  = new StbMembers();
            var sections = new StbSections();

            if (!dataAccess.GetDataList(0, nodes))
            {
                return;
            }
            if (!dataAccess.GetData(1, ref axes))
            {
                return;
            }
            if (!dataAccess.GetDataList(2, stories))
            {
                return;
            }
            if (!dataAccess.GetData(3, ref members))
            {
                return;
            }
            if (!dataAccess.GetData(4, ref sections))
            {
                return;
            }
            if (!dataAccess.GetData(5, ref path))
            {
                return;
            }
            if (!dataAccess.GetData(6, ref isOutput))
            {
                return;
            }

            var stbData = new ST_BRIDGE
            {
                version   = "2.0.2",
                StbCommon = new StbCommon
                {
                    project_name = ActiveCanvasFileName(),
                    app_name     = "HoaryFox",
                },
                StbModel = new StbModel
                {
                    StbAxes     = axes,
                    StbStories  = stories.ToArray(),
                    StbNodes    = nodes.ToArray(),
                    StbMembers  = members,
                    StbSections = sections,
                    StbJoints   = new StbJoints(),
                },
                StbAnaModels = Array.Empty <StbAnaModel>(),
                StbCalData   = new StbCalData(),
            };

            if (isOutput)
            {
                bool result = Serializer.Serialize(stbData, path, STBDotNet.Enums.Version.Stb202);
                if (!result)
                {
                    throw new Exception("Failed to serialize.");
                }
            }

            dataAccess.SetData(0, stbData);
        }
Example #7
0
 public CreateLineFromStb(ST_BRIDGE stBridge)
 {
     _members = stBridge.StbModel.StbMembers;
     _nodes   = stBridge.StbModel.StbNodes;
 }