Re: Problema CircuiTikZ

#77301
Liverpool
Partecipante
    Up
    0
    Down
    ::

    OldClaudio” post=77347Se uno volesse i resistori con 4 cuspidi, invece che con 3, per esempio, non ho idea se sia fattibile.

    E’ fattibile, ma non c’è un’opzione a livello utente: bisogna mettere mano al codice del pacchetto e quindi non è tanto immediato.

    Esempio di codice:
    `\documentclass{standalone}
    \usepackage{circuitikz}

    \makeatletter
    \ctikzset{bipoles/mioresistor/width/.initial=1.0664}

    %% Resistore a quattro cuspidi (mioresistor o mioR)
    \pgfcircdeclarebipole{}{\ctikzvalof{bipoles/resistor/height}}{mioresistor}{\ctikzvalof{bipoles/resistor/height}}
    {\ctikzvalof{bipoles/mioresistor/width}}{
    \pgf@circ@Rlen=1.333\pgf@circ@Rlen
    \pgf@circ@res@step = \ctikzvalof{bipoles/resistor/width}\pgf@circ@Rlen
    \divide \pgf@circ@res@step by 16

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@zero}}
    \pgf@circ@res@other = \pgf@circ@res@left
    \advance\pgf@circ@res@other by \pgf@circ@res@step

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@up}}
    \advance\pgf@circ@res@other by 2\pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@down}}
    \advance\pgf@circ@res@other by \pgf@circ@res@step
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@other}{\pgf@circ@res@zero}}
    \pgfusepath{draw}
    }

    \def\pgf@circ@mioresistor@path#1{\ifpgf@circuit@europeanresistor\pgf@circ@bipole@path{generic}{#1}
    \else\pgf@circ@bipole@path{mioresistor}{#1}\fi}

    \tikzset{mioresistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@mioresistor@path, l=#1}}
    \tikzset{mioR/.style= {mioresistor = #1}}
    \makeatother

    \begin{document}
    \begin{circuitikz}
    \draw (0,0) to [R=$R_3$] (2,0);
    \draw (0,-2) to [mioR=$R_4$] (2,-2);
    \end{circuitikz}
    \end{document}`

    [attachment=491]prova2.png[/attachment]

    Sono d’accordo con te per il discorso sull’inclinazione delle serpentine. Tra l’altro, nelle ultime norme ISO (ma non nelle ANSI IEEE), il simbolo citato è cancellato e sostituito dalla più anonima scatola nera, che io ho sempre usato per indicare un generico bipolo passivo e trovo poco chiaro (ma vedo che ormai è abbondantemente adottato).

    Ciao

    Attachments:
    You must be logged in to view attached files.

    Go to top