Exemplo n.º 1
0
            protected override void Command()
            {
                try
                {
                    _NomConfigCourante = MdlBase.eNomConfigActive();

                    if (SurTouteLesConfigs)
                    {
                        var pidF_Dessus  = new SwObjectPID <Face2>(F_Dessus, MdlBase);
                        var pidF_Devant  = new SwObjectPID <Face2>(F_Devant, MdlBase);
                        var pidPltG_Plan = new SwObjectPID <Feature>(PltG_Plan, MdlBase);
                        var pidPltD_Plan = new SwObjectPID <Feature>(PltD_Plan, MdlBase);
                        var pidPltG      = new SwObjectPID <Component2>(PltG, MdlBase);
                        var pidPltD      = new SwObjectPID <Component2>(PltD, MdlBase);

                        List <String> ListeNomsConfig = MdlBase.eListeNomConfiguration(eTypeConfig.DeBase);

                        foreach (String NomConfig in ListeNomsConfig)
                        {
                            MdlBase.ShowConfiguration2(NomConfig);
                            MdlBase.EditRebuild3();

                            //pidF_Dessus.Maj(ref F_Dessus);
                            //pidF_Devant.Maj(ref F_Devant);
                            //pidPltG_Plan.Maj(ref PltG_Plan);
                            //pidPltD_Plan.Maj(ref PltD_Plan);
                            //pidPltG.Maj(ref PltG);
                            //pidPltD.Maj(ref PltD);

                            pidF_Dessus.Maj();
                            pidF_Devant.Maj();
                            pidPltG_Plan.Maj();
                            pidPltD_Plan.Maj();
                            pidPltG.Maj();
                            pidPltD.Maj();

                            Run(F_Dessus, F_Devant, PltG_Plan, PltD_Plan, PltG, PltD);
                        }

                        MdlBase.ShowConfiguration2(_NomConfigCourante);
                    }
                    else
                    {
                        Run(F_Dessus, F_Devant, PltG_Plan, PltD_Plan, PltG, PltD);
                    }

                    MdlBase.EditRebuild3();
                }
                catch (Exception e)
                {
                    this.LogErreur(new Object[] { e });
                }
            }
Exemplo n.º 2
0
            protected override void Command()
            {
                try
                {
                    _NomConfigCourante = MdlBase.eNomConfigActive();

                    if (SurTouteLesConfigs)
                    {
                        var pidF_Dessus = new SwObjectPID <Face2>(F_Dessus, MdlBase);
                        var pidF_Devant = new SwObjectPID <Face2>(F_Devant, MdlBase);
                        var pidContreMarche_Esquisse_Comp     = new SwObjectPID <Component2>(ContreMarche_Esquisse_Comp, MdlBase);
                        var pidContreMarche_Esquisse_Fonction = new SwObjectPID <Feature>(ContreMarche_Esquisse_Fonction, MdlBase);

                        List <String> ListeNomsConfig = MdlBase.eListeNomConfiguration(eTypeConfig.DeBase);

                        foreach (String NomConfig in ListeNomsConfig)
                        {
                            MdlBase.ShowConfiguration2(NomConfig);
                            MdlBase.EditRebuild3();

                            pidF_Dessus.Maj(ref F_Dessus);
                            pidF_Devant.Maj(ref F_Devant);
                            pidContreMarche_Esquisse_Comp.Maj(ref ContreMarche_Esquisse_Comp);
                            pidContreMarche_Esquisse_Fonction.Maj(ref ContreMarche_Esquisse_Fonction);

                            Run(F_Dessus, F_Devant, ContreMarche_Esquisse_Comp, ContreMarche_Esquisse_Fonction);
                        }

                        MdlBase.ShowConfiguration2(_NomConfigCourante);
                    }
                    else
                    {
                        Run(F_Dessus, F_Devant, ContreMarche_Esquisse_Comp, ContreMarche_Esquisse_Fonction);
                    }

                    MdlBase.EditRebuild3();
                }
                catch (Exception e)
                {
                    this.LogErreur(new Object[] { e });
                }
            }
Exemplo n.º 3
0
            protected override void Command()
            {
                try
                {
                    _NomConfigCourante = MdlBase.eNomConfigActive();

                    if (SurTouteLesConfigs)
                    {
                        var pidF_Dessus             = new SwObjectPID <Face2>(F_Dessus, MdlBase);
                        var pidMarche               = new SwObjectPID <Component2>(Marche, MdlBase);
                        var pidPltG_Contrainte_Comp = new SwObjectPID <Component2>(PltG_Contrainte_Comp, MdlBase);
                        var pidPltD_Contrainte_Comp = new SwObjectPID <Component2>(PltD_Contrainte_Comp, MdlBase);
                        var pidPltG_Contrainte_Plan = new SwObjectPID <Feature>(PltG_Contrainte_Plan, MdlBase);
                        var pidPltD_Contrainte_Plan = new SwObjectPID <Feature>(PltD_Contrainte_Plan, MdlBase);

                        var pidPltG_Esquisse_Comp     = new SwObjectPID <Component2>(PltG_Esquisse_Comp, MdlBase);
                        var pidPltD_Esquisse_Comp     = new SwObjectPID <Component2>(PltD_Esquisse_Comp, MdlBase);
                        var pidPltG_Esquisse_Fonction = new SwObjectPID <Feature>(PltG_Esquisse_Fonction, MdlBase);
                        var pidPltD_Esquisse_Fonction = new SwObjectPID <Feature>(PltD_Esquisse_Fonction, MdlBase);

                        List <String> ListeNomsConfig = MdlBase.eListeNomConfiguration(eTypeConfig.DeBase);

                        String NomMarche = Marche.eNomSansExt();
                        String NomPltG   = "";
                        if (PltG_Contrainte_Comp.IsRef())
                        {
                            NomPltG = PltG_Contrainte_Comp.eNomSansExt();
                        }

                        String NomPltD = "";
                        if (PltD_Contrainte_Comp.IsRef())
                        {
                            NomPltD = PltD_Contrainte_Comp.eNomSansExt();
                        }

                        Log.Message(NomPltG);
                        Log.Message(NomPltD);

                        foreach (String NomConfig in ListeNomsConfig)
                        {
                            MdlBase.ShowConfiguration2(NomConfig);
                            MdlBase.EditRebuild3();

                            pidF_Dessus.Maj(ref F_Dessus);
                            pidMarche.Maj(ref Marche);
                            pidPltG_Contrainte_Comp.Maj(ref PltG_Contrainte_Comp);
                            pidPltD_Contrainte_Comp.Maj(ref PltD_Contrainte_Comp);
                            pidPltG_Contrainte_Plan.Maj(ref PltG_Contrainte_Plan);
                            pidPltD_Contrainte_Plan.Maj(ref PltD_Contrainte_Plan);

                            pidPltG_Esquisse_Comp.Maj(ref PltG_Esquisse_Comp);
                            pidPltD_Esquisse_Comp.Maj(ref PltD_Esquisse_Comp);
                            pidPltG_Esquisse_Fonction.Maj(ref PltG_Esquisse_Fonction);
                            pidPltD_Esquisse_Fonction.Maj(ref PltD_Esquisse_Fonction);

                            if (PltG_Contrainte_Comp.IsRef())
                            {
                                Run(MdlBase, Marche, PltG_Contrainte_Comp, PltG_Contrainte_Plan, F_Dessus, NomConfig, PltG_Esquisse_Fonction);
                            }

                            pidF_Dessus.Maj(ref F_Dessus);
                            pidMarche.Maj(ref Marche);
                            pidPltG_Contrainte_Comp.Maj(ref PltG_Contrainte_Comp);
                            pidPltD_Contrainte_Comp.Maj(ref PltD_Contrainte_Comp);
                            pidPltG_Contrainte_Plan.Maj(ref PltG_Contrainte_Plan);
                            pidPltD_Contrainte_Plan.Maj(ref PltD_Contrainte_Plan);

                            pidPltG_Esquisse_Comp.Maj(ref PltG_Esquisse_Comp);
                            pidPltD_Esquisse_Comp.Maj(ref PltD_Esquisse_Comp);
                            pidPltG_Esquisse_Fonction.Maj(ref PltG_Esquisse_Fonction);
                            pidPltD_Esquisse_Fonction.Maj(ref PltD_Esquisse_Fonction);

                            if (PltD_Contrainte_Comp.IsRef())
                            {
                                Run(MdlBase, Marche, PltD_Contrainte_Comp, PltD_Contrainte_Plan, F_Dessus, NomConfig, PltD_Esquisse_Fonction);
                            }

                            MdlBase.EditRebuild3();
                        }
                    }
                    else
                    {
                        if (PltG_Contrainte_Comp.IsRef())
                        {
                            Run(MdlBase, Marche, PltG_Contrainte_Comp, PltG_Contrainte_Plan, F_Dessus, _NomConfigCourante, PltG_Esquisse_Fonction);
                        }

                        if (PltD_Contrainte_Comp.IsRef())
                        {
                            Run(MdlBase, Marche, PltD_Contrainte_Comp, PltD_Contrainte_Plan, F_Dessus, _NomConfigCourante, PltD_Esquisse_Fonction);
                        }
                    }

                    MdlBase.ShowConfiguration2(_NomConfigCourante);

                    MdlBase.EditRebuild3();
                }
                catch (Exception e)
                {
                    this.LogErreur(new Object[] { e });
                }
            }
Exemplo n.º 4
0
        protected override void Command()
        {
            try
            {
                int NbDvp = 0;

                var dic = MdlBase.ListerComposants(false);

                int MdlPct = 0;
                foreach (var mdl in dic.Keys)
                {
                    WindowLog.SautDeLigne();
                    WindowLog.EcrireF("[{1}/{2}] {0}", mdl.eNomSansExt(), ++MdlPct, dic.Count);

                    mdl.eActiver(swRebuildOnActivation_e.swRebuildActiveDoc);
                    var cfgActive = mdl.eNomConfigActive();

                    var ListeNomConfigs = dic[mdl];

                    if (ToutesLesConfigurations)
                    {
                        mdl.eParcourirConfiguration(
                            (String c) =>
                        {
                            if (c.eEstConfigPliee() && !ListeNomConfigs.ContainsKey(c))
                            {
                                ListeNomConfigs.Add(c, 1);
                            }

                            return(false);
                        }
                            );
                    }

                    if (MasquerEsquisses)
                    {
                        cmdMasquerEsquisses(mdl);
                    }

                    if (SupprimerLesAnciennesConfigs)
                    {
                        cmdSupprimerLesAnciennesConfigs(mdl);
                    }

                    if (!mdl.Extension.LinkedDisplayState)
                    {
                        mdl.Extension.LinkedDisplayState = true;

                        foreach (var c in mdl.eListeConfigs(eTypeConfig.Tous))
                        {
                            c.eRenommerEtatAffichage();
                        }
                    }

                    int CfgPct = 0;
                    foreach (var NomConfigPliee in ListeNomConfigs.Keys)
                    {
                        WindowLog.SautDeLigne();
                        WindowLog.EcrireF("  [{1}/{2}] Config : \"{0}\"", NomConfigPliee, ++CfgPct, ListeNomConfigs.Count);
                        mdl.ShowConfiguration2(NomConfigPliee);
                        mdl.EditRebuild3();

                        if (SupprimerFonctions)
                        {
                            cmdSupprimerFonctions(mdl, NomConfigPliee);
                        }

                        PartDoc Piece = mdl.ePartDoc();

                        var ListeDossier = Piece.eListePIDdesFonctionsDePiecesSoudees(
                            swD =>
                        {
                            BodyFolder dossier = swD.GetSpecificFeature2();
                            if (dossier.eEstExclu() || dossier.IsNull() || (dossier.GetBodyCount() == 0) || dossier.eTypeDeDossier() != eTypeCorps.Tole)
                            {
                                return(false);
                            }

                            return(true);
                        }
                            );

                        for (int noD = 0; noD < ListeDossier.Count; noD++)
                        {
                            var        f       = ListeDossier[noD];
                            BodyFolder dossier = f.GetSpecificFeature2();

                            var RefDossier = dossier.eProp(CONSTANTES.REF_DOSSIER);

                            Body2 Tole = dossier.eCorpsDeTolerie();

                            var pidTole = new SwObjectPID <Body2>(Tole, MdlBase);

                            String NomConfigDepliee = Sw.eNomConfigDepliee(NomConfigPliee, RefDossier);

                            WindowLog.EcrireF("    - [{1}/{2}] Dossier : \"{0}\" -> {3}", f.Name, noD + 1, ListeDossier.Count, NomConfigDepliee);

                            Configuration CfgDepliee = null;

                            if (ReconstuireLesConfigs)
                            {
                                CfgDepliee = MdlBase.GetConfigurationByName(NomConfigDepliee);
                            }

                            if (CfgDepliee.IsNull())
                            {
                                CfgDepliee = mdl.CreerConfigDepliee(NomConfigDepliee, NomConfigPliee);
                            }
                            else if (!ReconstuireLesConfigs)
                            {
                                continue;
                            }

                            if (CfgDepliee.IsNull())
                            {
                                WindowLog.Ecrire("       - Config non crée");
                                continue;
                            }

                            NbDvp++;

                            try
                            {
                                mdl.ShowConfiguration2(NomConfigDepliee);

                                // On ajoute le numero de la config parent aux propriétés de la configuration depliée
                                CfgDepliee.CustomPropertyManager.Add3(CONSTANTES.NO_CONFIG, (int)swCustomInfoType_e.swCustomInfoText, NomConfigPliee, (int)swCustomPropertyAddOption_e.swCustomPropertyDeleteAndAdd);

                                pidTole.Maj(ref Tole);

                                Tole.DeplierTole(mdl, NomConfigDepliee);
                            }
                            catch (Exception e)
                            {
                                DicErreur.Add(mdl.eNomSansExt() + " -> cfg : " + NomConfigPliee + " - No : " + RefDossier + " = " + NomConfigDepliee);
                                WindowLog.Ecrire("Erreur de depliage");
                                this.LogMethode(new Object[] { e });
                            }

                            try
                            {
                                mdl.ShowConfiguration2(NomConfigPliee);

                                pidTole.Maj(ref Tole);

                                Tole.PlierTole(mdl, NomConfigPliee);
                            }
                            catch (Exception e)
                            {
                                WindowLog.Ecrire("Erreur de repliage");
                                this.LogMethode(new Object[] { e });
                            }
                        }
                    }

                    mdl.ShowConfiguration2(cfgActive);
                    WindowLog.SautDeLigne();

                    mdl.eFermerSiDifferent(MdlBase);
                }

                if (DicErreur.Count > 0)
                {
                    WindowLog.SautDeLigne();

                    WindowLog.Ecrire("Liste des erreurs :");
                    foreach (var item in DicErreur)
                    {
                        WindowLog.Ecrire(" - " + item);
                    }

                    WindowLog.SautDeLigne();
                }
                else
                {
                    WindowLog.Ecrire("Pas d'erreur");
                }

                WindowLog.SautDeLigne();
                WindowLog.Ecrire("Resultat :");
                WindowLog.Ecrire("----------------");
                WindowLog.EcrireF("  {0} dvp crées", NbDvp);

                File.WriteAllText(Path.Combine(MdlBase.eDossier(), "Log_CreerConfigDvp.txt"), WindowLog.Resume);

                MdlBase.eActiver(swRebuildOnActivation_e.swRebuildActiveDoc);
                MdlBase.ShowConfiguration2(nomConfigBase);
                MdlBase.EditRebuild3();
            }
            catch (Exception e)
            {
                this.LogErreur(new Object[] { e });
            }
        }
Exemplo n.º 5
0
        protected override void Command()
        {
            try
            {
                AjouterPercage(CompPercage);

                if (SurTouteLesConfigs)
                {
                    _NomConfigCourante = _MdlBase.ConfigurationManager.ActiveConfiguration.Name;

                    var pidBase = new SwObjectPID <Component2>(CompBase, _MdlBase);
                    var pidFace = new SwObjectPID <Face2>(Face, _MdlBase);
                    var pidPlan = new SwObjectPID <Feature>(Plan, _MdlBase);

                    List <String> ListeNomsConfig = _MdlBase.eListeNomConfiguration(eTypeConfig.DeBase);

                    foreach (String NomConfig in ListeNomsConfig)
                    {
                        _MdlBase.ShowConfiguration2(NomConfig);
                        _MdlBase.EditRebuild3();

                        Configuration Conf = _MdlBase.GetConfigurationByName(NomConfig);
                        Conf.SuppressNewFeatures = true;
                        //Conf.eSetSupprimerNouvellesFonctions(true, MdlBase);
                    }

                    foreach (String NomConfig in ListeNomsConfig)
                    {
                        _NomConfigActive = NomConfig;
                        _MdlBase.ShowConfiguration2(NomConfig);
                        _MdlBase.EditRebuild3();

                        pidBase.Maj(ref CompBase);
                        pidFace.Maj(ref Face);
                        pidPlan.Maj(ref Plan);

                        Run(CompBase);
                    }

                    InsererDansUnDossier();

                    foreach (String NomConfig in ListeNomsConfig)
                    {
                        _NomConfigActive = NomConfig;
                        _MdlBase.ShowConfiguration2(NomConfig);
                        _MdlBase.EditRebuild3();

                        List <String> ListeComp = _DicConfigWithComp[NomConfig];
                        foreach (String NomComp in _ListePercage.Keys)
                        {
                            if (!ListeComp.Contains(NomComp))
                            {
                                _MdlBase.eSelectByIdComp(_ListePercage[NomComp]);
                                _AssBase.eModifierEtatComposant(swComponentSuppressionState_e.swComponentSuppressed);
                                _MdlBase.eEffacerSelection();
                            }
                        }
                    }

                    _MdlBase.ShowConfiguration2(_NomConfigCourante);
                }
                else
                {
                    Run(CompBase);
                    InsererDansUnDossier();
                }

                // On met les percages dans un dossier, c'est plus propre

                _MdlBase.EditRebuild3();
            }
            catch (Exception e)
            {
                this.LogErreur(new Object[] { e });
            }
        }