Beispiel #1
0
        public static Opening Opening(Cartesian coordinateSystem, double diameter, double depth)
        {
            CircleProfile profile = BH.Engine.Spatial.Create.CircleProfile(diameter);

            return(new Opening {
                CoordinateSystem = coordinateSystem, Profile = profile, Depth = depth
            });
        }
Beispiel #2
0
        public static string Description(this CircleProfile profile)
        {
            if (profile == null)
            {
                return("null profile");
            }

            return($"Circle {profile.Diameter:G3}");
        }
Beispiel #3
0
        static void MultiBeamCreator(Part part)
        {
            try
            {
                //Document doc = Document.GetDocument(Settings.Default.ProjectPath + "/" + Settings.Default.ProjectName + ".scdoc");
                Document doc = Window.ActiveWindow.Document;
                Part     p   = doc.MainPart;

                int id = 0;
                List <PointLocation> pointLocations = CsvDataRead.ReadData();  // Get all beams out of file

                foreach (var location in pointLocations)
                {
                    Point startPoint = Point.Create(Double.Parse("" + (location.xPoint / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.yPoint / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.zPoint / 1000), new CultureInfo("de-DE")));
                    Point endPoint   = Point.Create(Double.Parse("" + (location.x2Point / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.y2Point / 1000), new CultureInfo("de-DE")), Double.Parse("" + (location.z2Point / 1000), new CultureInfo("de-DE")));
                    if (location.diameter != 0)
                    {
                        try
                        {
                            double diameter = location.diameter;
                            double radi     = Double.Parse("" + (location.diameter / 2000), new CultureInfo("de-DE"));

                            var lineSegment = CurveSegment.Create(startPoint, endPoint);
                            var designLine  = DesignCurve.Create(p, lineSegment);

                            Vector heightVector = endPoint - startPoint;
                            Frame  frame        = Frame.Create(startPoint, heightVector.Direction);
                            Plane  plane        = Plane.Create(frame);
                            var    profi        = new CircleProfile(plane, radi);

                            //var doc = DocumentHelper.GetActiveDocument();
                            //Document doc = Document.GetDocument(Path.GetDirectoryName("Document1"));
                            //Document doc = window.ActiveContext.Context.Document;


                            Part beamProfile = Part.CreateBeamProfile(doc, "Beam" + id, profi);

                            Beam.Create(beamProfile, designLine);
                            id += 1;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString(), "Info");
                        }
                    }
                }
            }
            catch (Exception exe)
            {
                MessageBox.Show(exe.ToString(), "Info");
            }
        }
Beispiel #4
0
        public ActionResult UpdateProfile(CircleProfile jsonData)
        {
            int    result = default(int);
            string msg    = string.Empty;

            try
            {
                jsonData.Opmode = 1;

                result = DBOperations <CircleProfile> .DMLOperation(jsonData, Constant.usp_CircleProfile);

                var objLogin = DBOperations <Login> .GetSpecific(new Login()
                {
                    Opmode = 2, UserId = GlobalSettings.oUserMaster.UserId
                }, Constant.usp_Login);

                GlobalSettings.oUserMaster.UserId   = objLogin.UserId;
                GlobalSettings.oUserMaster.UserName = objLogin.UserName;
                GlobalSettings.oUserMaster.FullName = objLogin.FullName;
                GlobalSettings.oUserMaster.UserRole = objLogin.UserRole;
                GlobalSettings.oUserMaster.RefId    = objLogin.RefId;
                GlobalSettings.oUserMaster.MobileNo = objLogin.MobileNo;
                GlobalSettings.oUserMaster.EmailId  = objLogin.EmailId;
                GlobalSettings.oUserMaster.Active   = objLogin.Active;

                string EmailMsg = string.Empty;
                string SMSMsg   = string.Empty;
                EmailMsg  = "Your profile has been updated successfully.<br><br>";
                EmailMsg += "Mobile No.- " + objLogin.MobileNo;
                EmailMsg += "<br><br>Regards<br><br>WBTBCL";
                Utility.SendHtmlFormattedEmail(objLogin.EmailId.Trim(), "User Profile Update", EmailMsg, false, "");

                SMSMsg = "Your profile has been updated successfully. Email Id - " + objLogin.EmailId.Trim();
                Utility.SendSMS(objLogin.MobileNo.Trim(), SMSMsg);

                if (result > 0)
                {
                    msg = "Profile updated successfully";
                }
                else
                {
                    msg = "Data saving failed";
                }

                return(Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { Success = 0, Message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #5
0
        /***************************************************/

        private bool CreateProfile(string name, CircleProfile profile)
        {
            List <double> dimensionList = new List <double> {
                profile.Diameter
            };

            double[] dimensionArray = dimensionList.ToArray();

            //List<string> valueList = new List<string> { "D" };

            int lusasType = 3;

            CreateLibrarySection(name, dimensionArray, lusasType);

            return(true);
        }
 public static double WarpingConstant(this CircleProfile profile)
 {
     return(0);
 }
Beispiel #7
0
        /***************************************************/
        private static void TestSerialization()
        {
            // Trigger the initialisation (need a better way)
            BH.Engine.Serialiser.Convert.FromJson("{}");

            object input = new CustomObject()
            {
                CustomData = new Dictionary <string, object>
                {
                    { "X", 1 },
                    { "Y", 2 },
                    { "Z", new CustomObject
                      {
                          CustomData = new Dictionary <string, object> {
                              { "A", 3 }
                          }
                      } },
                    { "ListStrings", new List <string> {
                          "1", "2", "3"
                      } },
                    { "ListPoints", new List <Point> {
                          new Point(), new Point {
                              X = 1
                          }
                      } },
                    { "DictString", new Dictionary <string, string> {
                          { "A", "1" }, { "B", "2" }
                      } },
                    { "ListEnums", new List <Frequency> {
                          Frequency.Hz125, Frequency.Hz250
                      } },
                    //{ "DictEnum", new Dictionary<Frequency, string> { { Frequency.Hz250, "1" }, { Frequency.Hz125, "2" } } }
                },
                Tags = new HashSet <string> {
                    "A", "B"
                }
            };

            var jsonWriterSettings = new JsonWriterSettings {
                OutputMode = JsonOutputMode.Strict
            };
            BsonDocument doc  = input.ToBsonDocument();
            string       json = doc.ToJson <BsonDocument>(jsonWriterSettings);
            object       obj  = BsonSerializer.Deserialize(doc, typeof(object));

            Node node = (Node) new Point {
                X = 1, Y = 2, Z = 3
            };

            node.Name = "testNode";
            BsonDocument doc2 = node.ToBsonDocument();

            doc2["NewData"] = "ExtraStuff";
            string json2 = doc2.ToJson <BsonDocument>(jsonWriterSettings);
            object obj2  = BsonSerializer.Deserialize(doc2, typeof(object));

            CircleProfile circleDim = BH.Engine.Geometry.Create.CircleProfile(43.2);

            circleDim.Name = "Dim";
            BsonDocument doc3  = circleDim.ToBsonDocument();
            string       json3 = doc3.ToJson <BsonDocument>(jsonWriterSettings);
            object       obj3  = BsonSerializer.Deserialize(doc3, typeof(object));

            SteelSection section = new SteelSection(

                BH.Engine.Geometry.Create.CircleProfile(4.2),
                2.1, 1.3, .5, 2, 3, 4, 5, 6, 7, 88, 9, 0, 4, 5, 6, 7, 7, 8, 9
                );
            BsonDocument doc4  = section.ToBsonDocument();
            string       json4 = doc4.ToJson <BsonDocument>(jsonWriterSettings);
            object       obj4  = BsonSerializer.Deserialize(doc4, typeof(object));
        }
Beispiel #8
0
        /***************************************************/

        private bool SetProfile(CircleProfile bhomProfile, string sectionName, string matName)
        {
            int ret = m_model.PropFrame.SetCircle(sectionName, matName, bhomProfile.Diameter);

            return(ret == 0);
        }
 private static void SetSpecificDimensions(CircleProfile dimensions, string sectionName, IMaterialFragment material, cSapModel model)
 {
     model.PropFrame.SetCircle(sectionName, material.Name, dimensions.Diameter);
 }
Beispiel #10
0
 private (double[], int, string) GetProfileDimensions(CircleProfile profile)
 {
     return(new double[] { profile.Diameter, 0, 0, 0, 0, 0 }, St7.bsCircularSolid, profile.Name);
 }
Beispiel #11
0
        /***************************************************/

        private bool SetProfile(CircleProfile profile, string sectionName, IMaterialFragment material)
        {
            return(m_model.PropFrame.SetCircle(sectionName, material?.DescriptionOrName() ?? "", profile.Diameter) == 0);
        }
Beispiel #12
0
 public static string Description(this CircleProfile profile)
 {
     return($"Circle {profile.Diameter:G3}");
 }
Beispiel #13
0
        public static CompositeGeometry Layout(this PerimeterReinforcement reinforcement, CircleProfile dimensions, ConcreteSection property)
        {
            double       d        = dimensions.Diameter;
            List <Point> location = new List <Point>();

            double angle      = Math.PI * 2 / reinforcement.BarCount;
            double startAngle = 0;
            double radius     = d / 2 - property.MinimumCover - reinforcement.Diameter / 2;

            switch (reinforcement.Pattern)
            {
            case ReinforcementPattern.Horizontal:
                startAngle = angle / 2;
                break;
            }
            for (int i = 0; i < reinforcement.BarCount; i++)
            {
                double x = Math.Cos(startAngle + angle * i) * radius;
                double y = Math.Sin(startAngle + angle * i) * radius;
                location.Add(new Point {
                    X = x, Y = y, Z = 0
                });
            }


            return(new CompositeGeometry {
                Elements = location.ToList <IGeometry>()
            });
        }
Beispiel #14
0
 public static double WarpingConstant(this CircleProfile profile)
 {
     return(profile.IsNull() ? 0 : 0);
 }
Beispiel #15
0
        /***************************************************/

        public static double TorsionalConstant(this CircleProfile profile)
        {
            return(Math.PI * Math.Pow(profile.Diameter, 4) / 32);
        }
Beispiel #16
0
        /***************************************************/

        public static string Description(this CircleProfile profile)
        {
            return("Circle " + profile.Diameter);
        }
Beispiel #17
0
        /***************************************************/

        public static CircleProfile InterpolateProfile(CircleProfile startProfile, CircleProfile endProfile, double parameter, int interpolationOrder,
                                                       double domainStart = 0, double domainEnd = 1)
        {
            return(Create.CircleProfile(Interpolate(startProfile.Diameter, endProfile.Diameter, parameter, interpolationOrder, domainStart, domainEnd)));
        }