Example #1
0
 /// <summary>
 /// Initialises the collection with the items in PowerMILL.
 /// </summary>
 internal void Initialise()
 {
     foreach (string name in ReadToolpaths())
     {
         Add(PMToolpathEntityFactory.CreateEntity(_powerMILL, name));
     }
 }
Example #2
0
        /// <summary>
        /// Gets a list of all Entities not currently in a collection.
        /// </summary>
        /// <param name="type">Used if only want items of a specific type. If set to nothing then it will check all entities.</param>
        internal List <PMEntity> CreatedItems(Type type = null)
        {
            List <PMEntity> createdItemsList = new List <PMEntity>();

            // Read all the entities, if they are not in a list then add them to the list of CreatedItems
            if (type == null || ReferenceEquals(type, typeof(PMNCProgram)))
            {
                foreach (string name in _NCPrograms.ReadNCPrograms())
                {
                    if (_NCPrograms[name] == null)
                    {
                        createdItemsList.Add(new PMNCProgram(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMToolpath)))
            {
                foreach (string name in _toolpaths.ReadToolpaths())
                {
                    if (_toolpaths[name] == null)
                    {
                        createdItemsList.Add(PMToolpathEntityFactory.CreateEntity(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMTool)))
            {
                foreach (string name in _tools.ReadTools())
                {
                    if (_tools[name] == null)
                    {
                        createdItemsList.Add(PMToolEntityFactory.CreateEntity(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMBoundary)))
            {
                foreach (string name in _boundaries.ReadBoundaries())
                {
                    if (_boundaries[name] == null)
                    {
                        createdItemsList.Add(PMBoundaryEntityFactory.CreateEntity(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMPattern)))
            {
                foreach (string name in _patterns.ReadPatterns())
                {
                    if (_patterns[name] == null)
                    {
                        createdItemsList.Add(new PMPattern(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMFeatureSet)))
            {
                foreach (string name in _featureSets.ReadFeatureSets())
                {
                    if (_featureSets[name] == null)
                    {
                        createdItemsList.Add(new PMFeatureSet(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMWorkplane)))
            {
                foreach (string name in _workplanes.ReadWorkplanes())
                {
                    if (_workplanes[name] == null)
                    {
                        createdItemsList.Add(new PMWorkplane(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMLevelOrSet)))
            {
                foreach (string name in _levelsOrSets.ReadLevelsAndSets())
                {
                    if (_levelsOrSets[name] == null)
                    {
                        createdItemsList.Add(new PMLevelOrSet(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMModel)))
            {
                foreach (string name in _models.ReadModels())
                {
                    if (_models[name] == null)
                    {
                        createdItemsList.Add(new PMModel(_powerMILL, name));
                    }
                }
            }
            if (type == null || ReferenceEquals(type, typeof(PMStockModel)))
            {
                foreach (string name in _stockModels.ReadStockModels())
                {
                    if (_stockModels[name] == null)
                    {
                        createdItemsList.Add(new PMStockModel(_powerMILL, name));
                    }
                }
            }
            return(createdItemsList);
        }