コード例 #1
0
ファイル: OutilsCommun.cs プロジェクト: Titifonky/SwExtension
        public static void DeplierTole(this Body2 Tole, ModelDoc2 mdl, String nomConfigDepliee)
        {
            Feature FonctionDepliee = Tole.eFonctionEtatDepliee();

            FonctionDepliee.eModifierEtat(swFeatureSuppressionAction_e.swUnSuppressFeature, nomConfigDepliee);
            FonctionDepliee.eModifierEtat(swFeatureSuppressionAction_e.swUnSuppressDependent, nomConfigDepliee);

            mdl.eEffacerSelection();

            FonctionDepliee.eParcourirSousFonction(
                f =>
            {
                f.eModifierEtat(swFeatureSuppressionAction_e.swUnSuppressFeature, nomConfigDepliee);

                if ((f.Name.ToLowerInvariant() == CONSTANTES.LIGNES_DE_PLIAGE.ToLowerInvariant()) ||
                    (f.Name.ToLowerInvariant() == CONSTANTES.CUBE_DE_VISUALISATION.ToLowerInvariant()))
                {
                    f.eSelect(true);
                }
                return(false);
            }
                );

            mdl.UnblankSketch();
            mdl.eEffacerSelection();

            //// Si des corps autre que la tole dépliée sont encore visible dans la config, on les cache et on recontruit tout
            //foreach (Body2 pCorps in mdl.ePartDoc().eListeCorps(false))
            //{
            //    if ((pCorps.Name == CONSTANTES.NOM_CORPS_DEPLIEE))
            //        pCorps.eVisible(true);
            //    else
            //        pCorps.eVisible(false);
            //}
        }
コード例 #2
0
        private GeomVue AppliquerOptionsVue(DrawingDoc dessin, PartDoc piece, View vue)
        {
            vue.ShowSheetMetalBendNotes = AfficherNotePliage;

            MathUtility SwMath = App.Sw.GetMathUtility();

            ModelDoc2 mdl = dessin.eModelDoc2();

            Body2 c = piece.eChercherCorps(CONSTANTES.NOM_CORPS_DEPLIEE, true);

            GeomVue g = null;

            c.eFonctionEtatDepliee().eParcourirSousFonction(
                f =>
            {
                if (f.Name.StartsWith(CONSTANTES.LIGNES_DE_PLIAGE))
                {
                    String NomSelection = f.Name + "@" + vue.RootDrawingComponent.Name + "@" + vue.Name;
                    mdl.Extension.SelectByID2(NomSelection, "SKETCH", 0, 0, 0, false, 0, null, 0);
                    if (AfficherLignePliage)
                    {
                        mdl.UnblankSketch();
                    }
                    else
                    {
                        mdl.BlankSketch();
                    }

                    mdl.eEffacerSelection();
                }
                else if (f.Name.StartsWith(CONSTANTES.CUBE_DE_VISUALISATION))
                {
                    try
                    {
                        f.eModifierEtat(swFeatureSuppressionAction_e.swUnSuppressFeature);

                        Sketch Esquisse = f.GetSpecificFeature2();

                        if (OrienterDvp)
                        {
                            Double Angle = AngleCubeDeVisualisation(vue, Esquisse);

                            // On oriente la vue
                            switch (OrientationDvp)
                            {
                            case eOrientation.Portrait:
                                if (Math.Abs(Angle) != MathX.eRad90D)
                                {
                                    Double a  = MathX.eRad90D - Math.Abs(Angle);
                                    vue.Angle = (Math.Sign(Angle) == 0 ? 1 : Math.Sign(Angle)) * a;
                                }
                                break;

                            case eOrientation.Paysage:
                                if (Math.Abs(Angle) != 0 || Math.Abs(Angle) != MathX.eRad180D)
                                {
                                    Double a  = MathX.eRad90D - Math.Abs(Angle);
                                    vue.Angle = ((Math.Sign(Angle) == 0 ? 1 : Math.Sign(Angle)) * a) - MathX.eRad90D;
                                }
                                break;

                            default:
                                break;
                            }
                        }

                        g = new GeomVue(vue, Esquisse);
                    }
                    catch
                    {
                        WindowLog.EcrireF("Impossible d'orienter la vue : {0}", vue.Name);
                    }
                    return(true);
                }
                return(false);
            }
                );

            return(g);
        }