Beispiel #1
0
    /// <summary>
    /// Moves the all mechanical objects in embeded components to their new layers.
    /// </summary>
    /// <param name="EmbededResistors">List of components to be processed.</param>
    /// <param name="UsedLayers">List of used layers</param>
    /// <param name="LayerCounts">
    /// List of layers used that has been updated by the user.
    /// Allows for the user to disable specific layers to be modified.
    /// </param>
    void MoveMechLayers(List <IPCB_Component> EmbededResistors, List <TV6_Layer> UsedLayers, SortedDictionary <string, int> LayerCounts)
    {
        DXP.Utils.PercentInit("Updating Embeded Components", EmbededResistors.Count);

        IPCB_GroupIterator CompIterator;
        IPCB_Primitive     CompItem;
        IPCB_Component     Component;

        //Step through each embeded component
        for (int i = 0; i <= EmbededResistors.Count - 1; i++)
        {
            Component = EmbededResistors[i];
            //Iterate through all objects of the current component.
            CompIterator = Component.GroupIterator_Create();
            CompIterator.AddFilter_LayerSet_2(PCBConstant.V7MechanicalLayersSet);
            CompItem = CompIterator.FirstPCBObject();

            while (CompItem != null)
            {
                //Check if object is on mech layer.
                if (new V7_Layer(CompItem.GetState_V7Layer()).IsMechanicalLayer() && LayerCounts.ContainsKey(EDP.Utils.LayerToString(new V7_Layer(Component.GetState_Layer()))))
                {
                    //Move object to its new respective mech layer.
                    CompItem.BeginModify();
                    CompItem.SetState_V7Layer(V7_Layer.MechanicalLayer((ulong)UsedLayers.IndexOf(Component.GetState_Layer()) + 19));
                    CompItem.EndModify();
                }
                CompItem = CompIterator.NextPCBObject();
            }
            DXP.Utils.PercentUpdate();
        }
        DXP.Utils.PercentFinish();
    }