Beispiel #1
0
        internal Material(long _id, string _name, float _thickness, MaterialPosToWallAxisPlane _pos, float _accA, int _nr_surf, bool _is_bound2cr, long _bound_crid)
        {
            this.ID        = _id;
            this.Name      = _name;
            this.Thickness = _thickness;
            this.Position  = _pos;

            this.AccArea       = _accA;
            this.NrSurfaces    = _nr_surf;
            this.bound_cr      = null;
            this.is_bound_2_cr = _is_bound2cr;
            this.bound_cr_id   = _bound_crid;
        }
Beispiel #2
0
        public static string MPTWAP2String(MaterialPosToWallAxisPlane _pos)
        {
            switch (_pos)
            {
            case MaterialPosToWallAxisPlane.OUT:
                return("OUT");

            case MaterialPosToWallAxisPlane.IN:
                return("IN");

            default:
                return("MIDDLE");
            }
        }
Beispiel #3
0
        public Material(string _name, float _thickness, MaterialPosToWallAxisPlane _pos)
        {
            this.ID        = (++Material.NR_MATERIALS);
            this.Name      = _name;
            this.thickness = _thickness;
            this.Position  = _pos;

            this.bound_cr      = null;
            this.is_bound_2_cr = false;
            this.bound_cr_id   = -1;

            this.acc_area   = 0f;
            this.NrSurfaces = 0;
        }
Beispiel #4
0
        internal void SetOffsets(CompRepAlignedWith _sender, double _offset_out, double _offset_in)
        {
            if (_sender == null)
            {
                return;
            }
            if (this.BoundCR == null)
            {
                return;
            }
            if (this.BoundCR.CR_ID != _sender.CR_ID)
            {
                return;
            }

            bool found_offset_change = false;

            found_offset_change = Math.Abs(this.Thickness - (float)(_offset_out + _offset_in)) > Utils.CommonExtensions.LINEDISTCALC_TOLERANCE;
            this.Thickness      = (float)(_offset_out + _offset_in);

            MaterialPosToWallAxisPlane pos = MaterialPosToWallAxisPlane.MIDDLE;

            if (_offset_in * 10 < _offset_out)
            {
                pos = MaterialPosToWallAxisPlane.IN;
            }
            else if (_offset_out * 10 < _offset_in)
            {
                pos = MaterialPosToWallAxisPlane.OUT;
            }

            found_offset_change |= (this.Position == pos);
            this.Position        = pos;

            this.OffsetsChanged = found_offset_change;
        }
        internal Material ReconstructMaterial(long _id, string _name, float _thickness, MaterialPosToWallAxisPlane _pos, float _accA, int _nr_surf, bool _is_bound2cr, long _bound_crid)
        {
            Material m_duplicate = this.materials.FirstOrDefault(x => x.ID == _id);

            if (m_duplicate != null)
            {
                return(null);
            }

            Material m = new Material(_id, _name, _thickness, _pos, _accA, _nr_surf, _is_bound2cr, _bound_crid);

            this.materials.Add(m);
            Material.NR_MATERIALS = this.materials.Select(x => x.ID).Max() + 1;
            return(m);
        }