Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Full body diodes not really filled when their color is changed #794

Closed
Rmano opened this issue May 13, 2024 · 1 comment · Fixed by #797
Closed

[Bug] Full body diodes not really filled when their color is changed #794

Rmano opened this issue May 13, 2024 · 1 comment · Fixed by #797
Assignees
Labels

Comments

@Rmano
Copy link
Collaborator

Rmano commented May 13, 2024

There seems to be a problem when changing the color of full bodydiodes... (problem spotted answering to this question)

\documentclass[border=2.78mm]{standalone}
\usepackage[americanvoltages]{circuitikz}
\usepackage{xpatch}

\begin{document}
 \begin{tikzpicture}
    \draw[full diodes]
    (0,0) to[Do] ++(0,-1.25)
    node[nigfete,bodydiode, anchor=D,
        circuitikz/transistor bodydiode/color=red](){}
    (2,0) to[D-] ++(0,-1.25)
    node[nigfete,bodydiode,stroke diodes, anchor=D,
        circuitikz/transistor bodydiode/color=red](){}
    (4,0) to[D*] ++(0,-1.25)
    node[nigfete,bodydiode,tr circle,anchor=D,
        circuitikz/transistor bodydiode/color=red](){}
    ;
 \end{tikzpicture}
\end{document}

image

This seems to be fixable by:

\documentclass[border=2.78mm]{standalone}
\usepackage[americanvoltages]{circuitikz}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\drawbodydiode}{%
     \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
}{%
     \pgf@circ@maybe@color{transistor bodydiode/color}
     \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
 }{}{\error}
\makeatother

\begin{document}
 \begin{tikzpicture}
    \draw[full diodes]
    (0,0) to[Do] ++(0,-1.25)
    node[nigfete,bodydiode, anchor=D,
        circuitikz/transistor bodydiode/color=red](){}
    (2,0) to[D-] ++(0,-1.25)
    node[nigfete,bodydiode,stroke diodes, anchor=D,
        circuitikz/transistor bodydiode/color=red](){}
    (4,0) to[D*] ++(0,-1.25)
    node[nigfete,bodydiode,tr circle,anchor=D,
        circuitikz/transistor bodydiode/color=red](){}
    ;
 \end{tikzpicture}
\end{document}

image

...but I have to think a bit about it.

@Rmano Rmano added the bug label May 13, 2024
@Rmano Rmano self-assigned this May 13, 2024
@Rmano Rmano changed the title [Bug] Full boy diodes not really filled when their color is changed [Bug] Full body diodes not really filled when their color is changed May 15, 2024
@Rmano
Copy link
Collaborator Author

Rmano commented May 15, 2024

And if you look at it, it also seems that the stroke diode in the second transistor is not working.

I think that the full fix for this is:

\documentclass[border=2.78mm]{standalone}
\usepackage[americanvoltages]{circuitikz}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\drawbodydiode}{%
     \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
}{%
     \pgf@circ@maybe@color{transistor bodydiode/color}
     \pgfnode{fulldiodeshape}{center}{}{pgf@bodydiode}{\pgfusepath{fill}}
 }{}{\error}
\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue\pgf@circuit@fulldiodefalse}
\makeatother


\begin{document}
\begin{tikzpicture}[full diodes]
    \draw[]
        (0,0) to[D] ++(0,-1.25)
        node[nigfete,bodydiode, anchor=D](){}
        (2,0) to[Do] ++(0,-1.25)
        node[nigfete,bodydiode, stroke diodes, anchor=D,
            circuitikz/transistor bodydiode/color=red, fill=yellow](){}
        (4,0) to[D-] ++(0,-1.25)
        node[nigfete,bodydiode,tr circle,full diodes, anchor=D,
            circuitikz/transistor bodydiode/color=red](){}
        ;
\end{tikzpicture}
\end{document}

image

What seems incredible to me is that the problem that the fix from:
\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue}
to:
\ctikzset{diode/stroke/.code = \pgf@circuit@strokediodetrue\pgf@circuit@fulldiodefalse}
will fix is here since... forever? It seems nobody ever tried to change from a full diode to a stroke diode locally...

Rmano added a commit to Rmano/circuitikz that referenced this issue May 18, 2024
Also, add a magic color selection thing to fix a fill
problem in bodydiodes.

Fixes circuitikz#794
Rmano added a commit to Rmano/circuitikz that referenced this issue May 25, 2024
Several new components, and a bug fix for a nasty long-standing bug about switching diode types.

- Added a Relais-Shape (contributed by [Jakob "DraUX" on GitHub](circuitikz#795)
- Added a center tap anchor for tube's filament (suggested by [user bogger33 on GitHub](circuitikz#792))
- Added neon lamps (two versions, suggested by [user bogger33 on GitHub](circuitikz#793))
- Added a configurable spark gap (suggested by [user bogger33 on GitHub](circuitikz#800))
- Fix a long-standing problem when [(locally) switching diode type](circuitikz#794)
Rmano added a commit to Rmano/circuitikz that referenced this issue May 25, 2024
Several new components, and a bug fix for a nasty long-standing bug about switching diode types.

- Added a Relais-Shape (contributed by [Jakob "DraUX" on GitHub](circuitikz#795)
- Added a center tap anchor for tube's filament (suggested by [user bogger33 on GitHub](circuitikz#792))
- Added neon lamps (two versions, suggested by [user bogger33 on GitHub](circuitikz#793))
- Added a configurable spark gap (suggested by [user bogger33 on GitHub](circuitikz#800))
- Fix a long-standing problem when [(locally) switching diode type](circuitikz#794)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant