
Leí este pequeño artículo:http://www.elfsoft2000.com/projects/bipole.pdfy los otros dos mencionados en este. Quiero crear un símbolo para usar en mis artículos y proyectos. En mi país algunos son diferentes a los europeos o americanos así que decidí hacerlos yo misma.
Logré dos símbolos del circuito rumano como se presentan aquí: github.com/PopAdi/circuitikz-romanian-symbols
Ahora tengo que hacer algo similar: en lugar de un círculo, debería haber un diamante/rombo. ¿Cómo puedo lograr eso? Quiero que se parezcan a los que se presentan aquí:Señales americanas de voltaje controlado Circuitikz.
En mi código, para el que tiene el círculo tengo:
\pgfpathellipse{\pgfpointorigin}{\pgfpoint{0cm}{\ResUp}}{\pgfpoint{\ResRight}{0cm}}
Logré hacer un cuadrado con esto:
\pgfpathrectanglecorners{\southwest}{\northeast}
Pero realmente no sé cómo rotar ese cuadrado o cambiarlo por un diamante. ¿Puedes ayudarme a resolver esto? ¡Gracias!
Editar: mi código se ve así:
\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{shapes,arrows,positioning}
\usetikzlibrary{decorations.markings}
\makeatletter
\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
\def\TikzBipolePath#1#2{\pgf@circ@bipole@path{#1}{#2}}
\makeatother
\newlength{\ResUp}
\newlength{\ResRight}
\ctikzset{bipoles/romanianCCS/height/.initial=.60}
\ctikzset{bipoles/romanianCCS/width/.initial=.60}
\pgfcircdeclarebipole{}
{\ctikzvalof{bipoles/romanianCCS/height}}
{romanianCCS}
{\ctikzvalof{bipoles/romanianCCS/height}}
{\ctikzvalof{bipoles/romanianCCS/width}}
{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfextracty{\ResUp}{\northeast}
\pgfextractx{\ResRight}{\southwest}
%Desenam cerculetul
\pgfpathrectanglecorners{\southwest}{\northeast}
%First little arrow
\pgfmoveto{\pgfpoint{1.0\ResRight}{0.0\ResUp}}
\pgflineto{\pgfpoint{0.1\ResRight}{0.0\ResUp}}
\pgflineto{\pgfpoint{0.3\ResRight}{-0.25\ResUp}}
\pgfmoveto{\pgfpoint{0.1\ResRight}{0.0\ResUp}}
\pgflineto{\pgfpoint{0.3\ResRight}{0.25\ResUp}}
%Second arrow
\pgfmoveto{\pgfpoint{-0.2\ResRight}{0.0\ResUp}}
\pgflineto{\pgfpoint{-1.0\ResRight}{0.0\ResUp}}
\pgfmoveto{\pgfpoint{0.0\ResRight}{0.25\ResUp}}
\pgflineto{\pgfpoint{-0.2\ResRight}{0.0\ResUp}}
\pgflineto{\pgfpoint{0.0\ResRight}{-0.25\ResUp}}
\pgfusepath{draw}
}
\def\romanianCCS#1{\TikzBipolePath{romanianCCS}{#1}}
\tikzset{romanianCCS/.style = {\circuitikzbasekey, /tikz/to path=\romanianCCS, l=#1}}
\begin{document}
\begin{center}
\begin{circuitikz}
\draw (0, 0)
to[romanianCCS, l=${j_1 = 4A}$, *-*] (4, 0);
\end{circuitikz}
\end{center}
\end{document}
lo que debería darte el siguiente resultado:
¡Encontré la solución! Hice esto:
\pgftransformrotate{-45}
\pgfpathrectanglecorners{\southwest}{\northeast}
\pgftransformrotate{45}
¡Y está funcionando muy bien!
Respuesta1
Si alguna vez quieres un diamante en lugar de un rombo, puedes usar:
\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{shapes,arrows,positioning}
\usetikzlibrary{decorations.markings}
\makeatletter
\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
\def\TikzBipolePath#1#2{\pgf@circ@bipole@path{#1}{#2}}
\makeatother
\newlength{\ResUp}
\newlength{\ResRight}
\ctikzset{bipoles/romanianCCS/height/.initial=.60}
\ctikzset{bipoles/romanianCCS/width/.initial=.60}
\pgfcircdeclarebipole{}
{\ctikzvalof{bipoles/romanianCCS/height}}
{romanianCCS}
{\ctikzvalof{bipoles/romanianCCS/height}}
{\ctikzvalof{bipoles/romanianCCS/width}}
{
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfextracty{\ResUp}{\northeast}
\pgfextractx{\ResRight}{\southwest}
%Desenam cerculetul
\pgfpathmoveto{\pgfpoint{-\ResRight}{0pt}}
\pgfpathlineto{\pgfpoint{0pt}{-\ResUp}}
\pgfpathlineto{\pgfpoint{\ResRight}{0pt}}
\pgfpathlineto{\pgfpoint{0pt}{\ResUp}}
\pgfpathclose
%First little arrow
\pgfpathmoveto{\pgfpoint{1.0\ResRight}{0.0\ResUp}}
\pgfpathlineto{\pgfpoint{0.1\ResRight}{0.0\ResUp}}
\pgfpathlineto{\pgfpoint{0.3\ResRight}{-0.25\ResUp}}
\pgfpathmoveto{\pgfpoint{0.1\ResRight}{0.0\ResUp}}
\pgfpathlineto{\pgfpoint{0.3\ResRight}{0.25\ResUp}}
%Second arrow
\pgfpathmoveto{\pgfpoint{-0.2\ResRight}{0.0\ResUp}}
\pgfpathlineto{\pgfpoint{-1.0\ResRight}{0.0\ResUp}}
\pgfpathmoveto{\pgfpoint{0.0\ResRight}{0.25\ResUp}}
\pgfpathlineto{\pgfpoint{-0.2\ResRight}{0.0\ResUp}}
\pgfpathlineto{\pgfpoint{0.0\ResRight}{-0.25\ResUp}}
\pgfusepath{draw}
}
\def\romanianCCS#1{\TikzBipolePath{romanianCCS}{#1}}
\tikzset{romanianCCS/.style = {\circuitikzbasekey, /tikz/to path=\romanianCCS, l=#1}}
\begin{document}
\begin{center}
\begin{circuitikz}
\draw (0, 0)
to[romanianCCS, l=${j_1 = 4A}$, *-*] (4, 0);
\end{circuitikz}
\end{center}
\end{document}