Beispiel #1
0
        /// <summary>
        /// Selectionne le composant de 1er niveau
        /// </summary>
        /// <param name="SelBox"></param>
        /// <param name="selection"></param>
        /// <param name="selType"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        protected static Boolean SelectionnerComposant1erNvx(Object SelBox, Object selection, int selType, String itemText)
        {
            Component2 Cp = selection as Component2;

            if (Cp.IsRef())
            {
                List <Component2> Liste = Cp.eListeComposantParent();

                if (Liste.Count == 0)
                {
                    return(true);
                }

                CtrlSelectionBox box = SelBox as CtrlSelectionBox;

                Cp = Liste.Last();

                if (App.ModelDoc2.eSelect_RecupererListeComposants(box.Marque).Contains(Cp))
                {
                    Cp.eDeSelectById(App.ModelDoc2);
                }
                else
                {
                    App.ModelDoc2.eSelectMulti(Cp, box.Marque, true);
                }
            }

            return(false);
        }
Beispiel #2
0
        protected void PreSelection()
        {
            try
            {
                MdlBase.ClearSelection2(true);

                SelectionMgr SelMgr = MdlBase.SelectionManager;
                Component2   Piece  = MdlBase.eRecChercherComposant(c => { return(Regex.IsMatch(c.Name2, _pPieceBase.GetValeur <String>()) &&
                                                                                  !c.IsSuppressed()); });
                Component2 Percage  = MdlBase.eRecChercherComposant(c => { return(Regex.IsMatch(c.Name2, _pPercage.GetValeur <String>()) &&
                                                                                  !c.IsSuppressed()); });

                if (Piece.IsRef())
                {
                    MdlBase.eSelectMulti(Piece, _Select_Percage.Marque, false);
                }

                if (Percage.IsRef())
                {
                    MdlBase.eSelectMulti(Percage, _Select_Percage.Marque, false);
                }

                _Select_Base.Focus = true;
            }
            catch (Exception e)
            { this.LogMethode(new Object[] { e }); }
        }
            protected void PreSelection()
            {
                try
                {
                    MdlBase.ClearSelection2(true);

                    Component2 Marche = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, pMarche.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    });

                    if (Marche.IsRef())
                    {
                        SelectFace(_Select_F_Dessus, Marche, pFaceDessus);
                        SelectFace(_Select_F_Devant, Marche, pFaceDevant);
                    }

                    Component2 ContreMarche = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, pEsquisse.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    });

                    if (ContreMarche.IsRef())
                    {
                        SelectEsquisse(_Select_ContreMarche_Esquisse, ContreMarche, pNomEsquisse);
                    }
                }
                catch (Exception e)
                { this.LogMethode(new Object[] { e }); }
            }
        protected void SvgNomComposant(Object SelBox, Parametre Param)
        {
            Component2 Cp = MdlBase.eSelect_RecupererComposant(1, ((CtrlSelectionBox)SelBox).Marque);

            if (Cp.IsRef() && _CheckBox_EnregistrerSelection.IsChecked)
            {
                Param.SetValeur(Cp.eNomSansExt());
            }
        }
Beispiel #5
0
        /// <summary>
        /// Selectionne tous les composants parent jusqu'au composant de 1er niveau
        /// </summary>
        /// <param name="SelBox"></param>
        /// <param name="selection"></param>
        /// <param name="selType"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        protected static Boolean SelectionnerComposantsParent(Object SelBox, Object selection, int selType, String itemText)
        {
            Component2 Cp = selection as Component2;

            if (Cp.IsRef())
            {
                List <Component2> Liste = Cp.eListeComposantParent();
                Liste.Insert(0, Cp);

                App.ModelDoc2.eSelectMulti(Liste, ((CtrlSelectionBox)SelBox).Marque, true);
            }

            return(false);
        }
        protected Boolean FiltrePlan(CtrlSelectionBox SelBox, Object selection, int selType, Parametre param)
        {
            if (selType == (int)swSelectType_e.swSelDATUMPLANES)
            {
                return(true);
            }

            Component2 Cp = selection as Component2;

            if (Cp.IsRef())
            {
                List <Component2> Liste = Cp.eListeComposantParent();
                Liste.Insert(0, Cp);
                SelectPlan(SelBox, Liste.Last(), param);
            }

            return(false);
        }
Beispiel #7
0
            protected void PreSelection()
            {
                try
                {
                    MdlBase.ClearSelection2(true);

                    Component2 Marche = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, pMarche.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    });

                    if (Marche.IsRef())
                    {
                        SelectFace(_Select_F_Dessus, Marche, pFaceDessus);
                        SelectFace(_Select_F_Devant, Marche, pFaceDevant);
                    }

                    Component2 PlatineG = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, pPlatineG.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    });

                    if (PlatineG.IsRef())
                    {
                        SelectPlan(_Select_PlatineG, PlatineG, pPlanContrainte);
                    }


                    Component2 PlatineD = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, pPlatineD.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    });

                    if (PlatineD.IsRef())
                    {
                        SelectPlan(_Select_PlatineD, PlatineD, pPlanContrainte);
                    }
                }
                catch (Exception e)
                { this.LogMethode(new Object[] { e }); }
            }
Beispiel #8
0
        /// <summary>
        /// Selectionne seulement un assemblage
        /// </summary>
        /// <param name="SelBox"></param>
        /// <param name="selection"></param>
        /// <param name="selType"></param>
        /// <param name="itemText"></param>
        /// <returns></returns>
        protected static Boolean SelectionnerAssemblage(Object SelBox, Object selection, int selType, String itemText)
        {
            Component2 Cp = selection as Component2;

            if (Cp.TypeDoc() == eTypeDoc.Assemblage)
            {
                if (selType == (int)swSelectType_e.swSelCOMPONENTS)
                {
                    return(true);
                }

                if (Cp.IsRef())
                {
                    App.ModelDoc2.eSelectMulti(Cp, ((CtrlSelectionBox)SelBox).Marque, true);
                }
            }

            return(false);
        }
        protected Boolean FiltreEsquisse(CtrlSelectionBox SelBox, Object selection, int selType, Parametre param)
        {
            if (selType == (int)swSelectType_e.swSelSKETCHES)
            {
                return(true);
            }

            Component2 Cp = selection as Component2;

            if (Cp.IsRef() && !SelectEsquisse(SelBox, Cp, param))
            {
                foreach (var C in Cp.eRecListeComposant())
                {
                    if (SelectEsquisse(SelBox, C, param))
                    {
                        break;
                    }
                }
            }

            return(false);
        }
            protected void PreSelection()
            {
                try
                {
                    MdlBase.ClearSelection2(true);

                    Component2 Marche = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, _pMarche.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    },
                                                                      c => { return(false); }
                                                                      );

                    if (Marche.IsRef())
                    {
                        MdlBase.eSelectMulti(Marche, _Select_Marche.Marque);
                    }

                    Component2 PieceRepet = MdlBase.eRecChercherComposant(c =>
                    {
                        return(Regex.IsMatch(c.Name2, _pPieceRepet.GetValeur <String>()) &&
                               !c.IsSuppressed());
                    });

                    if (PieceRepet.IsRef())
                    {
                        Feature F = PieceRepet.eChercherFonction(f => { return(Regex.IsMatch(f.Name, _pFonctionRepet.GetValeur <String>())); }, false);
                        if (F.IsRef())
                        {
                            SelectFonctionRepetition(_Select_FonctionRepet, F);
                        }
                    }
                }
                catch (Exception e)
                { this.LogMethode(new Object[] { e }); }
            }
Beispiel #11
0
            private void Run(Face2 dessus, Face2 devant, Feature gPlan, Feature dPlan, Component2 pltG, Component2 pltD)
            {
                if ((dessus == null) || (devant == null))
                {
                    this.LogMethode(new String[] { "Une reference à un objet a été perdue" });
                    return;
                }
                try
                {
                    Edge E_Face = dessus.eListeDesArretesCommunes(devant)[0];

                    List <Edge> ListeArrete = dessus.eListeDesArretesContigues(E_Face);

                    // On assigne les cotes de façon arbitraire pour eviter une assignation suplémentaire
                    Edge E_Gauche = ListeArrete[0];
                    Edge E_Droit  = ListeArrete[1];

                    // Création des segements
                    gSegment S1 = new gSegment(E_Gauche);
                    gSegment Sf = new gSegment(E_Face);

                    // Orientation des segements
                    S1.OrienterDe(Sf);
                    Sf.OrienterVers(S1);

                    gVecteur Normal = new gVecteur((Double[])dessus.Normal);

                    // Verification du sens de rotation et modification des cotes si nécessaire
                    if (Sf.Vecteur.RotationTrigo(S1.Vecteur, Normal))
                    {
                        E_Gauche = ListeArrete[1];
                        E_Droit  = ListeArrete[0];
                    }
                    List <Face2> L = null;

                    L = E_Gauche.eDeuxFacesAdjacentes();
                    L.Remove(dessus);
                    Face2 FaceGauche = L[0];

                    L = E_Droit.eDeuxFacesAdjacentes();
                    L.Remove(dessus);
                    Face2 FaceDroite = L[0];

                    if (pltG.IsRef())
                    {
                        if (pltG.GetConstrainedStatus() == (int)swConstrainedStatus_e.swUnderConstrained)
                        {
                            Contraindre(gPlan, FaceGauche);
                        }
                    }

                    if (pltD.IsRef())
                    {
                        if (pltD.GetConstrainedStatus() == (int)swConstrainedStatus_e.swUnderConstrained)
                        {
                            Contraindre(dPlan, FaceDroite);
                        }
                    }
                }
                catch (Exception e)
                {
                    this.LogErreur(new Object[] { e });
                }
            }
Beispiel #12
0
        private void Appliquer(List <Param> ListeParam, action_e action)
        {
            if (!FichierCharger)
            {
                return;
            }

            Dictionary <String, Component2> DicCp = new Dictionary <String, Component2>();

            Func <Component2, String> Cle = delegate(Component2 cp)
            {
                String cle = cp.GetPathName();
                if (radioMdl.Checked)
                {
                    return(cle);
                }

                return(cle + "_" + cp.eNomConfiguration());
            };

            Action <Component2, Param> AppliquerProp = delegate(Component2 cp, Param p)
            {
                ModelDoc2 mdl = cp.eModelDoc2();
                String    cle = p.Nom, val = p.Resultat;

                String cfg = "";
                if (radioCfg.Checked)
                {
                    cfg = cp.eNomConfiguration();
                }

                if (mdl.ePropExiste(cle, cfg))
                {
                    mdl.eGestProp(cfg).ePropSet(cle, val);
                    return;
                }

                if (action == action_e.Importer)
                {
                    mdl.eGestProp(cfg).ePropAdd(cle, val);
                }
            };

            Component2 CpCourant = MdlActif.eComposantRacine(false);
            Component2 CpEdited  = null;

            if (MdlActif.TypeDoc() == eTypeDoc.Assemblage)
            {
                CpEdited = MdlActif.eAssemblyDoc().GetEditTargetComponent();
            }

            if (CpEdited.IsRef() && (CpCourant.GetPathName() != CpEdited.GetPathName()))
            {
                DicCp.Add(Cle(CpEdited), CpEdited);
            }
            else
            {
                DicCp.Add("Courant", CpCourant);
            }

            // Si c'est un assemblage, on liste les composants
            if (radioTtModeles.Checked && (MdlActif.TypeDoc() == eTypeDoc.Assemblage))
            {
                MdlActif.eRecParcourirComposants(
                    c =>
                {
                    String cle = Cle(c);
                    if (!DicCp.ContainsKey(cle) && c.eEstDansLeDossier(MdlActif) && !c.IsHidden(true))
                    {
                        DicCp.Add(cle, c);
                    }

                    return(false);
                },
                    null
                    );
            }

            try
            {
                foreach (Component2 cp in DicCp.Values)
                {
                    foreach (Param k in ListeParam)
                    {
                        AppliquerProp(cp, k);
                    }
                }
            }
            catch (Exception ex)
            { this.LogMethode(new Object[] { ex }); }
        }
Beispiel #13
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 });
                }
            }