public void AjouterDossier(BodyFolder dossier, Component2 comp)
            {
                Body2 corps = dossier.ePremierCorps();

                if (corps.IsNull())
                {
                    return;
                }

                String BaseMateriau;
                String Materiau = corps.eGetMateriauCorpsOuComp(comp, out BaseMateriau);
                string Profil;

                if (corps.eTypeDeCorps() == eTypeCorps.Tole)
                {
                    Double Ep = corps.eEpaisseurCorpsOuDossier(dossier);
                    if (Ep == -1)
                    {
                        WindowLog.EcrireF("Pb d'epaisseur sur le corps {0}", corps.Name);
                        return;
                    }

                    Profil = "Ep " + Ep.ToString();
                }
                else if (dossier.ePropExiste(CONSTANTES.PROFIL_NOM))
                {
                    Profil = dossier.eProp(CONSTANTES.PROFIL_NOM);
                }
                else
                {
                    Profil = NomVolume;
                }

                Ajouter(BaseMateriau, Materiau, Profil, dossier, comp);
            }
Example #2
0
        private int Souris_MouseLBtnDownNotify(int X, int Y, int WParam)
        {
            try
            {
                var    typeSel           = MdlBase.eSelect_RecupererSwTypeObjet();
                var    typeCorps         = eTypeCorps.Autre;
                Body2  CorpsBase         = null;
                String MateriauCorpsBase = "";

                if (typeSel == swSelectType_e.swSelFACES)
                {
                    var f = MdlBase.eSelect_RecupererObjet <Face2>();
                    CorpsBase         = (Body2)f.GetBody();
                    MateriauCorpsBase = GetMateriauCorpsBase(CorpsBase, MdlBase.eSelect_RecupererComposant());
                    typeCorps         = CorpsBase.eTypeDeCorps();
                }

                if ((typeCorps == eTypeCorps.Barre) || (typeCorps == eTypeCorps.Tole))
                {
                    int Repere = 0;

                    String texteNote = String.Format("$PRPWLD:\"{0}\"", CONSTANTES.REF_DOSSIER);

                    Note       Note       = MdlBase.InsertNote(String.Format("$PRPWLD:\"{0}\"", CONSTANTES.REF_DOSSIER));
                    Annotation Annotation = Note.GetAnnotation();

                    Note.SetTextJustification((int)swTextJustification_e.swTextJustificationCenter);
                    Annotation.SetLeader3((int)swLeaderStyle_e.swNO_LEADER, (int)swLeaderSide_e.swLS_SMART, true, true, false, false);

                    Repere = Note.GetText().Replace(CONSTANTES.PREFIXE_REF_DOSSIER, "").eToInteger();

                    if (ListeCorps.ContainsKey(Repere))
                    {
                        var corps = ListeCorps[Repere];
                        Note.PropertyLinkedText = String.Format("$PRPWLD:\"{0}\" (x{1})", CONSTANTES.REF_DOSSIER, corps.Campagne.Last().Value);
                        ListeAnnotations.Add(Annotation);

                        WindowLog.Ecrire(Repere);
                    }
                    else
                    {
                        MdlBase.eEffacerSelection();
                        Annotation.Select3(false, null);
                        MdlBase.Extension.DeleteSelection2((int)swDeleteSelectionOptions_e.swDelete_Absorbed);
                    }

                    MdlBase.eEffacerSelection();

                    if (_CheckBox_SelectionnerCorpsIdentiques.IsChecked)
                    {
                        var ListeCorpsIdentiques = new List <Body2>();

                        foreach (var corps in ListeSwCorps)
                        {
                            if (MateriauCorpsBase != corps.Materiau)
                            {
                                continue;
                            }

                            if (corps.Swcorps.eComparerGeometrie(CorpsBase) == Sw.Comparaison_e.Semblable)
                            {
                                ListeCorpsIdentiques.Add(corps.GetCorps());
                            }
                        }

                        foreach (var corps in ListeCorpsIdentiques)
                        {
                            corps.DisableHighlight = false;
                        }
                    }
                }
            }
            catch (Exception e)
            { this.LogMethode(new Object[] { e }); }

            return(1);
        }