Пример #1
0
        private List <CompRepDescribes2DorLess> FindAllSurfaceRepsWMaterial(long _material_id)
        {
            List <CompRepDescribes2DorLess> found = new List <CompRepDescribes2DorLess>();

            if (_material_id < 0)
            {
                return(found);
            }

            if (this.comp_rep_record_flat == null)
            {
                this.UpdateFlatRecord();
            }

            foreach (CompRep cr in this.comp_rep_record_flat)
            {
                if (!(cr is CompRepDescribes2DorLess))
                {
                    continue;
                }

                CompRepDescribes2DorLess surf_rep = cr as CompRepDescribes2DorLess;
                if (surf_rep.Material_ID == _material_id)
                {
                    found.Add(surf_rep);
                }
            }

            return(found);
        }
Пример #2
0
        public CompRep AddCompRep(ComponentMessage _cmsg)
        {
            if (_cmsg == null)
            {
                return(null);
            }
            if (this.communcation_manager == null)
            {
                return(null);                                   // unable to communicate...
            }
            // check for duplicate COMPONENT representations
            CompRep same_comp_id = this.FindByCompId(_cmsg.CompID);

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

            // check for component representations with duplicate content -> take the one with the VALID COMPONENT ID
            CompRepInfo same_comp_content = this.FindSameStructureNoCompId(_cmsg);

            if (same_comp_content != null)
            {
                // just transfer the comp id
                same_comp_content.AdoptCompId(_cmsg);
                return(null);
            }

            // creates a representation of a component that has been here before and looks for the referenced geometry
            // OR...
            // creates a representation of a component that is here for the first time
            switch (_cmsg.GeomType)
            {
            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES:
                CompRepDescirbes created_D = new CompRepDescirbes(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_D);
                return(created_D);

            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES_3D:
                CompRepDescirbes3D created_D3d = new CompRepDescirbes3D(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_D3d);
                return(created_D3d);

            case InterProcCommunication.Specific.Relation2GeomType.DESCRIBES_2DorLESS:
                CompRepDescribes2DorLess created_D2d = new CompRepDescribes2DorLess(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_D2d);
                return(created_D2d);

            case InterProcCommunication.Specific.Relation2GeomType.GROUPS:
                return(null);

            case InterProcCommunication.Specific.Relation2GeomType.CONTAINED_IN:
                CompRepContainedIn created_CI = new CompRepContainedIn(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_CI);
                return(created_CI);

            case InterProcCommunication.Specific.Relation2GeomType.CONNECTS:
                CompRepConnects created_CO = new CompRepConnects(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_CO);
                return(created_CO);

            case InterProcCommunication.Specific.Relation2GeomType.ALIGNED_WITH:
                CompRepAlignedWith created_A = new CompRepAlignedWith(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_A);
                return(created_A);

            case InterProcCommunication.Specific.Relation2GeomType.NONE:
                // this is for the parent of a geometry containing component
                CompRepInfo created_N = new CompRepInfo(_cmsg, this.communcation_manager);
                this.AddCompRepToRecord(created_N);
                return(created_N);

            default:
                return(null);
            }
        }