Ejemplo n.º 1
0
    /// <summary>
    /// Selects all components on the current schematic page.
    /// </summary>
    void SelectAll()
    {
        try
        {
            ISch_Document        SchDoc = SchServer.GetCurrentSchDocument();
            ISch_Iterator        SchIterator;
            ISch_GraphicalObject Component;

            if (SchDoc == null)
            {
                return;
            }
            //Iterate theough all objects on the schematic.
            SchIterator = SchDoc.SchIterator_Create();
            SchIterator.AddFilter_ObjectSet(new SCH.TObjectSet(AllObjects()));
            //Select all objects on the current page.
            Component = SchIterator.FirstSchObject() as ISch_GraphicalObject;
            while (Component != null)
            {
                Component.SetState_Selection(true);
                Component = SchIterator.NextSchObject() as ISch_GraphicalObject;
            }
        }
        catch (Exception ex)
        {
            ErrorMail.LogError("Error in " + System.Reflection.MethodBase.GetCurrentMethod().Name + ".", ex);
            return;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Get the height parameter value from all schematic components.
    /// </summary>
    /// <param name="argHeights">Reference to the dict storing report info.</param>
    void GetParamHeights(ref Dictionary <string, Heights> argHeights)
    {
        try
        {
            ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
            if (schServer == null)
            {
                return;
            }
            ISch_Document currentSheet = schServer.GetCurrentSchDocument();

            SCH.TObjectSet objectSet = new SCH.TObjectSet();
            objectSet.Add(SCH.TObjectId.eSchComponent);
            ISch_Iterator iterator = currentSheet.SchIterator_Create();
            iterator.AddFilter_ObjectSet(objectSet);

            ISch_Component schComponent = iterator.FirstSchObject() as ISch_Component;
            while (schComponent != null)
            {
                ObtainParamHeight(ref argHeights, schComponent);
                if (argHeights == null)
                {
                    return;
                }
                schComponent = iterator.NextSchObject() as ISch_Component;
            }
            return;
        }
        catch (Exception ex)
        {
            ErrorMail.LogError("Error in " + System.Reflection.MethodBase.GetCurrentMethod().Name + ".", ex);
            return;
        }
    }
Ejemplo n.º 3
0
    private void CleanUpSamtecSymbols()
    {
        ISch_ServerInterface SchServer = SCH.GlobalVars.SchServer;

        if (SchServer == null)
        {
            return;
        }

        ISch_Lib currentLib = SchServer.GetCurrentSchDocument() as ISch_Lib;

        if (currentLib == null)
        {
            return;
        }

        if (currentLib.LibIsEmpty())
        {
            DXP.Utils.ShowWarning("SCH library is empty");
            return;
        }

        ISch_Iterator LibIterator = currentLib.SchLibIterator_Create();

        LibIterator.AddFilter_ObjectSet(new SCH.TObjectSet(SCH.TObjectId.eSchComponent));

        ISch_Component LibCmp = LibIterator.FirstSchObject() as ISch_Component;

        while (LibCmp != null)
        {
            LibCmp.SetState_ComponentDescription("");

            ISch_Iterator       ObjIterator = LibCmp.SchIterator_Create();
            ISch_BasicContainer SchObj      = ObjIterator.FirstSchObject();
            while (SchObj != null)
            {
                switch (SchObj.GetState_ObjectId())
                {
                case SCH.TObjectId.ePin: CleanUpPin(SchObj as ISch_Pin); break;

                case SCH.TObjectId.eParameter: RemoveParameter(SchObj as ISch_Parameter, LibCmp); break;

                case SCH.TObjectId.eImplementation: RemoveLinkedModel(SchObj as ISch_Implementation, LibCmp); break;
                }

                SchObj = ObjIterator.NextSchObject();
            }

            LibCmp.SchIterator_Destroy(ref ObjIterator);

            LibCmp = LibIterator.NextSchObject() as ISch_Component;
        }

        currentLib.SchIterator_Destroy(ref LibIterator);
    }
Ejemplo n.º 4
0
    private void RemoveSymbolVaultLink()
    {
        OpenFileDialog openDialog = InitFileOpenDialog("SCHLIB");

        if (openDialog == null)
        {
            return;
        }

        IClient client = DXP.GlobalVars.Client;

        string[] SchFiles = openDialog.FileNames;
        foreach (string SchFile in SchFiles)
        {
            IServerDocument SchDocument = client.OpenDocument("SCHLIB", SchFile);
            if (SchDocument == null)
            {
                return;
            }

            client.ShowDocumentDontFocus(SchDocument);
            ISch_ServerInterface SchServer  = SCH.GlobalVars.SchServer;
            ISch_Lib             currentLib = SchServer.GetCurrentSchDocument() as ISch_Lib;

            currentLib.SetState_FolderGUID("");
            currentLib.SetState_LifeCycleDefinitionGUID("");
            currentLib.SetState_ReleaseVaultGUID("");
            currentLib.SetState_RevisionNamingSchemeGUID("");

            if (currentLib.LibIsEmpty())
            {
                DXP.Utils.ShowWarning("SCH library is empty");
                return;
            }

            ISch_Iterator LibIterator = currentLib.SchLibIterator_Create();
            LibIterator.AddFilter_ObjectSet(new SCH.TObjectSet(SCH.TObjectId.eSchComponent));

            ISch_Component LibCmp = LibIterator.FirstSchObject() as ISch_Component;
            while (LibCmp != null)
            {
                LibCmp.SetState_ComponentDescription("");
                LibCmp.SetState_SymbolItemGUID("");
                LibCmp.SetState_SymbolRevisionGUID("");
                LibCmp.SetState_SymbolVaultGUID("");
                LibCmp.SetState_VaultGUID("");


                LibCmp = LibIterator.NextSchObject() as ISch_Component;
            }

            currentLib.SchIterator_Destroy(ref LibIterator);
        }
    }
Ejemplo n.º 5
0
    private void CleanUpSamtecSymbols()
    {
        OpenFileDialog openDialog = InitFileOpenDialog("SCHLIB");

        if (openDialog == null)
        {
            return;
        }

        IClient client = DXP.GlobalVars.Client;

        string[] SchFiles = openDialog.FileNames;
        foreach (string SchFile in SchFiles)
        {
            IServerDocument SchDocument = client.OpenDocument("SCHLIB", SchFile);
            if (SchDocument == null)
            {
                return;
            }

            client.ShowDocumentDontFocus(SchDocument);
            ISch_ServerInterface SchServer  = SCH.GlobalVars.SchServer;
            ISch_Lib             currentLib = SchServer.GetCurrentSchDocument() as ISch_Lib;

            if (currentLib.LibIsEmpty())
            {
                DXP.Utils.ShowWarning("SCH library is empty");
                return;
            }

            ISch_Iterator LibIterator = currentLib.SchLibIterator_Create();
            LibIterator.AddFilter_ObjectSet(new SCH.TObjectSet(SCH.TObjectId.eSchComponent));

            ISch_Component LibCmp = LibIterator.FirstSchObject() as ISch_Component;
            while (LibCmp != null)
            {
                LibCmp.SetState_ComponentDescription("");

                ISch_Iterator       ObjIterator = LibCmp.SchIterator_Create();
                ISch_BasicContainer SchObj      = ObjIterator.FirstSchObject();
                while (SchObj != null)
                {
                    switch (SchObj.GetState_ObjectId())
                    {
                    case SCH.TObjectId.ePin: CleanUpPin(SchObj as ISch_Pin); break;

                    case SCH.TObjectId.eParameter: RemoveParameter(SchObj as ISch_Parameter, LibCmp); break;

                    case SCH.TObjectId.eImplementation: RemoveLinkedModel(SchObj as ISch_Implementation, LibCmp); break;
                    }

                    SchObj = ObjIterator.NextSchObject();
                }

                LibCmp.SchIterator_Destroy(ref ObjIterator);

                LibCmp = LibIterator.NextSchObject() as ISch_Component;
            }

            currentLib.SchIterator_Destroy(ref LibIterator);
        }
    }