Por que dimensionar uma imagem tikz faz com que tudo dentro do escopo da tela de transformação desapareça?

Por que dimensionar uma imagem tikz faz com que tudo dentro do escopo da tela de transformação desapareça?

Desenhei uma imagem tikz, mas depois de dimensionar a imagem usando \begin{tikzpicture}[scale=200/(\hsize-24)], tudo dentro do escopo da tela de transformação desaparece. alguém poderia explicar isso?

Esta é a imagem original do tikz

\documentclass[tikz, border=12]{standalone}

\usepackage{tikz, tkz-euclide, pgfmath, pstricks}
\usetikzlibrary{intersections, decorations.markings, angles,
quotes, calc, arrows, arrows.meta}
\usetkzobj{all}
%
\definecolor{blue}{RGB}{0,51,255}
\definecolor{green}{RGB}{0,153,0}
\definecolor{blue1}{RGB}{174,214,241}
\definecolor{blue}{RGB}{161,207,223}
\definecolor{yellow}{RGB}{255,220,0}
\colorlet{dcolor}{blue}
%
\begin{document}
\begin{tikzpicture}
\pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}
\pgfmathsetmacro{\preserve}{1/\mya}
\begin{scope}[>={Stealth[scale=1.2]} , thick,rotate=0 ] 

%
\newcommand\height{10}
%
\newcommand\Ac{-4}
%
\newcommand\Bc{27.46586300953384}
%
\pgfmathsetmacro{\distance}{\Bc+\Ac}
\draw (0,-0.2) node [color=black,fill=white,below] {$Q$};
\draw [fill=black] (\Ac-0.1*\distance,0)--(\Bc+0.1*\distance,0)--(\Bc+0.1*\distance,0.01*\height)--(\Ac-0.1*\distance,0.01*\height)--cycle;
\draw [fill=black] (\Ac-0.1*\distance,\height)--(\Bc+0.1*\distance,\height)--(\Bc+0.1*\distance,1.01*\height)--(\Ac-0.1*\distance,1.01*\height)--cycle;
\draw [black,densely dashed](0,0)--(0,\height);


%
\coordinate (pulleyCenter) at (0,0.9*\height);
%
\pgfmathsetmacro{\pulleyRadius}{0.0375*\height}

\draw (0,0.9*\height-\pulleyRadius) node [color=black,fill=white,below] {$P$};

\draw [line width = 0.2*\distance,line cap=round](0,0.9*\height)--(0,0.995*\height);
\draw [line width = 0.2*\distance]([shift={(0,\height)}]0:-0.025*\height) arc[radius=0.025*\height, start angle=180, end angle= 360];

\pgfmathsetmacro{\ax}{\Bc-0.04*\distance}
\pgfmathsetmacro{\bx}{\Bc+0.04*\distance}
\pgfmathsetmacro{\lowerwidth}{\bx-\ax}
\pgfmathsetmacro{\aby}{0.2+0.01*\height}
\pgfmathsetmacro{\dx}{\Bc-0.08*\distance}
\pgfmathsetmacro{\cx}{\Bc+0.08*\distance}
\pgfmathsetmacro{\upperwidth}{\cx-\dx}
\pgfmathsetmacro{\cartheight}{1.25*\lowerwidth}
\pgfmathsetmacro{\dcy}{\aby+\cartheight}
\coordinate(a) at (\ax,\aby);
\coordinate(b) at (\bx,\aby);
\coordinate(d) at (\dx,\dcy);
\coordinate(c) at (\cx,\dcy);


\pgfmathsetmacro{\adx}{\Bc-0.06*\distance}
\pgfmathsetmacro{\ady}{\aby+0.5*\cartheight}
\coordinate (c1) at (\adx,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--++(180:0.01*\Bc) coordinate (e1);


\coordinate (c2) at (\Bc+0.06*\distance,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--++(0:0.01*\Bc) coordinate (e2);


\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\tkzTangent[from with R=e1](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}

\draw[yellow, line width = 0.010*\height cm,line cap =round](e1)--(D1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\pgfmathsetmacro{\wheelax}{0.25*\lowerwidth+\ax}
\pgfmathsetmacro{\wheelbx}{0.75*\lowerwidth+\ax}
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw (\Bc,\ady) node [color=black] {$A$};


\pgfmathsetmacro{\shift}{\Ac-\Bc}
\begin{scope}[transform canvas={xshift=\shift cm}]
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\coordinate (pulleyCenter) at (-1*\shift,0.9*\height);
\tkzTangent[from with R=e2](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}
\draw[yellow, line width = 0.01*\height cm,line cap =round](e2)--(D2);
\draw[gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);
\draw (\Bc,\ady) node [color=black] {$B$};

\draw [gray,fill=gray!50,line width = 0.005*\height cm](pulleyCenter) circle(\pulleyRadius);
\end{scope}



\end{scope}
\end{tikzpicture}
\end{document}

insira a descrição da imagem aqui

E esta é a mesma imagem tikz depois de usar\begin{tikzpicture}[scale=200/(\hsize-24)]

\documentclass[tikz, border=12]{standalone}

\usepackage{tikz, tkz-euclide, pgfmath, pstricks}
\usetikzlibrary{intersections, decorations.markings, angles,
quotes, calc, arrows, arrows.meta}
\usetkzobj{all}
%
\definecolor{blue}{RGB}{0,51,255}
\definecolor{green}{RGB}{0,153,0}
\definecolor{blue1}{RGB}{174,214,241}
\definecolor{blue}{RGB}{161,207,223}
\definecolor{yellow}{RGB}{255,220,0}
\colorlet{dcolor}{blue}
%
\begin{document}
\begin{tikzpicture}[scale=200/(\hsize-24)]

\pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}
\pgfmathsetmacro{\preserve}{1/\mya}
\begin{scope}[>={Stealth[scale=1.2]} , thick,rotate=0 ] 

%
\newcommand\height{10}
%
\newcommand\Ac{-4}
%
\newcommand\Bc{27.46586300953384}
%
\pgfmathsetmacro{\distance}{\Bc+\Ac}
\draw (0,-0.2) node [color=black,fill=white,below] {$Q$};
\draw [fill=black] (\Ac-0.1*\distance,0)--(\Bc+0.1*\distance,0)--(\Bc+0.1*\distance,0.01*\height)--(\Ac-0.1*\distance,0.01*\height)--cycle;
\draw [fill=black] (\Ac-0.1*\distance,\height)--(\Bc+0.1*\distance,\height)--(\Bc+0.1*\distance,1.01*\height)--(\Ac-0.1*\distance,1.01*\height)--cycle;
\draw [black,densely dashed](0,0)--(0,\height);


%
\coordinate (pulleyCenter) at (0,0.9*\height);
%
\pgfmathsetmacro{\pulleyRadius}{0.0375*\height}

\draw (0,0.9*\height-\pulleyRadius) node [color=black,fill=white,below] {$P$};

\draw [line width = 0.2*\distance,line cap=round](0,0.9*\height)--(0,0.995*\height);
\draw [line width = 0.2*\distance]([shift={(0,\height)}]0:-0.025*\height) arc[radius=0.025*\height, start angle=180, end angle= 360];

\pgfmathsetmacro{\ax}{\Bc-0.04*\distance}
\pgfmathsetmacro{\bx}{\Bc+0.04*\distance}
\pgfmathsetmacro{\lowerwidth}{\bx-\ax}
\pgfmathsetmacro{\aby}{0.2+0.01*\height}
\pgfmathsetmacro{\dx}{\Bc-0.08*\distance}
\pgfmathsetmacro{\cx}{\Bc+0.08*\distance}
\pgfmathsetmacro{\upperwidth}{\cx-\dx}
\pgfmathsetmacro{\cartheight}{1.25*\lowerwidth}
\pgfmathsetmacro{\dcy}{\aby+\cartheight}
\coordinate(a) at (\ax,\aby);
\coordinate(b) at (\bx,\aby);
\coordinate(d) at (\dx,\dcy);
\coordinate(c) at (\cx,\dcy);


\pgfmathsetmacro{\adx}{\Bc-0.06*\distance}
\pgfmathsetmacro{\ady}{\aby+0.5*\cartheight}
\coordinate (c1) at (\adx,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--++(180:0.01*\Bc) coordinate (e1);


\coordinate (c2) at (\Bc+0.06*\distance,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--++(0:0.01*\Bc) coordinate (e2);


\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\tkzTangent[from with R=e1](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}

\draw[yellow, line width = 0.010*\height cm,line cap =round](e1)--(D1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\pgfmathsetmacro{\wheelax}{0.25*\lowerwidth+\ax}
\pgfmathsetmacro{\wheelbx}{0.75*\lowerwidth+\ax}
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw (\Bc,\ady) node [color=black] {$A$};


\pgfmathsetmacro{\shift}{\Ac-\Bc}
\begin{scope}[transform canvas={xshift=\shift cm}]
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\coordinate (pulleyCenter) at (-1*\shift,0.9*\height);
\tkzTangent[from with R=e2](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}
\draw[yellow, line width = 0.01*\height cm,line cap =round](e2)--(D2);
\draw[gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);
\draw (\Bc,\ady) node [color=black] {$B$};

\draw [gray,fill=gray!50,line width = 0.005*\height cm](pulleyCenter) circle(\pulleyRadius);
\end{scope}



\end{scope}
\end{tikzpicture}
\end{document}

insira a descrição da imagem aqui

Responder1

O dimensionamento da imagem tikz não se aplica ao xshift dentro da tela de transformação, então tudo que tive que fazer foi aplicar o dimensionamento ao deslocamento fora da tela de transformação e, em seguida, usar o valor dimensionado dentro da transformação da tela. então eu usei isso

\pgfmathsetmacro{\shift}{\Ac-\Bc}
\pgfmathsetmacro{\shifta}{200/(\hsize-24)*\shift}
\begin{scope}[transform canvas={xshift=\shifta cm}]

em vez disso

\pgfmathsetmacro{\shift}{\Ac-\Bc}
\begin{scope}[transform canvas={xshift=\shift cm}]

e o resto do código é exatamente o mesmo.

informação relacionada