Exemplo n.º 1
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);
    }
Exemplo n.º 2
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);
        }
    }
Exemplo n.º 3
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);
        }
    }