Exemplo n.º 1
0
 public void ProcessReferenceCoordinateSystems(CyPhy.ComponentAssembly cyphyasm)
 {
     if (cyphyasm != null)
     {
         // [4] Find ReferenceCoordinateComponents
         foreach (CyPhy.ReferenceCoordinateSystem refCoord in cyphyasm.Children.ReferenceCoordinateSystemCollection)
         {
             ReferenceCoordinateSystemTraversal traverser = new ReferenceCoordinateSystemTraversal(refCoord);
             referenceCoordComponents.AddRange(traverser.referenceCoordComponents);
         }
     }
 }
Exemplo n.º 2
0
        private void ProcessComponents(List<CyPhy.Component> regular, List<CyPhy.Component> size2fitcomponents, CyPhy.ComponentAssembly cyphyasm)
        {
            if (regular.Count < 1)
            {
                if (!MetaLink)
                {
                    if (cyphyasm != null)
                        Logger.Instance.AddLogMessage("Assembly do not contain components with Creo CADModels [" + cyphyasm.Path + "]", Severity.Error);
                    else
                        Logger.Instance.AddLogMessage("CAD TestBench does not contain any valid TIPs!", Severity.Error);
                }
                return;
            }

            // [2] Create CADComponent, size2fit, and edges
            foreach (var item in regular)
            {
                DataRep.CADComponent component = new DataRep.CADComponent(item, ProjectDirectory: this.ProjectDirectory);
                this.regularComponents[item.ID] = component;

            }

            foreach (var item in size2fitcomponents)
            {
                DataRep.CADComponent component = new DataRep.CADComponent(item, ProjectDirectory: this.ProjectDirectory, size2fit: true);
                this.size2fitComponents[item.ID] = component;
            }

            foreach (var component in regularComponents)
            {
                foreach (var structintf in component.Value.StructuralInterfaceNodes)
                {
                    if (structintf.Value.Joint != null)
                    {
                        structintf.Value.Joint.FindTopLevelPort(cyphyasm);
                    }
                }
            }

            // [3] Create Edges
            foreach (KeyValuePair<string, DataRep.CADComponent> item in size2fitComponents)
            {
                CreateEdges(item.Value, cyphyasm, true);
            }

            foreach (KeyValuePair<string, DataRep.CADComponent> item in regularComponents)
            {
                CreateEdges(item.Value, cyphyasm);
            }

            if (cyphyasm != null)
            {
                // [4] Find ReferenceCoordinateComponents
                foreach (CyPhy.ReferenceCoordinateSystem refCoord in cyphyasm.Children.ReferenceCoordinateSystemCollection)
                {
                    ReferenceCoordinateSystemTraversal traverser = new ReferenceCoordinateSystemTraversal(refCoord);
                    referenceCoordComponents.AddRange(traverser.referenceCoordComponents);
                }

            }

            if (referenceCoordComponents.Count == 0)
            {
                Logger.Instance.AddLogMessage("No referencecoordinatesystem was found. Root component of assembly will be selected arbitrarily.", Severity.Warning);
            }

            // [5] Print Assembly
            PrintAssembly();
        }