protected override void SolveInstance(IGH_DataAccess DA)
        {
            IFrameSet bs = null;

            if (!DA.GetData(0, ref bs))
            {
                return;
            }

            string          modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();
            sRhinoConverter rhcon     = new sRhinoConverter("Meters", modelUnit);

            List <sFixity> fixs = new List <sFixity>();
            //fixs.Add(bs.fixityAtStart);
            //fixs.Add(bs.fixityAtEnd);

            List <sLineLoad> lls = new List <sLineLoad>();

            if (bs.lineLoads != null && bs.lineLoads.Count > 0)
            {
                lls = rhcon.EnsureUnit(bs.lineLoads).ToList();
            }

            DA.SetData(0, bs.frameSetName);
            DA.SetData(1, rhcon.EnsureUnit(rhcon.ToRhinoCurve(bs.parentCrv)));
            DA.SetData(2, bs.crossSection);
            DA.SetDataList(3, bs.frames);
            DA.SetDataList(4, lls);
            DA.SetDataList(5, fixs);
        }
        public double GetBeamEffectiveSlabWidth(IFrameSet ifs)
        {
            sSteelFrameSet       fs = ifs as sSteelFrameSet;
            CompositeBeamSection cs = new CompositeBeamSection();
            double L = fs.parentCrv.length * 39.3701;//m to in

            return(cs.GetEffectiveSlabWidth(L, fs.effectiveSlabEdges.L_centerLeft_in, fs.effectiveSlabEdges.L_centerRight_in, fs.effectiveSlabEdges.L_edgeLeft_in, fs.effectiveSlabEdges.L_edgeRight_in));
        }
        public double GetDemand_LocalDeflection_Vertical(double adjusted_Iyy, IFrameSet fs_Live)
        {
            double def_local = fs_Live.GetFrameSetDemand(eColorMode.Deflection_Local);

            double IyyRatio = (fs_Live.crossSection.I_StrongAxis / adjusted_Iyy);

            double def_adjusted = IyyRatio * def_local;

            def_adjusted *= 0.0393701;//mm to in
            return(def_adjusted);
        }
        public double GetSumOfStudsStrength(IFrameSet fs)
        {
            double len_ft    = fs.parentCrv.length * 3.280841666667;
            int    studCount = (int)Math.Round((len_ft / 1), 0);

            // assuming,
            // Shear Stud Anchor
            // Light Weight Concrete : 4ksi
            // Deck Perpendicular
            // 1 Weak Studs per rib
            // 3/4" in diameter
            return(studCount * 17.2);
        }
        public List <sCrossSection> Design_Beams_Gravity(IFrameSet fs_Full, IFrameSet fs_Minute, IFrameSet fs_Live, List <sCrossSection> sortedShapes, int count = 3, double depthLimitMax_in = -1, double depthLimitMin_in = -1)
        {
            List <sCrossSection> selected = new List <sCrossSection>();
            int selectedCount             = 0;

            foreach (sCrossSection c in sortedShapes)
            {
                //depth check
                if (depthLimitMax_in > 0.0 && c.depth > depthLimitMax_in)
                {
                    continue;
                }
                if (depthLimitMin_in > 0.0 && c.depth < depthLimitMin_in)
                {
                    continue;
                }

                //strength check
                double momentY_adjusted = this.GetDemand_Flexural_Vertical(c, fs_Full, fs_Minute);
                //?? put minute frame???
                double momentY_capacity = this.GetFlexuralStrength_Vertical(c, eColorMode.Moment_Y, fs_Minute);
                double momentY_DCR      = (momentY_adjusted / momentY_capacity);

                //stiffness check
                //units??
                double I_LB         = this.GetLowerBoundMomentOfInertia(c, fs_Live);
                double def_adjusted = this.GetDemand_LocalDeflection_Vertical(I_LB, fs_Live);
                double def_capacity = (fs_Live.parentCrv.length / 360.0);

                sSteelFrameSet sfs_Live = fs_Live as sSteelFrameSet;
                if (sfs_Live.AsCantilever)
                {
                    def_capacity *= 2;
                }
                def_capacity *= 39.3701;//m to in
                double def_DCR = (def_adjusted / def_capacity);

                //select
                if (momentY_DCR > 0 && momentY_DCR < 0.9999 && def_DCR > 0 && def_DCR < 0.9999)
                {
                    selected.Add(c);
                    selectedCount++;
                }

                if (selectedCount == count)
                {
                    break;
                }
            }
            return(selected);
        }
        public IFrameSet GetsFrameSetByGUID(Guid gid)
        {
            IFrameSet bs = null;

            foreach (IFrameSet b in this.frameSets)
            {
                if (b.objectGUID.Equals(gid))
                {
                    bs = b;
                    break;
                }
            }
            return(bs);
        }
        public double GetDemand_Flexural_Vertical(sCrossSection c, IFrameSet fs_Full, IFrameSet fs_Minute)
        {
            //strength check
            double momentY_full = fs_Full.GetFrameSetDemand(eColorMode.Moment_Y);
            double momentY_min  = fs_Minute.GetFrameSetDemand(eColorMode.Moment_Y);
            double momentY_self = (momentY_full - momentY_min);

            double selfWeightRatio = (c.weight / fs_Full.crossSection.weight);

            double momentY_adjusted = ((momentY_self * selfWeightRatio) + momentY_min);

            momentY_adjusted *= 0.28476439306;//N.m > kip.in

            return(momentY_adjusted);
        }
 public void AwareBeamUpVectorsOnBrep(ref IFrameSet bSet, Brep guideBrep, double tol)
 {
     if (bSet.frames.Count > 0)
     {
         foreach (sFrame sb in bSet.frames)
         {
             Point3d  cp = ToRhinoPoint3d(sb.axis.PointAt(0.5));
             Vector3d nv = GetNormalVectorAtPointOnBrep(cp, guideBrep, tol);
             if (nv.Length > 0.001)
             {
                 sb.AwareLocalPlane(TosXYZ(nv));
             }
         }
     }
 }
        public double GetLowerBoundMomentOfInertia(sCrossSection cCheck, IFrameSet fs)
        {
            sKodeStructConverter kcon = new sKodeStructConverter();
            SteelMaterial        mat  = kcon.ToKodeStructMaterial_Steel(fs.crossSection);
            double I_LB   = 0;
            double b_eff  = this.GetBeamEffectiveSlabWidth(fs);
            double SumQ_n = this.GetSumOfStudsStrength(fs);
            // assuming,
            // Shear Stud Anchor
            // Light Weight Concrete : 4ksi
            // solid concrete thickness = 2.5"
            // rib thickness = 3"
            //
            double h_solid  = 2.5;
            double h_rib    = 3.0;
            double F_y      = mat.YieldStress; //?? unit ?? F_y of what??
            double fc_prime = 4.0;             //?? unit ??

            //check lowerBound Moment of Inertia by check section???
            ISection shape = kcon.ToKodeStructCrossSection(cCheck);

            if (shape is ISliceableShapeProvider)
            {
                ISliceableShapeProvider prov = shape as ISliceableShapeProvider;
                ISliceableSection       sec  = prov.GetSliceableShape();
                CompositeBeamSection    cs   = new CompositeBeamSection(sec, b_eff, h_solid, h_rib, F_y, fc_prime);
                I_LB = cs.GetLowerBoundMomentOfInertia(SumQ_n);
            }
            else
            {
                if (shape is ISliceableSection)
                {
                    ISliceableSection    sec = shape as ISliceableSection;
                    CompositeBeamSection cs  = new CompositeBeamSection(sec, b_eff, h_solid, h_rib, F_y, fc_prime);
                    I_LB = cs.GetLowerBoundMomentOfInertia(SumQ_n);
                }
                else
                {
                    throw new Exception("Shape type not supported. Please provide a shape object of standard geometry");
                }
            }



            return(I_LB);
        }
Beispiel #10
0
        public ISystem InitiateISystem(List <object> objElements)
        {
            sysType = 0;
            foreach (object so in objElements)
            {
                GH_ObjectWrapper wap = new GH_ObjectWrapper(so);
                IFrameSet        fs  = wap.Value as IFrameSet;
                if (fs is sSteelFrameSet)
                {
                    sysType = 1;
                    break;
                }
            }

            if (sysType == 1)
            {
                return(new sSteelSystem());
            }
            else
            {
                return(new sSystem());
            }
        }
Beispiel #11
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            IFrameSet sb = null;

            if (!DA.GetData(0, ref sb))
            {
                return;
            }

            string          modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();
            sRhinoConverter rhcon     = new sRhinoConverter("Meters", modelUnit);

            this.Message = "Beam Result\n" + colMode.ToString();

            sRange ran = sb.GetFrameSetResultRange(colMode);

            Curve    rc = rhcon.EnsureUnit(rhcon.ToRhinoCurve(sb.parentCrv));
            Point3d  cp = rc.PointAtNormalizedLength(0.5);
            Vector3d x  = rc.PointAtNormalizedLength(0.49) - cp;

            x.Unitize();
            Vector3d y  = Vector3d.CrossProduct(x, -Vector3d.ZAxis);
            Plane    pl = new Plane(cp, x, y);


            double max  = 0.0;
            double min  = 0.0;
            string unit = "";

            if (colMode == eColorMode.Deflection)
            {
                max = rhcon.EnsureUnit_Deflection(ran.max);
                min = rhcon.EnsureUnit_Deflection(ran.min);
                if (modelUnit == "Meters")
                {
                    unit = "mm";
                }
                else if (modelUnit == "Feet")
                {
                    unit = "in";
                }
            }
            else if (colMode.ToString().Contains("Stress"))
            {
                max = rhcon.EnsureUnit_Stress(ran.max);
                min = rhcon.EnsureUnit_Stress(ran.min);
                if (modelUnit == "Meters")
                {
                    max *= 1.0E-6;
                    min *= 1.0E-6;
                    unit = "MPa";
                }
                else if (modelUnit == "Feet")
                {
                    unit = "ksi";
                }
            }
            else if (colMode.ToString().Contains("Force"))
            {
                max = rhcon.EnsureUnit_Force(ran.max);
                min = rhcon.EnsureUnit_Force(ran.min);
                if (modelUnit == "Meters")
                {
                    unit = "N";
                }
                else if (modelUnit == "Feet")
                {
                    unit = "lbf";
                }
            }
            else if (colMode.ToString().Contains("Moment"))
            {
                max = rhcon.EnsureUnit_Moment(ran.max);
                min = rhcon.EnsureUnit_Moment(ran.min);
                if (modelUnit == "Meters")
                {
                    unit = "N.m";
                }
                else if (modelUnit == "Feet")
                {
                    unit = "lbf.ft";
                }
            }

            DA.SetData(0, pl);
            DA.SetData(1, "(" + Math.Round(min, 2) + ") - (" + Math.Round(max, 2) + ") " + unit);
            DA.SetData(2, max);
            DA.SetData(3, min);
        }
Beispiel #12
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <IFrameSet> beamsets  = new List <IFrameSet>();
            List <Vector3d>  upvectors = new List <Vector3d>();

            if (!DA.GetDataList(0, beamsets))
            {
                return;
            }
            if (!DA.GetDataList(1, upvectors))
            {
                return;
            }

            string          modelUnit          = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();
            sRhinoConverter rhcon              = new sRhinoConverter(modelUnit, "Meters");
            sRhinoConverter rhcon_ToRhinoModel = new sRhinoConverter("Meters", modelUnit);

            List <IFrameSet> duplicated = new List <IFrameSet>();
            List <Point3d>   pts        = new List <Point3d>();
            List <Vector3d>  vecs       = new List <Vector3d>();

            this.Message = "";
            int nonSegCount = 0;

            if (upvectors.Count == beamsets.Count)
            {
                for (int i = 0; i < beamsets.Count; ++i)
                {
                    if (beamsets[i].frames.Count > 0)
                    {
                        sXYZ      upvecThis = rhcon.TosXYZ(upvectors[i]);
                        IFrameSet dubs      = beamsets[i].DuplicatesFrameSet();
                        dubs.EnsureBeamElement();

                        foreach (sFrame sb in dubs.frames)
                        {
                            sb.AwareLocalPlane(upvecThis);

                            pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.5))));
                            vecs.Add(rhcon.ToRhinoVector3d(sb.upVector));
                        }
                        duplicated.Add(dubs);
                    }
                    else
                    {
                        nonSegCount++;
                    }
                }
            }
            else if (upvectors.Count == 1)
            {
                foreach (IFrameSet bs in beamsets)
                {
                    if (bs.frames.Count > 0)
                    {
                        IFrameSet dubs = bs.DuplicatesFrameSet();
                        dubs.EnsureBeamElement();

                        foreach (sFrame sb in dubs.frames)
                        {
                            sb.AwareLocalPlane(rhcon.TosXYZ(upvectors[0]));

                            pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.5))));
                            vecs.Add(rhcon.ToRhinoVector3d(sb.upVector));
                        }
                        duplicated.Add(dubs);
                    }
                    else
                    {
                        nonSegCount++;
                    }
                }
            }
            else
            {
                this.Message = "";
                return;
            }

            if (nonSegCount == 0)
            {
                DA.SetDataList(0, duplicated);
                DA.SetDataList(1, pts);
                DA.SetDataList(2, vecs);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Segmentize Beam Set First To Assign Upvectors");
                //this.Message = "Segmentize Beam Set First To Assign Upvectors";
            }
        }
Beispiel #13
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <object> seles  = new List <object>();
            double        intTol = 0.005;
            double        segTol = 0.5;

            if (!DA.GetDataList(0, seles))
            {
                return;
            }
            if (!DA.GetData(1, ref intTol))
            {
                return;
            }
            if (!DA.GetData(2, ref segTol))
            {
                return;
            }

            string          modelUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();
            sRhinoConverter rhcon     = new sRhinoConverter(modelUnit, "Meters");

            if (modelUnit == "Feet")
            {
                intTol = 0.015;
                segTol = 1.5;
            }

            List <object>    pelements    = new List <object>();
            List <IFrameSet> beamelements = new List <IFrameSet>();

            foreach (object o in seles)
            {
                GH_ObjectWrapper wap   = new GH_ObjectWrapper(o);
                IFrameSet        bsori = wap.Value as IFrameSet;
                if (bsori != null)
                {
                    beamelements.Add(bsori.DuplicatesFrameSet());
                }
                sPointLoad pl = wap.Value as sPointLoad;
                if (pl != null)
                {
                    pelements.Add(pl);
                }
                sPointSupport ps = wap.Value as sPointSupport;
                if (ps != null)
                {
                    pelements.Add(ps);
                }
            }

            rhcon.SplitSegmentizesBeamSet(ref beamelements, intTol, segTol, pelements);

            /*
             * string groupInfo = "";
             * DataTree<sBeamSet> beamTree = new DataTree<sBeamSet>();
             * var grouped = beamelements.GroupBy(b => b.beamSetName);
             * int groupID = 0;
             * foreach (var bgroup in grouped)
             * {
             *  GH_Path bpth = new GH_Path(groupID);
             *  groupInfo += "BeamSet" + groupID + ": " + bgroup.ElementAt(0).beamSetName + "\n";
             *  foreach (sBeamSet sb in bgroup)
             *  {
             *      beamTree.Add(sb, bpth);
             *  }
             *  groupID++;
             * }
             *
             * this.Message = groupInfo;
             */

            DA.SetDataList(0, beamelements);
            DA.SetDataList(1, pelements);
        }
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <object> sBeamObjs = new List <object>();
            Brep          b         = null;
            double        tol       = 0.05;

            if (!DA.GetDataList(0, sBeamObjs))
            {
                return;
            }
            if (!DA.GetData(1, ref b))
            {
                return;
            }
            if (!DA.GetData(2, ref tol))
            {
                return;
            }

            string          modelUnit          = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();
            sRhinoConverter rhcon              = new sRhinoConverter(modelUnit, "Meters");
            sRhinoConverter rhcon_ToRhinoModel = new sRhinoConverter("Meters", modelUnit);

            Brep scaleB = rhcon.EnsureUnit(b);

            List <Point3d>  pts  = new List <Point3d>();
            List <Vector3d> vecs = new List <Vector3d>();

            List <object> duplicated          = new List <object>();
            int           nonSegmentizedCount = 0;

            this.Message = "";
            foreach (object ob in sBeamObjs)
            {
                GH_ObjectWrapper wap = new GH_ObjectWrapper(ob);
                IFrameSet        bs  = wap.Value as IFrameSet;
                if (bs != null)
                {
                    IFrameSet dubs = bs.DuplicatesFrameSet();
                    if (dubs.frames.Count > 0)
                    {
                        dubs.EnsureBeamElement();
                        rhcon.AwareBeamUpVectorsOnBrep(ref dubs, scaleB, tol);
                        foreach (sFrame ssb in dubs.frames)
                        {
                            pts.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(ssb.axis.PointAt(0.5))));
                            vecs.Add(rhcon.ToRhinoVector3d(ssb.upVector));
                        }
                        duplicated.Add(dubs);
                    }
                    else
                    {
                        nonSegmentizedCount++;
                    }
                }

                /*
                 * sBeam sb = wap.Value as sBeam;
                 * if(sb != null)
                 * {
                 *  sBeam dusb = sb.DuplicatesBeam();
                 *  Vector3d nv = rhcon.GetNormalVectorAtPointOnBrep(rhcon.ToRhinoPoint3d(dusb.axis.PointAt(0.5)), scaleB, tol);
                 *  dusb.AwareLocalPlane(rhcon.TosXYZ(nv));
                 *  duplicated.Add(dusb);
                 * }
                 */
            }

            if (nonSegmentizedCount == 0)
            {
                DA.SetDataList(0, duplicated);
                DA.SetDataList(1, pts);
                DA.SetDataList(2, vecs);
            }
            else
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Segmentize Beam Set First To Assign Upvectors");
                //this.Message = "Segmentize Beam Set First To Assign Upvectors";
            }
        }
 public void AddsBeamSet(IFrameSet bset)
 {
     bset.EnsureBeamElement();
     this.frameSets.Add(bset);
 }
        public double GetFlexuralStrength_Vertical(sCrossSection section, eColorMode forceType, IFrameSet fs)
        {
            sKodeStructConverter kcon = new sKodeStructConverter();
            SteelMaterial        mat  = kcon.ToKodeStructMaterial_Steel(section);

            string Code   = "AISC360-10";
            double phiM_n = 0;

            double b_eff  = this.GetBeamEffectiveSlabWidth(fs);
            double SumQ_n = this.GetSumOfStudsStrength(fs);
            // assuming,
            // Shear Stud Anchor
            // Light Weight Concrete : 4ksi
            // solid concrete thickness = 2.5"
            // rib thickness = 3"
            //
            double h_solid  = 2.5;
            double h_rib    = 3.0;
            double F_y      = mat.YieldStress; //?? unit ?? F_y of what??
            double fc_prime = 4.0;             //?? unit ??

            MomentAxis Axis = kcon.ToKodeStructMomentAxis(forceType);

            //?? just this for composite?
            ISection shape = kcon.ToKodeStructCrossSection(section);

            if (shape is ISliceableShapeProvider)
            {
                ISliceableShapeProvider prov = shape as ISliceableShapeProvider;
                ISliceableSection       sec  = prov.GetSliceableShape();
                CompositeBeamSection    cs   = new CompositeBeamSection(sec, b_eff, h_solid, h_rib, F_y, fc_prime);
                phiM_n = cs.GetFlexuralStrength(SumQ_n);
            }
            else
            {
                if (shape is ISliceableSection)
                {
                    ISliceableSection    sec = shape as ISliceableSection;
                    CompositeBeamSection cs  = new CompositeBeamSection(sec, b_eff, h_solid, h_rib, F_y, fc_prime);
                    phiM_n = cs.GetFlexuralStrength(SumQ_n);
                }
                else
                {
                    throw new Exception("Shape type not supported. Please provide a shape object of standard geometry");
                }
            }
            return(phiM_n);
        }
Beispiel #17
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List <IFrameSet> bsets = new List <IFrameSet>();
            double           tol   = 0.005;

            if (!DA.GetDataList(0, bsets))
            {
                return;
            }
            if (!DA.GetData(1, ref tol))
            {
                return;
            }

            sFixity fxS = null;
            sFixity fxE = null;

            if (fixType == eFixityType.MOMENTREALESED_START)
            {
                fxS         = new sFixity();
                fxS.release = new bool[6] {
                    true, true, true, false, false, false
                };
            }
            else if (fixType == eFixityType.MOMENTREALESED_END)
            {
                fxE         = new sFixity();
                fxE.release = new bool[6] {
                    true, true, true, false, false, false
                };
            }
            else if (fixType == eFixityType.MOMENTREALESED_BOTH)
            {
                fxS         = new sFixity();
                fxS.release = new bool[6] {
                    true, true, true, false, false, false
                };
                fxE         = new sFixity();
                fxE.release = new bool[6] {
                    true, true, true, true, false, false
                };
            }
            else if (fixType == eFixityType.FIXITIES_BY_DOF)
            {
                List <bool> sss = new List <bool>();
                List <bool> eee = new List <bool>();

                if (!DA.GetDataList(2, sss))
                {
                    return;
                }
                if (!DA.GetDataList(3, eee))
                {
                    return;
                }


                bool[] fixedSet = new bool[6] {
                    true, true, true, true, true, true
                };
                if (sss.Count != 6)
                {
                    sss = fixedSet.ToList();
                }
                if (eee.Count != 6)
                {
                    eee = fixedSet.ToList();
                }

                fxS         = new sFixity();
                fxS.release = sss.ToArray();
                fxE         = new sFixity();
                fxE.release = eee.ToArray();
            }
            else if (fixType == eFixityType.FULLY_FIXED)
            {
                fxS = null;
                fxE = null;
            }

            string          modelUnit          = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();
            sRhinoConverter rhcon              = new sRhinoConverter(modelUnit, "Meters");
            sRhinoConverter rhcon_ToRhinoModel = new sRhinoConverter("Meters", modelUnit);

            if (modelUnit == "Feet")
            {
                tol = 0.015;
            }

            List <IFrameSet> duplicated = new List <IFrameSet>();
            List <Point3d>   locsStart  = new List <Point3d>();
            List <Point3d>   locsEnd    = new List <Point3d>();

            foreach (IFrameSet bso in bsets)
            {
                IFrameSet bs = bso.DuplicatesFrameSet();

                bs.ResetFixities();

                if (bs.parentSegments.Count > 0)
                {
                    if (fxS != null)
                    {
                        bs.segmentFixitiesAtStart = new List <sFixity>();
                    }
                    if (fxE != null)
                    {
                        bs.segmentFixitiesAtEnd = new List <sFixity>();
                    }

                    foreach (sCurve segc in bs.parentSegments)
                    {
                        Curve segrc = rhcon.ToRhinoCurve(segc);
                        if (fxS != null)
                        {
                            fxS.location = rhcon.TosXYZ(segrc.PointAtStart);
                            if (fxS.IsOnLocation(bs.associatedLocations, tol) == false)
                            {
                                bs.segmentFixitiesAtStart.Add(fxS.DuplicatesFixity());
                            }
                        }
                        if (fxE != null)
                        {
                            fxE.location = rhcon.TosXYZ(segrc.PointAtEnd);
                            if (fxE.IsOnLocation(bs.associatedLocations, tol) == false)
                            {
                                bs.segmentFixitiesAtEnd.Add(fxE.DuplicatesFixity());
                            }
                        }
                    }
                    bs.AwareElementFixitiesBySegementFixities(tol);
                }
                else
                {
                    Curve rc = rhcon.ToRhinoCurve(bs.parentCrv);
                    if (fxS != null && bs.parentFixityAtStart == null)
                    {
                        fxS.location = rhcon.TosXYZ(rc.PointAtStart);
                        if (fxS.IsOnLocation(bs.associatedLocations, tol) == false)
                        {
                            bs.parentFixityAtStart = fxS.DuplicatesFixity();
                        }
                    }
                    if (fxE != null && bs.parentFixityAtEnd == null)
                    {
                        fxE.location = rhcon.TosXYZ(rc.PointAtEnd);
                        if (fxE.IsOnLocation(bs.associatedLocations, tol) == false)
                        {
                            bs.parentFixityAtEnd = fxE.DuplicatesFixity();
                        }
                    }
                    bs.AwareElementsFixitiesByParentFixity(tol);
                }

                duplicated.Add(bs);
            }

            foreach (IFrameSet bs in duplicated)
            {
                if (bs.frames.Count == 0)
                {
                    Curve rc = rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoCurve(bs.parentCrv));
                    if (bs.parentFixityAtStart != null)
                    {
                        locsStart.Add(rc.PointAtNormalizedLength(0.025));
                    }
                    if (bs.parentFixityAtEnd != null)
                    {
                        locsEnd.Add(rc.PointAtNormalizedLength(0.975));
                    }
                }
                else
                {
                    foreach (sFrame sb in bs.frames)
                    {
                        if (sb.fixityAtStart != null)
                        {
                            locsStart.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.1))));
                        }
                        if (sb.fixityAtEnd != null)
                        {
                            locsEnd.Add(rhcon_ToRhinoModel.EnsureUnit(rhcon.ToRhinoPoint3d(sb.axis.PointAt(0.9))));
                        }
                    }
                }
            }


            this.Message = fixType.ToString();

            DA.SetDataList(0, duplicated);
            DA.SetDataList(1, locsStart);
            DA.SetDataList(2, locsEnd);
        }
Beispiel #18
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            sSystemSetting sysSetting = null;
            List <object>  sElement   = new List <object>();

            DA.GetData(0, ref sysSetting);
            if (!DA.GetDataList(1, sElement))
            {
                return;
            }


            sRhinoConverter rhcon       = new sRhinoConverter();
            string          currentUnit = Rhino.RhinoDoc.ActiveDoc.ModelUnitSystem.ToString();

            if (sysSetting == null)
            {
                sysSetting = new sSystemSetting();
                sysSetting.systemOriUnit = currentUnit;

                sysSetting.systemName       = "DefaultSetting";
                sysSetting.currentCase      = "DEAD";
                sysSetting.currentCheckType = eSystemCheckType.StrengthCheck;

                sysSetting.currentStressThreshold_pascal = 25 * 6894757.28;
                sysSetting.currentDeflectionThreshold_mm = 100;

                sysSetting.mergeTolerance_m = 0.005;
                sysSetting.meshDensity_m    = 0.5;
            }

            if (currentUnit == "Meters" || currentUnit == "Feet")
            {
                ISystem jsys = InitiateISystem(sElement);

                jsys.systemSettings = sysSetting;
                List <IsObject> sObjs = new List <IsObject>();

                jsys.loadPatterns.Add("DEAD");

                int supCount = 0;
                int nodeID   = 0;

                try
                {
                    foreach (object so in sElement)
                    {
                        GH_ObjectWrapper wap = new GH_ObjectWrapper(so);

                        IFrameSet bs = wap.Value as IFrameSet;
                        if (bs != null)
                        {
                            //jsys.beamSets.Add(bs);
                            jsys.AddsBeamSet(bs);
                            //??
                            sObjs.Add(bs);
                            if (bs.lineLoads != null)
                            {
                                foreach (sLineLoad ll in bs.lineLoads)
                                {
                                    jsys.AwarePatternNames(ll.loadPatternName);
                                }
                            }
                        }

                        sPointLoad pl = wap.Value as sPointLoad;
                        if (pl != null)
                        {
                            if (jsys.UpdateNodeFromPointElement(pl, nodeID))
                            {
                                nodeID++;
                                jsys.AwarePatternNames(pl.loadPatternName);
                            }
                        }

                        sLoadCombination com = wap.Value as sLoadCombination;
                        if (com != null)
                        {
                            jsys.SetLoadCombination(com);
                        }
                    }

                    foreach (object so in sElement)
                    {
                        GH_ObjectWrapper wap  = new GH_ObjectWrapper(so);
                        sPointSupport    psup = wap.Value as sPointSupport;
                        if (psup != null)
                        {
                            if (jsys.UpdateNodeFromPointElement(psup, nodeID))
                            {
                                nodeID++;
                            }
                            supCount++;
                        }
                    }

                    foreach (sMesh am in jsys.meshes)
                    {
                        //  sObjs.Add(am);
                    }

                    if (supCount > 0)
                    {
                        this.Message = "System : " + sysSetting.systemName + "\nis instantiated";
                        jsys.systemSettings.systemBoundingBox = rhcon.TosBoundingBox(sObjs);

                        //jsys.SystemName = sysSetting.systemName;
                        DA.SetData(0, jsys);
                    }
                    else
                    {
                        this.Message = "System : " + sysSetting.systemName + "\nneeds supports";
                        //jsys.SystemName = sysSetting.systemName;
                        this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, this.Message);
                        DA.SetData(0, null);
                    }
                }
                catch (Exception e)
                {
                    this.Message = "System : " + sysSetting.systemName + "\ninstantiation failed";
                    this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.Message);
                    DA.SetData(0, null);
                }
            }
            else
            {
                this.Message = "ASKSGH.Bridgify only works in\n Meters or Feet";
                this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, this.Message);
                DA.SetData(0, null);
            }
        }