Skip to content

Circuitikz - définir la position de la flèche du condensateur variable.

Cette section a été révisée par des experts pour assurer l'exactitude de notre chronique.

Solution :

Pourquoi ne pas lire le manuel et utiliser les options de miroir/inversion ?

to[vC=$C_1$,invert, o-]

ou

to[vC=$C_1$,mirror, o-]

ou une combinaison des deux devrait faire l'affaire.

Exemple :

 begin{circuitikz} % Begin add-on environment
  draw (0,0) to[vC=$C_1$] ++(2,0)
    to[vC=$C_1$,invert] ++(2,0)
    to[vC=$C_1$,mirror] ++(2,0)
    to[vC=$C_1$,mirror,invert] ++(2,0);
 end{circuitikz}

enter image description here

Meilleures salutations,

Stefan

Si vous allez toujours vouloir la forme donnée avec des flèches de gauche à droite, vous pourriez simplement redéfinir la forme associée au condensateur variable en utilisant les éléments suivants.

pgfcircdeclarebipole{}{ctikzvalof{bipoles/vcapacitor/height}}{vcapacitor}{ctikzvalof{bipoles/vcapacitor/height}}{ctikzvalof{bipoles/vcapacitor/width}}{
        %[email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/width}[email protected]@Rlen
        [email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/capacitor width} [email protected]@[email protected]

        pgfsetlinewidth{pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}pgfstartlinewidth}
        pgfpathmoveto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}

        pgfscope
        pgfsetarrowsend{latex'}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}
        endpgfscope

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{0pt}}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfsetlinewidth{pgfstartlinewidth}
        pgfusepath{draw}
}

qui est simplement la définition de l'élément circuitikz v0.8.1 avec les lignes

pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}

utilisées à la place de

pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}

pour dire dessiner du bas gauche au haut droite au lieu de bas droite au haut gauche.

Ou vous pourriez définir une nouvelle clé Cv comme (j'ai juste suivi la chaîne de commandes qui semblent être appelées par vC ici et je les ai copiées pour créer une clé Cv qui finit par appeler la même définition avec le même échange gauche/droite que ci-dessus) pour utiliser à la fois les commandes Cv et vC

compattikzset{Cv/.style = {comnpatname capacitor variable = #1}}
compattikzset{capacitor variable/.style = {circuitikzbasekey, /tikz/to path=[email protected]@[email protected], l=#1}}
def[email protected]@[email protected]#1{[email protected]@[email protected]{capacitorv}{#1}}
pgfcircdeclarebipole{}{ctikzvalof{bipoles/vcapacitor/height}}{capacitorv}{ctikzvalof{bipoles/vcapacitor/height}}{ctikzvalof{bipoles/vcapacitor/width}}{
        %[email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/width}[email protected]@Rlen
        [email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/capacitor width} [email protected]@[email protected]

        pgfsetlinewidth{pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}pgfstartlinewidth}
        pgfpathmoveto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}

        pgfscope
        pgfsetarrowsend{latex'}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}
        endpgfscope

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{0pt}}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfsetlinewidth{pgfstartlinewidth}
        pgfusepath{draw}
}

En rassemblant tout cela dans un seul exemple

documentclass{article}
usepackage{tikz}
usepackage{circuitikz}

makeatletter%Create new circuitikz key Cv for variable capacitor with arrow in other direction
compattikzset{Cv/.style = {comnpatname capacitor variable = #1}}
compattikzset{capacitor variable/.style = {circuitikzbasekey, /tikz/to path=[email protected]@[email protected], l=#1}}
def[email protected]@[email protected]#1{[email protected]@[email protected]{capacitorv}{#1}}
pgfcircdeclarebipole{}{ctikzvalof{bipoles/vcapacitor/height}}{capacitorv}{ctikzvalof{bipoles/vcapacitor/height}}{ctikzvalof{bipoles/vcapacitor/width}}{
        %[email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/width}[email protected]@Rlen
        [email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/capacitor width} [email protected]@[email protected]

        pgfsetlinewidth{pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}pgfstartlinewidth}
        pgfpathmoveto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}

        pgfscope
        pgfsetarrowsend{latex'}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}
        endpgfscope

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{0pt}}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfsetlinewidth{pgfstartlinewidth}
        pgfusepath{draw}
}
makeatother

begin{document}
begin{center}
texttt{vC} with default definition

begin{circuitikz}
    draw (2,0) to[vC=$C_1$, o-] (0,0);
end{circuitikz}

New texttt{Cv} key

begin{circuitikz}
    draw (2,0) to[Cv=$C_1$, o-] (0,0);
end{circuitikz}

makeatletter%Redefine arrow direction used by vC
pgfcircdeclarebipole{}{ctikzvalof{bipoles/vcapacitor/height}}{vcapacitor}{ctikzvalof{bipoles/vcapacitor/height}}{ctikzvalof{bipoles/vcapacitor/width}}{
        %[email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/width}[email protected]@Rlen
        [email protected]@[email protected] = ctikzvalof{bipoles/vcapacitor/capacitor width} [email protected]@[email protected]

        pgfsetlinewidth{pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}pgfstartlinewidth}
        pgfpathmoveto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{[email protected]@[email protected]}}

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}

        pgfscope
        pgfsetarrowsend{latex'}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{[email protected]@[email protected]}}
        pgfusepath{draw}
        endpgfscope

        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{-[email protected]@[email protected]}{0pt}}
        pgfpathmoveto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfpathlineto{pgfpoint{[email protected]@[email protected]}{0pt}}
        pgfsetlinewidth{pgfstartlinewidth}
        pgfusepath{draw}
}
makeatother

texttt{vC} with arrow direction redefined

begin{circuitikz}
    draw (2,0) to[vC=$C_1$, o-] (0,0);
end{circuitikz}
end{center}
end{document}

enter image description here

Commentaires et notes

Nous vous invitons à ajouter de la valeur à notre contenu informatif en donnant votre expérience dans les interprétations.


Tags : /

Utilisez notre moteur de recherche

Ricerca
Generic filters

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée.