public static bool IsEdgeFeature(this ISectionFeature sectionFeature)
        {
            bool hasEdgeFeatureAttribute =
                Attribute.GetCustomAttribute(sectionFeature.GetType(), typeof(EdgeFeatureAttribute)) != null;

            return(hasEdgeFeatureAttribute);
        }
        public ShaftSectionFeatureError(ShaftSection section, ISectionFeature feature, string errorMessage)
        {
            this.Section      = section;
            this.Feature      = feature;
            this.ErrorMessage = errorMessage;

            Shaft.Sections.CollectionChanged += ProvideSelfDestroy;
        }
Example #3
0
        public static EdgeFeature ToEdgeFeatureEnumMember(this ISectionFeature sectionFeature)
        {
            if (!sectionFeature.IsEdgeFeature())
            {
                throw new ArgumentException("A specified section feature type must be a type of an edge feature",
                                            nameof(sectionFeature));
            }

            switch (sectionFeature)
            {
            case ChamferEdgeFeature _:
                return(EdgeFeature.Chamfer);

            case FilletEdgeFeature _:
                return(EdgeFeature.Fillet);

            case ThreadEdgeFeature _:
                return(EdgeFeature.Thread);

            case LockNutGrooveEdgeFeature _:
                return(EdgeFeature.LockNutGroove);

            case PlainKeywayGrooveEdgeFeature _:
                return(EdgeFeature.PlainKeywayGroove);

            case KeywayGrooveRoundedEndEdgeFeature _:
                return(EdgeFeature.KeywayGrooveRoundedEnd);

            case ReliefSIEdgeFeature _:
                return(EdgeFeature.ReliefSI);

            case ReliefDinEdgeFeature _:
                return(EdgeFeature.ReliefDIN);

            case ReliefGostEdgeFeature _:
                return(EdgeFeature.ReliefGOST);


            default:
                throw new ArgumentException(
                          $"Cannot find a corresponding edge feature enum member for {sectionFeature}",
                          nameof(sectionFeature));
            }
        }
 public FeatureConstructionError(ISectionFeature feature)
 {
     this.Feature = feature;
 }