IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Visio Discussion :

Macro Visio - Gestion des calques


Sujet :

Visio

  1. #1
    Candidat au Club
    Homme Profil pro
    Ingénieur qualité méthodes
    Inscrit en
    Juin 2020
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur qualité méthodes

    Informations forums :
    Inscription : Juin 2020
    Messages : 2
    Points : 4
    Points
    4
    Par défaut Macro Visio - Gestion des calques
    Bonjour à tous,

    J'aimerais savoir si il existe un code VBA permettant de cacher tous les calques d'un fichier Visio afin de pouvoir, par la suite, afficher uniquement les calques souhaités?

    Exemple:
    Au lieux de faire --> Application.ActiveWindow.Shape.CellsSRC(visSectionLayer, 174, visLayerGlue).FormulaU = "0" (Faisant disparaître uniquement le calque 174)

    Utiliser une commande qui désactive tous les calques avant d'activer ceux voulus

    Je vous remercie par avance pour vos réponses.

  2. #2
    Membre à l'essai
    Homme Profil pro
    Inscrit en
    Mars 2010
    Messages
    23
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2010
    Messages : 23
    Points : 21
    Points
    21
    Par défaut
    Bonjour,

    J'ai eu le même besoin. Pour cela j'ai créé deux fonction en macros:
    1. Une pour afficher une couche
    2. Une pour masquer une couche

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
     
    Function LayerOn(Couche As String)
        Dim UndoScopeID1 As Long
        Dim NomCouche As String
        'NomCouche = "01-PlcArea"
        UndoScopeID1 = Application.BeginUndoScope("Propriétés des calques")
        Dim vsoLayer1 As Visio.Layer
        Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(NumCouche(Couche))
        vsoLayer1.CellsC(visLayerVisible).FormulaU = "1"
        vsoLayer1.CellsC(visLayerPrint).FormulaU = "1"
        Application.EndUndoScope UndoScopeID1, True
    End Function]
     
    [Function LayerOff(Couche As String)
        Dim UndoScopeID1 As Long
        Dim NomCouche As String
        'NomCouche = Couche
        UndoScopeID1 = Application.BeginUndoScope("Propriétés des calques")
        Dim vsoLayer1 As Visio.Layer
        Set vsoLayer1 = Application.ActiveWindow.Page.Layers.Item(NumCouche(Couche))
        vsoLayer1.CellsC(visLayerVisible).FormulaU = "0"
        vsoLayer1.CellsC(visLayerPrint).FormulaU = "0"
        Application.EndUndoScope UndoScopeID1, True
    End Function]
    Dans la page sur laquelle on souhaite gérer les couches, j'ai créer un bouton avec le code suivant pour afficher toutes les couches désirées. Le nom de chaque couche est le paramètre de la fonction:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    [Private Sub CommandButton27_Click() 'Afficher tout
        LayerOn ("01-PLCAREA")
        LayerOn ("02-SUPPLY")
        LayerOn ("03-MACHINE")
        LayerOn ("04-SAFETYAREAS")
        LayerOn ("05-PANELS")
        LayerOn ("06-HMI")
        LayerOn ("07-GATES")
        LayerOn ("08-LIGHTGUARD")
        LayerOn ("09-ESTOP")
        LayerOn ("10-FENCE")
        LayerOn ("11-MOTORS")
        LayerOn ("12-DATA")
        LayerOn ("13-AIR")
    End Sub
    Et un autre bouton pour tout cacher:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    [Private Sub CommandButton28_Click() 'Masquer tout
        LayerOff ("01-PLCAREA")
        LayerOff ("02-SUPPLY")
        LayerOff ("03-MACHINE")
        LayerOff ("04-SAFETYAREAS")
        LayerOff ("05-PANELS")
        LayerOff ("06-HMI")
        LayerOff ("07-GATES")
        LayerOff ("08-LIGHTGUARD")
        LayerOff ("09-ESTOP")
        LayerOff ("10-FENCE")
        LayerOff ("11-MOTORS")
        LayerOff ("12-DATA")
        LayerOff ("13-AIR")
    End Sub]
    On peut aussi ajouter un bouton pour chaque couche unitairement.
    Bon courage

Discussions similaires

  1. Gestion des calques
    Par Anduriel dans le forum VB.NET
    Réponses: 3
    Dernier message: 30/01/2011, 18h15
  2. carte avec gestion des calques: possible en web open source?
    Par nicolas.ani dans le forum Général Conception Web
    Réponses: 3
    Dernier message: 07/07/2010, 15h24
  3. Mettre le code des macros en gestion de configuration
    Par renuche31 dans le forum Macros et VBA Excel
    Réponses: 3
    Dernier message: 30/05/2008, 09h47
  4. Réponses: 1
    Dernier message: 24/07/2007, 09h43
  5. [POI] Gestion des macros
    Par mittim dans le forum Documents
    Réponses: 1
    Dernier message: 04/10/2006, 20h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo