Exemplo n.º 1
0
        public static Dictionary<string, object> ColumnStabilityFactor(double d_comp,double F_c,double E_min,double l_e,double C_M_Fc,double C_M_E,double C_F_Fc,double lambda,
            double C_t_Fc = 1, double C_t_E = 1, double C_i_Fc = 1, double C_i_E = 1, double C_T = 1, string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values
            double C_P = 0;


            //Calculation logic:
            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                DimensionalLumber m = new DimensionalLumber();
                C_P = m.GetColumnStabilityFactor(d_comp, F_c, E_min, l_e, C_M_Fc, C_M_E, C_t_Fc,C_t_E, C_F_Fc, C_i_Fc, C_i_E, C_T, lambda);
            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber t = new Timber();
                C_P = t.GetColumnStabilityFactor(d_comp, F_c, E_min, l_e, C_M_Fc, C_M_E, C_t_Fc,C_t_E, C_F_Fc, C_i_Fc, C_i_E, C_T, lambda);
            }
            else
	        {
                throw new Exception("Wood member type not supported.");
	        }

            return new Dictionary<string, object>
            {
                { "C_P", C_P }
 
            };
        }
Exemplo n.º 2
0
        public static Dictionary <string, object> ColumnStabilityFactor(double d_comp, double F_c, double E_min, double l_e, double C_M_Fc, double C_M_E, double C_F_Fc, double lambda,
                                                                        double C_t_Fc = 1, double C_t_E = 1, double C_i_Fc = 1, double C_i_E = 1, double C_T = 1, string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values
            double C_P = 0;


            //Calculation logic:
            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                DimensionalLumber m = new DimensionalLumber();
                C_P = m.GetColumnStabilityFactor(d_comp, F_c, E_min, l_e, C_M_Fc, C_M_E, C_t_Fc, C_t_E, C_F_Fc, C_i_Fc, C_i_E, C_T, lambda);
            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber t = new Timber();
                C_P = t.GetColumnStabilityFactor(d_comp, F_c, E_min, l_e, C_M_Fc, C_M_E, C_t_Fc, C_t_E, C_F_Fc, C_i_Fc, C_i_E, C_T, lambda);
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return(new Dictionary <string, object>
            {
                { "C_P", C_P }
            });
        }
            public void OnResponse(ICall p0, Response p1)
            {
                Timber.D("Url: %s", p0.Request().Url().ToString());
                var body = p1.Body() as DirectionsResponse;

                successAction.Invoke(body);
            }
Exemplo n.º 4
0
        private void OnGreetingClicked(object sender, EventArgs e)
        {
            var button = sender as Button;

            Timber.I($"A button with ID {button.Id} was clicked to say '{button.Text}'.");

            Toast.MakeText(this, "Check logcat for a greeting!", ToastLength.Short).Show();
        }
Exemplo n.º 5
0
        public static string Description(this Timber material)
        {
            if (material == null)
            {
                return("null material");
            }

            return("Timber " + material.MaterialAnalyticalValues());
        }
Exemplo n.º 6
0
        /***************************************************/

        public static void CopyCharacteristics(this IMaterialFragment toMaterial, StructuralAsset fromAsset)
        {
            double density = fromAsset.Density.ToSI(UnitType.UT_MassDensity);

#if (REVIT2020 || REVIT2021)
#else
            double dampingRatio = fromAsset.DampingRatio;
#endif

            oM.Geometry.Vector youngsModulus         = BH.Engine.Geometry.Create.Vector(fromAsset.YoungModulus.X.ToSI(UnitType.UT_Stress), fromAsset.YoungModulus.Y.ToSI(UnitType.UT_Stress), fromAsset.YoungModulus.Z.ToSI(UnitType.UT_Stress));
            oM.Geometry.Vector thermalExpansionCoeff = BH.Engine.Geometry.Create.Vector(fromAsset.ThermalExpansionCoefficient.X.ToSI(UnitType.UT_ThermalExpansion), fromAsset.ThermalExpansionCoefficient.Y.ToSI(UnitType.UT_ThermalExpansion), fromAsset.ThermalExpansionCoefficient.Z.ToSI(UnitType.UT_ThermalExpansion));
            oM.Geometry.Vector poissonsRatio         = BH.Engine.Geometry.Create.Vector(fromAsset.PoissonRatio.X, fromAsset.PoissonRatio.Y, fromAsset.PoissonRatio.Z);
            oM.Geometry.Vector shearModulus          = BH.Engine.Geometry.Create.Vector(fromAsset.ShearModulus.X.ToSI(UnitType.UT_Stress), fromAsset.ShearModulus.Y.ToSI(UnitType.UT_Stress), fromAsset.ShearModulus.Z.ToSI(UnitType.UT_Stress));

            toMaterial.Density = density;
#if (REVIT2020 || REVIT2021)
#else
            toMaterial.DampingRatio = dampingRatio;
#endif

            if (toMaterial is Aluminium)
            {
                Aluminium material = toMaterial as Aluminium;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
            else if (toMaterial is Concrete)
            {
                Concrete material = toMaterial as Concrete;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
            else if (toMaterial is Steel)
            {
                Steel material = toMaterial as Steel;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
            else if (toMaterial is Timber)
            {
                Timber material = toMaterial as Timber;
                material.YoungsModulus         = youngsModulus;
                material.ThermalExpansionCoeff = thermalExpansionCoeff;
                material.PoissonsRatio         = poissonsRatio;
            }
            else if (toMaterial is GenericIsotropicMaterial)
            {
                GenericIsotropicMaterial material = toMaterial as GenericIsotropicMaterial;
                material.YoungsModulus         = youngsModulus.X;
                material.ThermalExpansionCoeff = thermalExpansionCoeff.X;
                material.PoissonsRatio         = poissonsRatio.X;
            }
        }
 public void OnProgressChange(Location p0, RouteProgress p1)
 {
     mapboxMap.LocationComponent.ForceLocationUpdate(p0);
     if (!isRefreshing)
     {
         isRefreshing = true;
         routeRefresh.Refresh(p1);
     }
     Timber.D("onProgressChange: fraction of route traveled: %f", p1.FractionTraveled());
 }
Exemplo n.º 8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);
            Geneticist.Splice(this);

            Timber.Tag("LifeCycles");
            Timber.D("Activity Created");
        }
Exemplo n.º 9
0
        public override void OnCreate()
        {
            base.OnCreate();

#if DEBUG
            Timber.Plant(new Timber.DebugTree());
#else
            Timber.Plant(new CrashReportingTree());
#endif
        }
        public static Dictionary <string, object> SizeFactor(double d, double t, string WoodCommercialGrade, bool LoadAppliedToNarrowFace = false,
                                                             string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values

            double C_F_Fb = 1.0;
            double C_F_Fc = 1.0;
            double C_F_Ft = 1.0;

            //Calculation logic:



            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                DimensionalLumber m = new DimensionalLumber();

                string memberType = WoodMemberType.TrimStart("Sawn".ToCharArray());

                SawnLumberType sawnLumberType;
                bool           IsValidSawnLumberTypeString = Enum.TryParse(memberType, true, out sawnLumberType);
                if (IsValidSawnLumberTypeString == false)
                {
                    throw new Exception("Failed to convert string. Sawn lumber type is incorrectly specified. Please check input");
                }


                ww.CommercialGrade _commercialGrade;
                bool IsValidCommercialGradeString = Enum.TryParse(WoodCommercialGrade, true, out _commercialGrade);
                if (IsValidCommercialGradeString == false)
                {
                    throw new Exception("Failed to convert string. Wood commercial grade is incorrectly specified. Please check input");
                }


                C_F_Fb = m.GetSizeFactor(d, t, sawnLumberType, _commercialGrade, ww.ReferenceDesignValueType.Bending, LoadAppliedToNarrowFace);
                C_F_Ft = m.GetSizeFactor(d, t, sawnLumberType, _commercialGrade, ww.ReferenceDesignValueType.TensionParallelToGrain, LoadAppliedToNarrowFace);
                C_F_Fc = m.GetSizeFactor(d, t, sawnLumberType, _commercialGrade, ww.ReferenceDesignValueType.CompresionParallelToGrain, LoadAppliedToNarrowFace);
            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber timber = new Timber();
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return(new Dictionary <string, object>
            {
                { "C_F_Fb", C_F_Fb },
                { "C_F_Fc", C_F_Fc },
                { "C_F_Ft", C_F_Ft },
            });
        }
 public void OnRunning(bool p0)
 {
     if (p0)
     {
         Timber.D("onRunning: Started");
     }
     else
     {
         Timber.D("onRunning: Stopped");
     }
 }
        public static Dictionary <string, object> TemperatureFactor(double Temperature, string ServiceMoistureCondition = "Dry",
                                                                    string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values
            double C_t_Fb = 1.0;
            double C_t_Ft = 1.0;
            double C_t_Fv = 1.0;
            double C_t_Fc = 1.0;
            double C_t_E  = 1.0;

            //Calculation logic:


            ww.ServiceMoistureConditions moistureCondition;
            bool IsValidInputString = Enum.TryParse(ServiceMoistureCondition, true, out moistureCondition);

            if (IsValidInputString == false)
            {
                throw new Exception("Failed to convert string. Moisture condition string is invalid. Please check input");
            }


            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                DimensionalLumber m = new DimensionalLumber();
                C_t_Fb = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.Bending, Temperature, moistureCondition);
                C_t_Ft = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.TensionParallelToGrain, Temperature, moistureCondition);
                C_t_Fv = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ShearParallelToGrain, Temperature, moistureCondition);
                C_t_Fc = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.CompresionParallelToGrain, Temperature, moistureCondition);
                C_t_E  = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ModulusOfElasticity, Temperature, moistureCondition);
            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber t = new Timber();
                C_t_Fb = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.Bending, Temperature, moistureCondition);
                C_t_Ft = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.TensionParallelToGrain, Temperature, moistureCondition);
                C_t_Fv = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ShearParallelToGrain, Temperature, moistureCondition);
                C_t_Fc = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.CompresionParallelToGrain, Temperature, moistureCondition);
                C_t_E  = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ModulusOfElasticity, Temperature, moistureCondition);
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return(new Dictionary <string, object>
            {
                { "C_t_Fb", C_t_Fb },
                { "C_t_Ft", C_t_Ft },
                { "C_t_Fv", C_t_Fv },
                { "C_t_Fc", C_t_Fc },
                { "C_t_E", C_t_E }
            });
        }
Exemplo n.º 13
0
        private string ObtainOfflineDirectory()
        {
            var offline = Android.OS.Environment.GetExternalStoragePublicDirectory("Offline");

            if (!offline.Exists())
            {
                Timber.D("Offline directory does not exist");
                offline.Mkdirs();
            }
            return(offline.AbsolutePath);
        }
Exemplo n.º 14
0
        public static LatLng GetRandomLatLng(double[] bbox)
        {
            Random random = new Random();

            double randomLat = bbox[1] + (bbox[3] - bbox[1]) * random.NextDouble();
            double randomLon = bbox[0] + (bbox[2] - bbox[0]) * random.NextDouble();

            LatLng latLng = new LatLng(randomLat, randomLon);

            Timber.D("GetRandomLatLng: %s", latLng.ToString());
            return(latLng);
        }
Exemplo n.º 15
0
        public void OnMilestoneEvent(RouteProgress p0, string p1, Milestone p2)
        {
            var instruction = p1;
            var milestone   = p2;

            if (milestone is VoiceInstructionMilestone)
            {
                Snackbar.Make(contentLayout, instruction, Snackbar.LengthShort).Show();
            }
            instructionView.UpdateBannerInstructionsWith(milestone);
            Timber.D("onMilestoneEvent - Current Instruction: %s", instruction);
        }
Exemplo n.º 16
0
 private void Write(string history, File saveFilePath)
 {
     try
     {
         using (var file = new System.IO.StreamWriter(saveFilePath.AbsolutePath))
         {
             file.WriteLine(history);
         }
     }
     catch (Exception exception)
     {
         Timber.E(exception.Message);
     }
 }
        public static Dictionary <string, object> IncisingFactor(bool IsIncised        = false,
                                                                 string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values

            double C_i_Fb = 1.0;
            double C_i_Ft = 1.0;
            double C_i_Fv = 1.0;
            double C_i_Fc = 1.0;
            double C_i_E  = 1.0;

            //Calculation logic:


            if (IsIncised == true)
            {
                if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
                {
                    DimensionalLumber m = new DimensionalLumber();
                    C_i_Fb = m.GetInsizingFactor(ww.ReferenceDesignValueType.Bending);
                    C_i_Ft = m.GetInsizingFactor(ww.ReferenceDesignValueType.TensionParallelToGrain);
                    C_i_Fv = m.GetInsizingFactor(ww.ReferenceDesignValueType.ShearParallelToGrain);
                    C_i_Fc = m.GetInsizingFactor(ww.ReferenceDesignValueType.CompresionParallelToGrain);
                    C_i_E  = m.GetInsizingFactor(ww.ReferenceDesignValueType.ModulusOfElasticity);
                }
                else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
                {
                    Timber t = new Timber();
                    C_i_Fb = t.GetInsizingFactor(ww.ReferenceDesignValueType.Bending);
                    C_i_Ft = t.GetInsizingFactor(ww.ReferenceDesignValueType.TensionParallelToGrain);
                    C_i_Fv = t.GetInsizingFactor(ww.ReferenceDesignValueType.ShearParallelToGrain);
                    C_i_Fc = t.GetInsizingFactor(ww.ReferenceDesignValueType.CompresionParallelToGrain);
                    C_i_E  = t.GetInsizingFactor(ww.ReferenceDesignValueType.ModulusOfElasticity);
                }
                else
                {
                    throw new Exception("Wood member type not supported.");
                }
            }

            return(new Dictionary <string, object>
            {
                { "C_i_Fb", C_i_Fb }
                , { "C_i_Ft", C_i_Ft }
                , { "C_i_Fv", C_i_Fv }
                , { "C_i_Fc", C_i_Fc }
                , { "C_i_E", C_i_E }
            });
        }
Exemplo n.º 18
0
        public static TimberSection TimberSectionFromProfile(IProfile profile, Timber material = null, string name = "")
        {
            //Run pre-process for section create. Calculates all section constants and checks name of profile
            var preProcessValues = PreProcessSectionCreate(name, profile);

            name    = preProcessValues.Item1;
            profile = preProcessValues.Item2;
            Dictionary <string, double> constants = preProcessValues.Item3;

            TimberSection section = new TimberSection(profile,
                                                      constants["Area"], constants["Rgy"], constants["Rgz"], constants["J"], constants["Iy"], constants["Iz"], constants["Iw"], constants["Wely"],
                                                      constants["Welz"], constants["Wply"], constants["Wplz"], constants["CentreZ"], constants["CentreY"], constants["Vz"],
                                                      constants["Vpz"], constants["Vy"], constants["Vpy"], constants["Asy"], constants["Asz"]);

            return(PostProcessSectionCreate(section, name, material, MaterialType.Timber));
        }
Exemplo n.º 19
0
        public void OnResponse(ICall p0, Response p1)
        {
            var call     = p0;
            var response = p1;

            Timber.D(call.Request().Url().ToString());
            if (response.Body() != null)
            {
                var body = response.Body() as DirectionsResponse;

                if (body.Routes().Any())
                {
                    DirectionsRoute route = body.Routes()[0];
                    DrawRoute(route);
                    ResetLocationEngine(route);
                    navigation.StartNavigation(route);
                    mapboxMap.AddOnMapClickListener(this);
                    tracking = true;
                }
            }
        }
        public static Dictionary <string, object> TimeEffectFactor(string LoadCombinationType, bool IsConnection = false, bool IsTreated = false,
                                                                   string WoodMemberType = "SawnDimensionLumber", string Code            = "NDS2015")
        {
            //Default values
            double lambda = 0;


            //Calculation logic:


            Kodestruct.Wood.NDS.LoadCombinationType _loadCombinationType;
            bool IsValidLoadComboString = Enum.TryParse(LoadCombinationType, true, out _loadCombinationType);

            if (IsValidLoadComboString == false)
            {
                throw new Exception("Failed to convert string. Errormessage. Please check input");
            }


            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                //GetTimeEffectFactor
                DimensionalLumber m = new DimensionalLumber();
                lambda = m.GetTimeEffectFactor(_loadCombinationType, IsConnection, IsTreated);
            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber t = new Timber();
                lambda = t.GetTimeEffectFactor(_loadCombinationType, IsConnection, IsTreated);
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return(new Dictionary <string, object>
            {
                { "lambda", lambda }
            });
        }
Exemplo n.º 21
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AddPreferencesFromResource(Resource.Xml.fragment_navigation_preferences);

            string gitHashTitle = $"Last Commit Hash: {GetHashCode()}";

            FindPreference(GetString(Resource.String.git_hash_key))
            .Title = gitHashTitle;

            FindPreference(GetString(Resource.String.nav_native_history_retrieve_key))
            .PreferenceChange += (s, e) =>
            {
                string history = MapboxNativeNavigatorImpl.Instance.History;
                var    path    = Environment.GetExternalStoragePublicDirectory("navigation_debug");
                if (!path.Exists())
                {
                    path.Mkdirs();
                }

                var file = Path.Combine(path.Path,
                                        $"history_{System.DateTime.Now.Millisecond}.json");

                try
                {
                    using var streamWriter = new StreamWriter(file, true);
                    streamWriter.WriteLine(history);
                    Toast.MakeText(Activity, $"Saved to {file}", ToastLength.Long)
                    .Show();
                    Timber.I($"History file saved to {file}");
                }
                catch (System.Exception ex)
                {
                    Timber.E($"History file write failed: {ex.Message}");
                }

                e.Handled = true;
            };
        }
        private void FindRouteWith(LocationEngineResult result)
        {
            Location userLocation = result.LastLocation;

            if (userLocation == null)
            {
                Timber.D("calculateRoute: User location is null, therefore, origin can't be set.");
                return;
            }
            Point origin = Point.FromLngLat(userLocation.Longitude, userLocation.Latitude);

            if (TurfMeasurement.Distance(origin, destination, TurfConstants.UnitMeters) < 50)
            {
                startRouteButton.Visibility = ViewStates.Gone;
                return;
            }

            NavigationRoute.Builder navigationRouteBuilder = NavigationRoute.InvokeBuilder(this)
                                                             .AccessToken(Mapbox.Mapboxsdk.Mapbox.AccessToken);
            navigationRouteBuilder.Origin(origin);
            navigationRouteBuilder.Destination(destination);
            if (waypoint != null)
            {
                navigationRouteBuilder.AddWaypoint(waypoint);
            }
            navigationRouteBuilder.EnableRefresh(true);
            navigationRouteBuilder.Build().GetRoute(new GetRouteCallback((response) =>
            {
                if (response != null && response.Routes().Any())
                {
                    route = response.Routes()[0];
                    navigationMapRoute.AddRoutes(response.Routes());
                    startRouteButton.Visibility = ViewStates.Visible;
                }
            }));
        }
Exemplo n.º 23
0
        public static async Task Timber(SocketCommandContext Context)
        {
            if (!Exeptioner.ValidMe(Context))
            {
                return;
            }

            if (Context.Channel.Name != "лес")
            {
                await Loging.Log("Добывать дерево можно только в лесу!", Context.Channel);

                return;
            }

            var ply = PersonService.persons[Context.User.Username];

            Random rand = new Random();

            int num = rand.Next(1, 10);

            Timber timber = new Timber("Дерево", 1, 30);


            bool added = ply.items.TryAdd(timber.name, timber);

            if (!added)
            {
                ply.items[timber.name].count += num;
            }
            else
            {
                ply.items[timber.name].count = num;
            }

            await Loging.Log(ply.name + " срубил " + timber.name, Context.Channel);
        }
Exemplo n.º 24
0
 public static TimberSection TimberRectangleSection(double height, double width, double cornerRadius = 0, Timber material = null, string name = "")
 {
     return(TimberSectionFromProfile(Spatial.Create.RectangleProfile(height, width, cornerRadius), material, name));
 }
Exemplo n.º 25
0
 public static MaterialType MaterialType(this Timber materialFragment)
 {
     return(materialFragment.IsNull() ? oM.Structure.MaterialFragments.MaterialType.Undefined : oM.Structure.MaterialFragments.MaterialType.Timber);
 }
Exemplo n.º 26
0
        public static Dictionary<string, object> TemperatureFactor(double Temperature, string ServiceMoistureCondition="Dry",
             string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values
            double C_t_Fb =1.0;
            double C_t_Ft =1.0;
            double C_t_Fv =1.0;
            double C_t_Fc =1.0;
            double C_t_E = 1.0;

            //Calculation logic:

            
            ww.ServiceMoistureConditions moistureCondition;
            bool IsValidInputString = Enum.TryParse(ServiceMoistureCondition, true, out moistureCondition);
            if (IsValidInputString == false)
            {
                throw new Exception("Failed to convert string. Moisture condition string is invalid. Please check input");
            }


            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                DimensionalLumber m = new DimensionalLumber();
                C_t_Fb = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.Bending, Temperature, moistureCondition);
                C_t_Ft = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.TensionParallelToGrain, Temperature, moistureCondition);
                C_t_Fv = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ShearParallelToGrain, Temperature, moistureCondition);
                C_t_Fc = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.CompresionParallelToGrain, Temperature, moistureCondition);
                C_t_E = m.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ModulusOfElasticity, Temperature, moistureCondition);
            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber t = new Timber();
                C_t_Fb = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.Bending, Temperature, moistureCondition);
                C_t_Ft = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.TensionParallelToGrain, Temperature, moistureCondition);
                C_t_Fv = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ShearParallelToGrain, Temperature, moistureCondition);
                C_t_Fc = t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.CompresionParallelToGrain, Temperature, moistureCondition);
                C_t_E =  t.GetTemperatureFactorCt(ww.ReferenceDesignValueType.ModulusOfElasticity, Temperature, moistureCondition);
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return new Dictionary<string, object>
            {
                { "C_t_Fb", C_t_Fb },
                { "C_t_Ft", C_t_Ft },
                { "C_t_Fv", C_t_Fv },
                { "C_t_Fc", C_t_Fc },
                { "C_t_E",  C_t_E  } 
            };
        }
Exemplo n.º 27
0
        public static Dictionary<string, object> SizeFactor(double d,double t, string WoodCommercialGrade, bool LoadAppliedToNarrowFace=false,
           string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values

            double C_F_Fb = 1.0;
            double C_F_Fc = 1.0;
            double C_F_Ft = 1.0;

            //Calculation logic:



            if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
            {
                DimensionalLumber m = new DimensionalLumber();

                string memberType = WoodMemberType.TrimStart("Sawn".ToCharArray());
                
                SawnLumberType sawnLumberType;
                bool IsValidSawnLumberTypeString = Enum.TryParse(memberType, true, out sawnLumberType);
                if (IsValidSawnLumberTypeString == false)
                {
                    throw new Exception("Failed to convert string. Sawn lumber type is incorrectly specified. Please check input");
                }

                
                ww.CommercialGrade _commercialGrade;
                bool IsValidCommercialGradeString = Enum.TryParse(WoodCommercialGrade, true, out _commercialGrade);
                if (IsValidCommercialGradeString == false)
                {
                    throw new Exception("Failed to convert string. Wood commercial grade is incorrectly specified. Please check input");
                }


                C_F_Fb = m.GetSizeFactor(d, t, sawnLumberType, _commercialGrade, ww.ReferenceDesignValueType.Bending, LoadAppliedToNarrowFace);
                C_F_Ft = m.GetSizeFactor(d, t, sawnLumberType, _commercialGrade, ww.ReferenceDesignValueType.TensionParallelToGrain, LoadAppliedToNarrowFace);
                C_F_Fc = m.GetSizeFactor(d, t, sawnLumberType, _commercialGrade, ww.ReferenceDesignValueType.CompresionParallelToGrain, LoadAppliedToNarrowFace);

            }
            else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
            {
                Timber timber = new Timber();
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return new Dictionary<string, object>
            {
                { "C_F_Fb", C_F_Fb },
                { "C_F_Fc", C_F_Fc },
                { "C_F_Ft", C_F_Ft },
            };
        }
Exemplo n.º 28
0
        private Element2D AnalyticalSurfaceToSpeckle(AnalyticalModelSurface revitSurface)
        {
            if (!revitSurface.IsEnabled())
            {
                return(new Element2D());
            }

            var speckleElement2D  = new Element2D();
            var structuralElement = Doc.GetElement(revitSurface.GetElementId());
            var mark = GetParamValue <string>(structuralElement, BuiltInParameter.ALL_MODEL_MARK);

            speckleElement2D.name = mark;

            var edgeNodes = new List <Node> {
            };
            var loops     = revitSurface.GetLoops(AnalyticalLoopType.External);

            var displayLine = new Polycurve();

            foreach (var loop in loops)
            {
                var coor = new List <double>();
                foreach (var curve in loop)
                {
                    var points = curve.Tessellate();

                    foreach (var p in points.Skip(1))
                    {
                        var vertex   = PointToSpeckle(p);
                        var edgeNode = new Node(vertex, null, null, null);
                        edgeNodes.Add(edgeNode);
                    }

                    displayLine.segments.Add(CurveToSpeckle(curve));
                }
            }

            speckleElement2D.topology        = edgeNodes;
            speckleElement2D["displayValue"] = displayLine;

            var voidNodes = new List <List <Node> > {
            };
            var voidLoops = revitSurface.GetLoops(AnalyticalLoopType.Void);

            foreach (var loop in voidLoops)
            {
                var loopNodes = new List <Node>();
                foreach (var curve in loop)
                {
                    var points = curve.Tessellate();

                    foreach (var p in points.Skip(1))
                    {
                        var vertex   = PointToSpeckle(p);
                        var voidNode = new Node(vertex, null, null, null);
                        loopNodes.Add(voidNode);
                    }
                }
                voidNodes.Add(loopNodes);
            }
            //speckleElement2D.voids = voidNodes;

            //var mesh = new Geometry.Mesh();
            //var solidGeom = GetElementSolids(structuralElement);
            //(mesh.faces, mesh.vertices) = GetFaceVertexArrFromSolids(solidGeom);
            //speckleElement2D.baseMesh = mesh;

            var prop = new Property2D();

            // Material
            DB.Material structMaterial = null;
            double      thickness      = 0;
            var         memberType     = MemberType2D.Generic2D;

            if (structuralElement is DB.Floor)
            {
                var floor = structuralElement as DB.Floor;
                structMaterial = Doc.GetElement(floor.FloorType.StructuralMaterialId) as DB.Material;
                thickness      = GetParamValue <double>(structuralElement, BuiltInParameter.STRUCTURAL_FLOOR_CORE_THICKNESS);
                memberType     = MemberType2D.Slab;
            }
            else if (structuralElement is DB.Wall)
            {
                var wall = structuralElement as DB.Wall;
                structMaterial = Doc.GetElement(wall.WallType.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId()) as DB.Material;
                thickness      = ScaleToSpeckle(wall.WallType.Width);
                memberType     = MemberType2D.Wall;
            }

            var materialAsset = ((PropertySetElement)Doc.GetElement(structMaterial.StructuralAssetId)).GetStructuralAsset();
            var materialType  = structMaterial.MaterialClass;

            Structural.Materials.Material speckleMaterial = null;
            switch (materialType)
            {
            case "Concrete":
                var concreteMaterial = new Concrete
                {
                    name = Doc.GetElement(structMaterial.StructuralAssetId).Name,
                    //type = Structural.MaterialType.Concrete,
                    grade                = null,
                    designCode           = null,
                    codeYear             = null,
                    elasticModulus       = materialAsset.YoungModulus.X,
                    compressiveStrength  = materialAsset.ConcreteCompression,
                    tensileStrength      = 0,
                    flexuralStrength     = 0,
                    maxCompressiveStrain = 0,
                    maxTensileStrain     = 0,
                    maxAggregateSize     = 0,
                    lightweight          = materialAsset.Lightweight,
                    poissonsRatio        = materialAsset.PoissonRatio.X,
                    shearModulus         = materialAsset.ShearModulus.X,
                    density              = materialAsset.Density,
                    thermalExpansivity   = materialAsset.ThermalExpansionCoefficient.X,
                    dampingRatio         = 0
                };
                speckleMaterial = concreteMaterial;
                break;

            case "Steel":
                var steelMaterial = new Steel
                {
                    name = Doc.GetElement(structMaterial.StructuralAssetId).Name,
                    //type = Structural.MaterialType.Steel,
                    grade              = materialAsset.Name,
                    designCode         = null,
                    codeYear           = null,
                    elasticModulus     = materialAsset.YoungModulus.X,         // Newtons per foot meter
                    yieldStrength      = materialAsset.MinimumYieldStress,     // Newtons per foot meter
                    ultimateStrength   = materialAsset.MinimumTensileStrength, // Newtons per foot meter
                    maxStrain          = 0,
                    poissonsRatio      = materialAsset.PoissonRatio.X,
                    shearModulus       = materialAsset.ShearModulus.X,                // Newtons per foot meter
                    density            = materialAsset.Density,                       // kilograms per cubed feet
                    thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, // inverse Kelvin
                    dampingRatio       = 0
                };
                speckleMaterial = steelMaterial;
                break;

            case "Wood":
                var timberMaterial = new Timber
                {
                    name = Doc.GetElement(structMaterial.StructuralAssetId).Name,
                    //type = Structural.MaterialType.Timber,
                    grade              = materialAsset.WoodGrade,
                    designCode         = null,
                    codeYear           = null,
                    elasticModulus     = materialAsset.YoungModulus.X,                // Newtons per foot meter
                    poissonsRatio      = materialAsset.PoissonRatio.X,
                    shearModulus       = materialAsset.ShearModulus.X,                // Newtons per foot meter
                    density            = materialAsset.Density,                       // kilograms per cubed feet
                    thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, // inverse Kelvin
                    species            = materialAsset.WoodSpecies,
                    dampingRatio       = 0
                };
                timberMaterial["bendingStrength"]                  = materialAsset.WoodBendingStrength;
                timberMaterial["parallelCompressionStrength"]      = materialAsset.WoodParallelCompressionStrength;
                timberMaterial["parallelShearStrength"]            = materialAsset.WoodParallelShearStrength;
                timberMaterial["perpendicularCompressionStrength"] = materialAsset.WoodPerpendicularCompressionStrength;
                timberMaterial["perpendicularShearStrength"]       = materialAsset.WoodPerpendicularShearStrength;
                speckleMaterial = timberMaterial;
                break;

            default:
                var defaultMaterial = new Structural.Materials.Material
                {
                    name = Doc.GetElement(structMaterial.StructuralAssetId).Name
                };
                speckleMaterial = defaultMaterial;
                break;
            }

            prop.material = speckleMaterial;
            prop.name     = Doc.GetElement(revitSurface.GetElementId()).Name;
            //prop.type = memberType;
            //prop.analysisType = Structural.AnalysisType2D.Shell;
            prop.thickness = thickness;

            speckleElement2D.property = prop;

            GetAllRevitParamsAndIds(speckleElement2D, revitSurface);

            //speckleElement2D.displayMesh = GetElementDisplayMesh(Doc.GetElement(revitSurface.GetElementId()),
            // new Options() { DetailLevel = ViewDetailLevel.Fine, ComputeReferences = false });

            return(speckleElement2D);
        }
Exemplo n.º 29
0
 public void OnFailure(Java.Lang.Exception p0)
 {
     Timber.E(p0);
 }
Exemplo n.º 30
0
        private Element1D AnalyticalStickToSpeckle(AnalyticalModelStick revitStick)
        {
            if (!revitStick.IsEnabled())
            {
                return(new Element1D());
            }

            var speckleElement1D = new Element1D();

            switch (revitStick.Category.Name)
            {
            case "Analytical Columns":
                speckleElement1D.type = ElementType1D.Column;
                break;

            case "Analytical Beams":
                speckleElement1D.type = ElementType1D.Beam;
                break;

            case "Analytical Braces":
                speckleElement1D.type = ElementType1D.Brace;
                break;

            default:
                speckleElement1D.type = ElementType1D.Other;
                break;
            }

            var curves = revitStick.GetCurves(AnalyticalCurveType.RigidLinkHead).ToList();

            curves.AddRange(revitStick.GetCurves(AnalyticalCurveType.ActiveCurves));
            curves.AddRange(revitStick.GetCurves(AnalyticalCurveType.RigidLinkTail));

            if (curves.Count > 1)
            {
                speckleElement1D.baseLine = null;
            }
            else
            {
                speckleElement1D.baseLine = (Objects.Geometry.Line)CurveToSpeckle(curves[0]);
            }

            var coordinateSystem = revitStick.GetLocalCoordinateSystem();

            if (coordinateSystem != null)
            {
                speckleElement1D.localAxis = new Geometry.Plane(PointToSpeckle(coordinateSystem.Origin), VectorToSpeckle(coordinateSystem.BasisZ), VectorToSpeckle(coordinateSystem.BasisX), VectorToSpeckle(coordinateSystem.BasisY));
            }

            var startOffset = revitStick.GetOffset(AnalyticalElementSelector.StartOrBase);
            var endOffset   = revitStick.GetOffset(AnalyticalElementSelector.EndOrTop);

            speckleElement1D.end1Offset = VectorToSpeckle(startOffset);
            speckleElement1D.end2Offset = VectorToSpeckle(endOffset);

            var startRelease = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_START_RELEASE_TYPE);
            var endRelease   = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_END_RELEASE_TYPE);

            if (startRelease == 0)
            {
                speckleElement1D.end1Releases = new Restraint(RestraintType.Fixed);
            }
            else
            {
                var botReleaseX  = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_FX) == 1 ? "R" : "F";
                var botReleaseY  = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_FY) == 1 ? "R" : "F";
                var botReleaseZ  = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_FZ) == 1 ? "R" : "F";
                var botReleaseXX = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_MX) == 1 ? "R" : "F";
                var botReleaseYY = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_MY) == 1 ? "R" : "F";
                var botReleaseZZ = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_BOTTOM_RELEASE_MZ) == 1 ? "R" : "F";

                string botReleaseCode = botReleaseX + botReleaseY + botReleaseZ + botReleaseXX + botReleaseYY + botReleaseZZ;
                speckleElement1D.end1Releases = new Restraint(botReleaseCode);
            }

            if (endRelease == 0)
            {
                speckleElement1D.end2Releases = new Restraint(RestraintType.Fixed);
            }
            else
            {
                var topReleaseX  = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_FX) == 1 ? "R" : "F";
                var topReleaseY  = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_FY) == 1 ? "R" : "F";
                var topReleaseZ  = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_FZ) == 1 ? "R" : "F";
                var topReleaseXX = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_MX) == 1 ? "R" : "F";
                var topReleaseYY = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_MY) == 1 ? "R" : "F";
                var topReleaseZZ = GetParamValue <int>(revitStick, BuiltInParameter.STRUCTURAL_TOP_RELEASE_MZ) == 1 ? "R" : "F";

                string topReleaseCode = topReleaseX + topReleaseY + topReleaseZ + topReleaseXX + topReleaseYY + topReleaseZZ;
                speckleElement1D.end2Releases = new Restraint(topReleaseCode);
            }

            var prop = new Property1D();

            var stickFamily = (Autodesk.Revit.DB.FamilyInstance)Doc.GetElement(revitStick.GetElementId());
            var section     = stickFamily.Symbol.GetStructuralSection();

            var speckleSection = new SectionProfile();

            speckleSection.name = section.StructuralSectionShapeName;

            switch (section.StructuralSectionGeneralShape)
            {
            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralI: // Double T structural sections
                var ISection = new ISection();
                ISection.name            = section.StructuralSectionShapeName;
                ISection.shapeType       = Structural.ShapeType.I;
                ISection.depth           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("Height").GetValue(section);
                ISection.width           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("Width").GetValue(section);
                ISection.webThickness    = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("WebThickness").GetValue(section);
                ISection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("FlangeThickness").GetValue(section);
                ISection.area            = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("SectionArea").GetValue(section);
                ISection.weight          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("NominalWeight").GetValue(section);
                ISection.Iyy             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                ISection.Izz             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                ISection.J     = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralI).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection = ISection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralT: // Tees structural sections
                var teeSection = new Tee();
                teeSection.name            = section.StructuralSectionShapeName;
                teeSection.shapeType       = Structural.ShapeType.I;
                teeSection.depth           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("Height").GetValue(section);
                teeSection.width           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("Width").GetValue(section);
                teeSection.webThickness    = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("WebThickness").GetValue(section);
                teeSection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("FlangeThickness").GetValue(section);
                teeSection.area            = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("SectionArea").GetValue(section);
                teeSection.weight          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("NominalWeight").GetValue(section);
                teeSection.Iyy             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                teeSection.Izz             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                teeSection.J   = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralT).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection = teeSection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralH: // Rectangular Pipe structural sections
                var rectSection = new Rectangular();
                rectSection.name      = section.StructuralSectionShapeName;
                rectSection.shapeType = Structural.ShapeType.I;
                rectSection.depth     = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("Height").GetValue(section);
                rectSection.width     = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("Width").GetValue(section);
                var wallThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("WallNominalThickness").GetValue(section);
                rectSection.webThickness    = wallThickness;
                rectSection.flangeThickness = wallThickness;
                rectSection.area            = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("SectionArea").GetValue(section);
                rectSection.weight          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("NominalWeight").GetValue(section);
                rectSection.Iyy             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                rectSection.Izz             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                rectSection.J  = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralH).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection = rectSection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralR: // Pipe structural sections
                var circSection = new Circular();
                circSection.name          = section.StructuralSectionShapeName;
                circSection.shapeType     = Structural.ShapeType.Circular;
                circSection.radius        = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("Diameter").GetValue(section) / 2;
                circSection.wallThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("WallNominalThickness").GetValue(section);
                circSection.area          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("SectionArea").GetValue(section);
                circSection.weight        = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("NominalWeight").GetValue(section);
                circSection.Iyy           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                circSection.Izz           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                circSection.J             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralR).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection            = circSection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralF: // Flat Bar structural sections
                var flatRectSection = new Rectangular();
                flatRectSection.name      = section.StructuralSectionShapeName;
                flatRectSection.shapeType = Structural.ShapeType.I;
                flatRectSection.depth     = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("Height").GetValue(section);
                flatRectSection.width     = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("Width").GetValue(section);
                flatRectSection.area      = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("SectionArea").GetValue(section);
                flatRectSection.weight    = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("NominalWeight").GetValue(section);
                flatRectSection.Iyy       = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                flatRectSection.Izz       = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                flatRectSection.J         = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralF).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection            = flatRectSection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralS: // Round Bar structural sections
                var flatCircSection = new Circular();
                flatCircSection.name          = section.StructuralSectionShapeName;
                flatCircSection.shapeType     = Structural.ShapeType.Circular;
                flatCircSection.radius        = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("Diameter").GetValue(section) / 2;
                flatCircSection.wallThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("WallNominalThickness").GetValue(section);
                flatCircSection.area          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("SectionArea").GetValue(section);
                flatCircSection.weight        = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("NominalWeight").GetValue(section);
                flatCircSection.Iyy           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                flatCircSection.Izz           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                flatCircSection.J             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralS).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection = flatCircSection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralW: // Angle structural sections
                var angleSection = new Angle();
                angleSection.name            = section.StructuralSectionShapeName;
                angleSection.shapeType       = Structural.ShapeType.Angle;
                angleSection.depth           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("Height").GetValue(section);
                angleSection.width           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("Width").GetValue(section);
                angleSection.webThickness    = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("WebThickness").GetValue(section);
                angleSection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("FlangeThickness").GetValue(section);
                angleSection.area            = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("SectionArea").GetValue(section);
                angleSection.weight          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("NominalWeight").GetValue(section);
                angleSection.Iyy             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                angleSection.Izz             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                angleSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralW).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection = angleSection;
                break;

            case DB.Structure.StructuralSections.StructuralSectionGeneralShape.GeneralU: // Channel  structural sections
                var channelSection = new Channel();
                channelSection.name            = section.StructuralSectionShapeName;
                channelSection.shapeType       = Structural.ShapeType.Channel;
                channelSection.depth           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("Height").GetValue(section);
                channelSection.width           = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("Width").GetValue(section);
                channelSection.webThickness    = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("WebThickness").GetValue(section);
                channelSection.flangeThickness = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("FlangeThickness").GetValue(section);
                channelSection.area            = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("SectionArea").GetValue(section);
                channelSection.weight          = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("NominalWeight").GetValue(section);
                channelSection.Iyy             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("MomentOfInertiaStrongAxis").GetValue(section);
                channelSection.Izz             = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("MomentOfInertiaWeakAxis").GetValue(section);
                channelSection.J = (double)typeof(DB.Structure.StructuralSections.StructuralSectionGeneralU).GetProperty("TorsionalMomentOfInertia").GetValue(section);
                speckleSection   = channelSection;
                break;

            default:
                speckleSection.name = section.StructuralSectionShapeName;
                break;
            }

            var materialType = stickFamily.StructuralMaterialType;
            var structMat    = (DB.Material)Doc.GetElement(stickFamily.StructuralMaterialId);

            if (structMat == null)
            {
                structMat = (DB.Material)Doc.GetElement(stickFamily.Symbol.get_Parameter(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM).AsElementId());
            }
            var materialAsset = ((PropertySetElement)Doc.GetElement(structMat.StructuralAssetId)).GetStructuralAsset();

            Structural.Materials.Material speckleMaterial = null;

            switch (materialType)
            {
            case StructuralMaterialType.Concrete:
                var concreteMaterial = new Concrete
                {
                    name = Doc.GetElement(stickFamily.StructuralMaterialId).Name,
                    //type = Structural.MaterialType.Concrete,
                    grade                = null,
                    designCode           = null,
                    codeYear             = null,
                    elasticModulus       = materialAsset.YoungModulus.X,
                    compressiveStrength  = materialAsset.ConcreteCompression,
                    tensileStrength      = 0,
                    flexuralStrength     = 0,
                    maxCompressiveStrain = 0,
                    maxTensileStrain     = 0,
                    maxAggregateSize     = 0,
                    lightweight          = materialAsset.Lightweight,
                    poissonsRatio        = materialAsset.PoissonRatio.X,
                    shearModulus         = materialAsset.ShearModulus.X,
                    density              = materialAsset.Density,
                    thermalExpansivity   = materialAsset.ThermalExpansionCoefficient.X,
                    dampingRatio         = 0
                };
                speckleMaterial = concreteMaterial;
                break;

            case StructuralMaterialType.Steel:
                var steelMaterial = new Steel
                {
                    name = Doc.GetElement(stickFamily.StructuralMaterialId).Name,
                    //type = Structural.MaterialType.Steel,
                    grade              = materialAsset.Name,
                    designCode         = null,
                    codeYear           = null,
                    elasticModulus     = materialAsset.YoungModulus.X,         // Newtons per foot meter
                    yieldStrength      = materialAsset.MinimumYieldStress,     // Newtons per foot meter
                    ultimateStrength   = materialAsset.MinimumTensileStrength, // Newtons per foot meter
                    maxStrain          = 0,
                    poissonsRatio      = materialAsset.PoissonRatio.X,
                    shearModulus       = materialAsset.ShearModulus.X,                // Newtons per foot meter
                    density            = materialAsset.Density,                       // kilograms per cubed feet
                    thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, // inverse Kelvin
                    dampingRatio       = 0
                };
                speckleMaterial = steelMaterial;
                break;

            case StructuralMaterialType.Wood:
                var timberMaterial = new Timber
                {
                    name = Doc.GetElement(structMat.StructuralAssetId).Name,
                    //type = Structural.MaterialType.Timber,
                    grade              = materialAsset.WoodGrade,
                    designCode         = null,
                    codeYear           = null,
                    elasticModulus     = materialAsset.YoungModulus.X,                // Newtons per foot meter
                    poissonsRatio      = materialAsset.PoissonRatio.X,
                    shearModulus       = materialAsset.ShearModulus.X,                // Newtons per foot meter
                    density            = materialAsset.Density,                       // kilograms per cubed feet
                    thermalExpansivity = materialAsset.ThermalExpansionCoefficient.X, // inverse Kelvin
                    species            = materialAsset.WoodSpecies,
                    dampingRatio       = 0
                };
                timberMaterial["bendingStrength"]                  = materialAsset.WoodBendingStrength;
                timberMaterial["parallelCompressionStrength"]      = materialAsset.WoodParallelCompressionStrength;
                timberMaterial["parallelShearStrength"]            = materialAsset.WoodParallelShearStrength;
                timberMaterial["perpendicularCompressionStrength"] = materialAsset.WoodPerpendicularCompressionStrength;
                timberMaterial["perpendicularShearStrength"]       = materialAsset.WoodPerpendicularShearStrength;
                speckleMaterial = timberMaterial;
                break;

            default:
                var defaultMaterial = new Objects.Structural.Materials.Material
                {
                    name = Doc.GetElement(stickFamily.StructuralMaterialId).Name
                };
                speckleMaterial = defaultMaterial;
                break;
            }

            prop.profile  = speckleSection;
            prop.material = speckleMaterial;
            prop.name     = Doc.GetElement(revitStick.GetElementId()).Name;

            var structuralElement = Doc.GetElement(revitStick.GetElementId());
            var mark = GetParamValue <string>(structuralElement, BuiltInParameter.ALL_MODEL_MARK);

            if (revitStick is AnalyticalModelColumn)
            {
                speckleElement1D.type = ElementType1D.Column;
                //prop.memberType = MemberType.Column;
                var locationMark = GetParamValue <string>(structuralElement, BuiltInParameter.COLUMN_LOCATION_MARK);
                if (locationMark == null)
                {
                    speckleElement1D.name = mark;
                }
                else
                {
                    speckleElement1D.name = locationMark;
                }
            }
            else
            {
                prop.memberType       = MemberType.Beam;
                speckleElement1D.name = mark;
            }

            speckleElement1D.property = prop;

            GetAllRevitParamsAndIds(speckleElement1D, revitStick);
            speckleElement1D.displayMesh = GetElementDisplayMesh(Doc.GetElement(revitStick.GetElementId()));
            return(speckleElement1D);
        }
Exemplo n.º 31
0
        public static Dictionary<string, object> WetServiceFactor(string ServiceMoistureCondition, double F_ref, double C_F,
             string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values
            double C_M_Fb = 0;
            double C_M_Ft = 0;
            double C_M_Fv = 0;
            double C_M_Fc = 0;
            double C_M_E = 0;


            //Calculation logic:

            if (WoodMemberType.Contains("Sawn"))
            {
                       SawnLumberType sawnLumberType;

                        string memberType = WoodMemberType.TrimStart("Sawn".ToCharArray());
                        bool IsValidSawnLumberTypeString = Enum.TryParse(memberType, true, out sawnLumberType);
                        if (IsValidSawnLumberTypeString == false)
                        {
                            throw new Exception("Failed to convert string. Check string input for sawn lumber type. Please check input");
                        }


                    if ( WoodMemberType.Contains("Lumber"))
                    {
                        DimensionalLumber m = new DimensionalLumber();
                        C_M_Fb = m.GetWetServiceFactor(ReferenceDesignValueType.Bending,F_ref,C_F,sawnLumberType);
                        C_M_Ft = m.GetWetServiceFactor(ReferenceDesignValueType.TensionParallelToGrain, F_ref, C_F, sawnLumberType);
                        C_M_Fv = m.GetWetServiceFactor(ReferenceDesignValueType.ShearParallelToGrain, F_ref, C_F, sawnLumberType);
                        C_M_Fc = m.GetWetServiceFactor(ReferenceDesignValueType.CompresionParallelToGrain, F_ref, C_F, sawnLumberType);
                        C_M_E =  m.GetWetServiceFactor(ReferenceDesignValueType.ModulusOfElasticity, F_ref, C_F, sawnLumberType);
                

                

                    }
                    else if ( WoodMemberType.Contains("Timber"))
                    {
                        Timber t = new Timber();
                        C_M_Fb = t.GetWetServiceFactor(ReferenceDesignValueType.Bending,F_ref,C_F,sawnLumberType);
                        C_M_Ft = t.GetWetServiceFactor(ReferenceDesignValueType.TensionParallelToGrain, F_ref, C_F, sawnLumberType);
                        C_M_Fv = t.GetWetServiceFactor(ReferenceDesignValueType.ShearParallelToGrain, F_ref, C_F, sawnLumberType);
                        C_M_Fc = t.GetWetServiceFactor(ReferenceDesignValueType.CompresionParallelToGrain, F_ref, C_F, sawnLumberType);
                        C_M_E = t.GetWetServiceFactor(ReferenceDesignValueType.ModulusOfElasticity, F_ref, C_F, sawnLumberType);
                    }
                      else
                    {
                        throw new Exception("Wood member type not supported.");
                    }
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return new Dictionary<string, object>
            {
                { "C_M_Fb", C_M_Fb }
                ,{ "C_M_Ft", C_M_Ft }
                ,{ "C_M_Fv", C_M_Fv }
                ,{ "C_M_Fc", C_M_Fc }
                ,{ "C_M_E", C_M_E }
 
            };
        }
Exemplo n.º 32
0
        public static Dictionary <string, object> WetServiceFactor(string ServiceMoistureCondition, double F_ref, double C_F,
                                                                   string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values
            double C_M_Fb = 0;
            double C_M_Ft = 0;
            double C_M_Fv = 0;
            double C_M_Fc = 0;
            double C_M_E  = 0;


            //Calculation logic:

            if (WoodMemberType.Contains("Sawn"))
            {
                SawnLumberType sawnLumberType;

                string memberType = WoodMemberType.TrimStart("Sawn".ToCharArray());
                bool   IsValidSawnLumberTypeString = Enum.TryParse(memberType, true, out sawnLumberType);
                if (IsValidSawnLumberTypeString == false)
                {
                    throw new Exception("Failed to convert string. Check string input for sawn lumber type. Please check input");
                }


                if (WoodMemberType.Contains("Lumber"))
                {
                    DimensionalLumber m = new DimensionalLumber();
                    C_M_Fb = m.GetWetServiceFactor(ReferenceDesignValueType.Bending, F_ref, C_F, sawnLumberType);
                    C_M_Ft = m.GetWetServiceFactor(ReferenceDesignValueType.TensionParallelToGrain, F_ref, C_F, sawnLumberType);
                    C_M_Fv = m.GetWetServiceFactor(ReferenceDesignValueType.ShearParallelToGrain, F_ref, C_F, sawnLumberType);
                    C_M_Fc = m.GetWetServiceFactor(ReferenceDesignValueType.CompresionParallelToGrain, F_ref, C_F, sawnLumberType);
                    C_M_E  = m.GetWetServiceFactor(ReferenceDesignValueType.ModulusOfElasticity, F_ref, C_F, sawnLumberType);
                }
                else if (WoodMemberType.Contains("Timber"))
                {
                    Timber t = new Timber();
                    C_M_Fb = t.GetWetServiceFactor(ReferenceDesignValueType.Bending, F_ref, C_F, sawnLumberType);
                    C_M_Ft = t.GetWetServiceFactor(ReferenceDesignValueType.TensionParallelToGrain, F_ref, C_F, sawnLumberType);
                    C_M_Fv = t.GetWetServiceFactor(ReferenceDesignValueType.ShearParallelToGrain, F_ref, C_F, sawnLumberType);
                    C_M_Fc = t.GetWetServiceFactor(ReferenceDesignValueType.CompresionParallelToGrain, F_ref, C_F, sawnLumberType);
                    C_M_E  = t.GetWetServiceFactor(ReferenceDesignValueType.ModulusOfElasticity, F_ref, C_F, sawnLumberType);
                }
                else
                {
                    throw new Exception("Wood member type not supported.");
                }
            }
            else
            {
                throw new Exception("Wood member type not supported.");
            }

            return(new Dictionary <string, object>
            {
                { "C_M_Fb", C_M_Fb }
                , { "C_M_Ft", C_M_Ft }
                , { "C_M_Fv", C_M_Fv }
                , { "C_M_Fc", C_M_Fc }
                , { "C_M_E", C_M_E }
            });
        }
Exemplo n.º 33
0
        private void SetupTimber()
        {
#if DEBUG
            Timber.Plant(new Timber.DebugTree());
#endif
        }
Exemplo n.º 34
0
 public void OnFailure(ICall p0, Throwable p1)
 {
     Timber.E(p1);
 }
Exemplo n.º 35
0
        public static Dictionary<string, object> IncisingFactor(bool IsIncised =false,
             string WoodMemberType = "SawnDimensionLumber", string Code = "NDS2015")
        {
            //Default values

            double C_i_Fb=1.0;
            double C_i_Ft=1.0;
            double C_i_Fv=1.0;
            double C_i_Fc=1.0;
            double C_i_E =1.0;

            //Calculation logic:


            if (IsIncised == true)
            {
                if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Lumber"))
                {
                    DimensionalLumber m = new DimensionalLumber();
                    C_i_Fb = m.GetInsizingFactor(ww.ReferenceDesignValueType.Bending);
                    C_i_Ft = m.GetInsizingFactor(ww.ReferenceDesignValueType.TensionParallelToGrain);
                    C_i_Fv = m.GetInsizingFactor(ww.ReferenceDesignValueType.ShearParallelToGrain);
                    C_i_Fc = m.GetInsizingFactor(ww.ReferenceDesignValueType.CompresionParallelToGrain);
                    C_i_E = m.GetInsizingFactor(ww.ReferenceDesignValueType.ModulusOfElasticity);
                }
                else if (WoodMemberType.Contains("Sawn") && WoodMemberType.Contains("Timber"))
                {
                    Timber t = new Timber();
                    C_i_Fb = t.GetInsizingFactor(ww.ReferenceDesignValueType.Bending);
                    C_i_Ft = t.GetInsizingFactor(ww.ReferenceDesignValueType.TensionParallelToGrain);
                    C_i_Fv = t.GetInsizingFactor(ww.ReferenceDesignValueType.ShearParallelToGrain);
                    C_i_Fc = t.GetInsizingFactor(ww.ReferenceDesignValueType.CompresionParallelToGrain);
                    C_i_E =  t.GetInsizingFactor(ww.ReferenceDesignValueType.ModulusOfElasticity);
                }
                else
                {
                    throw new Exception("Wood member type not supported.");
                } 
            }

            return new Dictionary<string, object>
            {
                { "C_i_Fb", C_i_Fb }
                ,{ "C_i_Ft", C_i_Ft }
                ,{ "C_i_Fv", C_i_Fv }
                ,{ "C_i_Fc", C_i_Fc }
                ,{ "C_i_E", C_i_E }
 
            };
        }