我有一个多张图片
\documentclass[parskip]{scrartcl}
% \usepackage[margin=15mm,landscape]{geometry}
\usepackage{tikz}
\newif\ifcuboidshade
\newif\ifcuboidemphedge
\tikzset{
cuboid/.is family,
cuboid,
shiftx/.initial=0,
shifty/.initial=0,
dimx/.initial=3,
dimy/.initial=3,
dimz/.initial=3,
scale/.initial=1,
densityx/.initial=1,
densityy/.initial=1,
densityz/.initial=1,
rotation/.initial=0,
anglex/.initial=0,
angley/.initial=90,
anglez/.initial=225,
scalex/.initial=1,
scaley/.initial=1,
scalez/.initial=0.5,
xedgelabel/.store in=\xedgelabel,
yedgelabel/.store in=\yedgelabel,
zedgelabel/.store in=\zedgelabel,
xedgelabel={},
yedgelabel={},
zedgelabel={},
edgelabel/.style={},
front/.style={draw=black,fill=white},
top/.style={draw=black,fill=white},
right/.style={draw=black,fill=white},
shade/.is if=cuboidshade,
shadecolordark/.initial=black,
shadecolorlight/.initial=white,
shadeopacity/.initial=0.15,
shadesamples/.initial=16,
emphedge/.is if=cuboidemphedge,
emphstyle/.style={thick},
}
\newcommand{\tikzcuboidkey}[1]{\pgfkeysvalueof{/tikz/cuboid/#1}}
% Commands
\newcommand{\tikzcuboid}[1]{
\tikzset{cuboid,#1} % Process Keys passed to command
\pgfmathsetlengthmacro{\vectorxx}{\tikzcuboidkey{scalex}*cos(\tikzcuboidkey{anglex})*28.452756}
\pgfmathsetlengthmacro{\vectorxy}{\tikzcuboidkey{scalex}*sin(\tikzcuboidkey{anglex})*28.452756}
\pgfmathsetlengthmacro{\vectoryx}{\tikzcuboidkey{scaley}*cos(\tikzcuboidkey{angley})*28.452756}
\pgfmathsetlengthmacro{\vectoryy}{\tikzcuboidkey{scaley}*sin(\tikzcuboidkey{angley})*28.452756}
\pgfmathsetlengthmacro{\vectorzx}{\tikzcuboidkey{scalez}*cos(\tikzcuboidkey{anglez})*28.452756}
\pgfmathsetlengthmacro{\vectorzy}{\tikzcuboidkey{scalez}*sin(\tikzcuboidkey{anglez})*28.452756}
\begin{scope}[xshift=\tikzcuboidkey{shiftx}, yshift=\tikzcuboidkey{shifty}, scale=\tikzcuboidkey{scale}, rotate=\tikzcuboidkey{rotation}, x={(\vectorxx,\vectorxy)}, y={(\vectoryx,\vectoryy)}, z={(\vectorzx,\vectorzy)}]
\pgfmathsetmacro{\steppingx}{1/\tikzcuboidkey{densityx}}
\pgfmathsetmacro{\steppingy}{1/\tikzcuboidkey{densityy}}
\pgfmathsetmacro{\steppingz}{1/\tikzcuboidkey{densityz}}
\newcommand{\dimx}{\tikzcuboidkey{dimx}}
\newcommand{\dimy}{\tikzcuboidkey{dimy}}
\newcommand{\dimz}{\tikzcuboidkey{dimz}}
\pgfmathsetmacro{\secondx}{2*\steppingx}
\pgfmathsetmacro{\secondy}{2*\steppingy}
\pgfmathsetmacro{\secondz}{2*\steppingz}
\foreach \x in {\steppingx,\secondx,...,\dimx}
{\ifnum\dimy=1
\def\lsty{\dimy}
\else
\def\lsty{\steppingy,\secondy,...,\dimy}
\fi
\foreach \y in \lsty
{ \pgfmathsetmacro{\lowx}{(\x-\steppingx)}
\pgfmathsetmacro{\lowy}{(\y-\steppingy)}
\filldraw[cuboid/front] (\lowx,\lowy,\dimz) -- (\lowx,\y,\dimz) -- (\x,\y,\dimz) -- (\x,\lowy,\dimz) -- cycle;
}
}
\ifnum\dimx=1
\def\lstx{\dimx}
\else
\def\lstx{\steppingx,\secondx,...,\dimx}
\fi
\foreach \x in \lstx
{ \ifnum\dimz=1
\def\lstz{\dimz}
\else
\def\lstz{\steppingz,\secondz,...,\dimz}
\fi
\foreach \z in \lstz
{ \pgfmathsetmacro{\lowx}{(\x-\steppingx)}
\pgfmathsetmacro{\lowz}{(\z-\steppingz)}
\filldraw[cuboid/top] (\lowx,\dimy,\lowz) -- (\lowx,\dimy,\z) -- (\x,\dimy,\z) -- (\x,\dimy,\lowz) -- cycle;
}
}
\ifnum\dimy=1
\def\lsty{\dimy}
\else
\def\lsty{\steppingy,\secondy,...,\dimy}
\fi
\foreach \y in \lsty
{ \foreach \z in {\steppingz,\secondz,...,\dimz}
{ \pgfmathsetmacro{\lowy}{(\y-\steppingy)}
\pgfmathsetmacro{\lowz}{(\z-\steppingz)}
\filldraw[cuboid/right] (\dimx,\lowy,\lowz) -- (\dimx,\lowy,\z) -- (\dimx,\y,\z) -- (\dimx,\y,\lowz) -- cycle;
}
}
\path (0,0,\dimz) -- (0,\dimy,\dimz) node[midway,above,edgelabel]{\yedgelabel};
\path (0,0,\dimz) -- (\dimx,0,\dimz) node[midway,below,edgelabel]{\xedgelabel};
\path (\dimx,0,\dimz) -- (\dimx,0,0) node[midway,below,edgelabel]{\zedgelabel};
\ifcuboidemphedge
\draw[cuboid/emphstyle] (0,\dimy,0) -- (\dimx,\dimy,0) -- (\dimx,\dimy,\dimz) -- (0,\dimy,\dimz) -- cycle;%
\draw[cuboid/emphstyle] (0,\dimy,\dimz) -- (0,0,\dimz) -- (\dimx,0,\dimz) -- (\dimx,\dimy,\dimz);%
\draw[cuboid/emphstyle] (\dimx,\dimy,0) -- (\dimx,0,0) -- (\dimx,0,\dimz);%
\fi
\ifcuboidshade
\pgfmathsetmacro{\cstepx}{\dimx/\tikzcuboidkey{shadesamples}}
\pgfmathsetmacro{\cstepy}{\dimy/\tikzcuboidkey{shadesamples}}
\pgfmathsetmacro{\cstepz}{\dimz/\tikzcuboidkey{shadesamples}}
\foreach \s in {1,...,\tikzcuboidkey{shadesamples}}
{ \pgfmathsetmacro{\lows}{\s-1}
\pgfmathsetmacro{\cpercent}{(\lows)/(\tikzcuboidkey{shadesamples}-1)*100}
\fill[opacity=\tikzcuboidkey{shadeopacity},color=\tikzcuboidkey{shadecolorlight}!\cpercent!\tikzcuboidkey{shadecolordark}] (0,\s*\cstepy,\dimz) -- (\s*\cstepx,\s*\cstepy,\dimz) -- (\s*\cstepx,0,\dimz) -- (\lows*\cstepx,0,\dimz) -- (\lows*\cstepx,\lows*\cstepy,\dimz) -- (0,\lows*\cstepy,\dimz) -- cycle;
\fill[opacity=\tikzcuboidkey{shadeopacity},color=\tikzcuboidkey{shadecolorlight}!\cpercent!\tikzcuboidkey{shadecolordark}] (0,\dimy,\s*\cstepz) -- (\s*\cstepx,\dimy,\s*\cstepz) -- (\s*\cstepx,\dimy,0) -- (\lows*\cstepx,\dimy,0) -- (\lows*\cstepx,\dimy,\lows*\cstepz) -- (0,\dimy,\lows*\cstepz) -- cycle;
\fill[opacity=\tikzcuboidkey{shadeopacity},color=\tikzcuboidkey{shadecolorlight}!\cpercent!\tikzcuboidkey{shadecolordark}] (\dimx,0,\s*\cstepz) -- (\dimx,\s*\cstepy,\s*\cstepz) -- (\dimx,\s*\cstepy,0) -- (\dimx,\lows*\cstepy,0) -- (\dimx,\lows*\cstepy,\lows*\cstepz) -- (\dimx,0,\lows*\cstepz) -- cycle;
}
\fi
\end{scope}
}
\makeatother
\begin{document}
\begin{figure}[htbp]
\centering
% \begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\begin{tikzpicture}[scale=0.6]
\tikzcuboid{%
shiftx=0cm,%
shifty=0cm,%
scale=1.00,%
rotation=0,%
densityx=1,%
densityy=1,%
densityz=1,%
dimx=2,%
dimy=1,%
dimz=2,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
% anglex=-7,%
% angley=90,%
% anglez=221.5,%
anglex=-10,%
angley=90,%
anglez=210.5,%
scalex=1.2,%
scaley=2.15,%
scalez=0.7,%
emphedge=false,%
shade,%
shadeopacity=0.15,%
xedgelabel={2.4 m},%
yedgelabel={2.15 m},%
zedgelabel={1.6 m},%
/tikz/edgelabel/.style={sloped},
}
\tikzcuboid{%
shiftx=10.5cm,%
shifty=0.7cm,%
% shadeopacity=0.30,%
dimx=5,%
dimy=1,%
dimz=5,%
xedgelabel={6 m},%
yedgelabel={2.15 m},%
zedgelabel={4 m},%
}
\end{tikzpicture}
\begin{tikzpicture}[scale=0.6]
% \begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\tikzcuboid{%
shiftx=0cm,%
shifty=0cm,%
scale=1.00,%
rotation=0,%
densityx=1,%
densityy=1,%
densityz=1,%
dimx=3,%
dimy=1,%
dimz=3,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
anglex=-10,%
angley=90,%
anglez=210.5,%
scalex=1.2,%
scaley=2.15,%
scalez=0.7,%
emphedge=false,%
shade,%
shadeopacity=0.15,%
xedgelabel={3.6 m},%
yedgelabel={2.15 m},%
zedgelabel={2.4 m},%
/tikz/edgelabel/.style={sloped},
}
\tikzcuboid{%
shiftx=10.5cm,%
shifty=0.7cm,%
% shadeopacity=0.30,%
dimx=6,%
dimy=1,%
dimz=6,%
xedgelabel={7.2 m},%
yedgelabel={2.15 m},%
zedgelabel={4.8 m},%
}
\end{tikzpicture}
% \begin{tikzpicture}[scale=0.6]
\begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\tikzcuboid{%
shiftx=0cm,%
shifty=0cm,%
scale=1.00,%
rotation=0,%
densityx=1,%
densityy=1,%
densityz=1,%
dimx=4,%
dimy=1,%
dimz=4,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
anglex=-10,%
angley=90,%
anglez=210.5,%
scalex=1.2,%
scaley=2.15,%
scalez=0.7,%
emphedge=false,%
shade,%
shadeopacity=0.15,%
xedgelabel={4.8 m},%
yedgelabel={2.15 m},%
zedgelabel={3.2 m},%
/tikz/edgelabel/.style={sloped},
}
\tikzcuboid{%
shiftx=10.5cm,%
shifty=0.7cm,%
% shadeopacity=0.30,%
dimx=7,%
dimy=1,%
dimz=7,%
xedgelabel={8.4 m},%
yedgelabel={2.15 m},%
zedgelabel={5.6 m},%
}
\end{tikzpicture}
\caption{Group of blocks tested.}
\label{fig:blocks}
\end{figure}
\end{document}
生成的图片太大。因此,为了将此图包含在标准纸张尺寸中,我测试了以下解决方案“如何缩放包含文本的 tikzpicture?”问题是,如果我仅缩小图形,则标签字体会变得很大,而如果我同时缩小图形和文本,则标签太小而看不到它们。
有没有什么办法可以独立于图形调整标签文本的比例?
问候
答案1
当然是了。幸运的是,你的代码有一个密钥edgelabel
(不知道为什么 ;-)。让我们关注右下角的图。我添加了scale=0.5,
和/tikz/edgelabel/.style={sloped,scale=2,transform shape},
以相对缩放它们并得到
\documentclass[parskip]{scrartcl}
% \usepackage[margin=15mm,landscape]{geometry}
% \usepackage{tikz}
\usepackage{tikzcuboids}
\begin{document}
\begin{figure}[htbp]
\centering
% \begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\begin{tikzpicture}[scale=0.6]
\tikzcuboid{%
shiftx=0cm,%
shifty=0cm,%
scale=1.00,%
rotation=0,%
densityx=1,%
densityy=1,%
densityz=1,%
dimx=2,%
dimy=1,%
dimz=2,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
% anglex=-7,%
% angley=90,%
% anglez=221.5,%
anglex=-10,%
angley=90,%
anglez=210.5,%
scalex=1.2,%
scaley=2.15,%
scalez=0.7,%
emphedge=false,%
shade,%
shadeopacity=0.15,%
xedgelabel={2.4 m},%
yedgelabel={2.15 m},%
zedgelabel={1.6 m},%
/tikz/edgelabel/.style={sloped},
}
\tikzcuboid{%
shiftx=10.5cm,%
shifty=0.7cm,%
% shadeopacity=0.30,%
dimx=5,%
dimy=1,%
dimz=5,%
xedgelabel={6 m},%
yedgelabel={2.15 m},%
zedgelabel={4 m},%
}
\end{tikzpicture}
\begin{tikzpicture}[scale=0.6]
% \begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\tikzcuboid{%
shiftx=0cm,%
shifty=0cm,%
scale=1.00,%
rotation=0,%
densityx=1,%
densityy=1,%
densityz=1,%
dimx=3,%
dimy=1,%
dimz=3,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
anglex=-10,%
angley=90,%
anglez=210.5,%
scalex=1.2,%
scaley=2.15,%
scalez=0.7,%
emphedge=false,%
shade,%
shadeopacity=0.15,%
xedgelabel={3.6 m},%
yedgelabel={2.15 m},%
zedgelabel={2.4 m},%
/tikz/edgelabel/.style={sloped},
}
\tikzcuboid{%
shiftx=10.5cm,%
shifty=0.7cm,%
% shadeopacity=0.30,%
dimx=6,%
dimy=1,%
dimz=6,%
xedgelabel={7.2 m},%
yedgelabel={2.15 m},%
zedgelabel={4.8 m},%
}
\end{tikzpicture}
% \begin{tikzpicture}[scale=0.6]
\begin{tikzpicture}[thick,scale=0.6, every node/.style={transform shape}]
\tikzcuboid{%
shiftx=0cm,%
shifty=0cm,%
scale=1.00,%
rotation=0,%
densityx=1,%
densityy=1,%
densityz=1,%
dimx=4,%
dimy=1,%
dimz=4,%
front/.style={draw=blue!75!black,fill=blue!25!white},%
right/.style={draw=blue!25!black,fill=blue!75!white},%
top/.style={draw=blue!50!black,fill=blue!50!white},%
anglex=-10,%
angley=90,%
anglez=210.5,%
scalex=1.2,%
scaley=2.15,%
scalez=0.7,%
emphedge=false,%
shade,%
shadeopacity=0.15,%
xedgelabel={4.8 m},%
yedgelabel={2.15 m},%
zedgelabel={3.2 m},%
/tikz/edgelabel/.style={sloped},
}
\tikzcuboid{%
shiftx=10.5cm,%
shifty=0.7cm,%
% shadeopacity=0.30,%
scale=0.5,
dimx=7,%
dimy=1,%
dimz=7,%
xedgelabel={8.4 m},%
yedgelabel={2.15 m},%
zedgelabel={5.6 m},%
/tikz/edgelabel/.style={sloped,scale=2,transform shape},
}
\end{tikzpicture}
\caption{Group of blocks tested.}
\label{fig:blocks}
\end{figure}
\end{document}
如果将其与您的版本进行比较,您会发现长方体已经缩小,但文本没有缩小并且仍然可读。
在这里,我将定义外包到一个文件中tikzcuboids.sty
,该文件具有更新(更新原因:问题这里) 内容
\RequirePackage{tikz}
\newif\ifcuboidshade
\newif\ifcuboidemphedge
\tikzset{
cuboid/.is family,
cuboid,
shiftx/.initial=0,
shifty/.initial=0,
dimx/.initial=3,
dimy/.initial=3,
dimz/.initial=3,
scale/.initial=1,
densityx/.initial=1,
densityy/.initial=1,
densityz/.initial=1,
rotation/.initial=0,
anglex/.initial=0,
angley/.initial=90,
anglez/.initial=225,
scalex/.initial=1,
scaley/.initial=1,
scalez/.initial=0.5,
xedgelabel/.store in=\xedgelabel,
yedgelabel/.store in=\yedgelabel,
zedgelabel/.store in=\zedgelabel,
xedgelabel={},
yedgelabel={},
zedgelabel={},
edgelabel/.style={},
front/.style={draw=black,fill=white},
top/.style={draw=black,fill=white},
right/.style={draw=black,fill=white},
shade/.is if=cuboidshade,
shadecolordark/.initial=black,
shadecolorlight/.initial=white,
shadeopacity/.initial=0.15,
shadesamples/.initial=16,
emphedge/.is if=cuboidemphedge,
emphstyle/.style={thick},
}
\newcommand{\tikzcuboidkey}[1]{\pgfkeysvalueof{/tikz/cuboid/#1}}
% Commands
\newcommand{\tikzcuboid}[1]{
\tikzset{cuboid,#1} % Process Keys passed to command
\pgfmathsetlengthmacro{\vectorxx}{\tikzcuboidkey{scalex}*cos(\tikzcuboidkey{anglex})*28.452756}
\pgfmathsetlengthmacro{\vectorxy}{\tikzcuboidkey{scalex}*sin(\tikzcuboidkey{anglex})*28.452756}
\pgfmathsetlengthmacro{\vectoryx}{\tikzcuboidkey{scaley}*cos(\tikzcuboidkey{angley})*28.452756}
\pgfmathsetlengthmacro{\vectoryy}{\tikzcuboidkey{scaley}*sin(\tikzcuboidkey{angley})*28.452756}
\pgfmathsetlengthmacro{\vectorzx}{\tikzcuboidkey{scalez}*cos(\tikzcuboidkey{anglez})*28.452756}
\pgfmathsetlengthmacro{\vectorzy}{\tikzcuboidkey{scalez}*sin(\tikzcuboidkey{anglez})*28.452756}
\begin{scope}[xshift=\tikzcuboidkey{shiftx}, yshift=\tikzcuboidkey{shifty}, scale=\tikzcuboidkey{scale}, rotate=\tikzcuboidkey{rotation}, x={(\vectorxx,\vectorxy)}, y={(\vectoryx,\vectoryy)}, z={(\vectorzx,\vectorzy)}]
\pgfmathsetmacro{\steppingx}{1/\tikzcuboidkey{densityx}}
\pgfmathsetmacro{\steppingy}{1/\tikzcuboidkey{densityy}}
\pgfmathsetmacro{\steppingz}{1/\tikzcuboidkey{densityz}}
\newcommand{\dimx}{\tikzcuboidkey{dimx}}
\newcommand{\dimy}{\tikzcuboidkey{dimy}}
\newcommand{\dimz}{\tikzcuboidkey{dimz}}
\pgfmathsetmacro{\secondx}{2*\steppingx}
\pgfmathsetmacro{\secondy}{2*\steppingy}
\pgfmathsetmacro{\secondz}{2*\steppingz}
\ifnum\dimx=1
\def\lstx{\dimx}
\else
\def\lstx{\steppingx,\secondx,...,\dimx}
\fi
\foreach \x in \lstx
{\ifnum\dimy=1
\def\lsty{\dimy}
\else
\def\lsty{\steppingy,\secondy,...,\dimy}
\fi
\foreach \y in \lsty
{ \pgfmathsetmacro{\lowx}{(\x-\steppingx)}
\pgfmathsetmacro{\lowy}{(\y-\steppingy)}
\filldraw[cuboid/front] (\lowx,\lowy,\dimz) -- (\lowx,\y,\dimz) -- (\x,\y,\dimz) -- (\x,\lowy,\dimz) -- cycle;
}
}
\ifnum\dimx=1
\def\lstx{\dimx}
\else
\def\lstx{\steppingx,\secondx,...,\dimx}
\fi
\foreach \x in \lstx
{ \ifnum\dimz=1
\def\lstz{\dimz}
\else
\def\lstz{\steppingz,\secondz,...,\dimz}
\fi
\foreach \z in \lstz
{ \pgfmathsetmacro{\lowx}{(\x-\steppingx)}
\pgfmathsetmacro{\lowz}{(\z-\steppingz)}
\filldraw[cuboid/top] (\lowx,\dimy,\lowz) -- (\lowx,\dimy,\z) -- (\x,\dimy,\z) -- (\x,\dimy,\lowz) -- cycle;
}
}
\ifnum\dimy=1
\def\lsty{\dimy}
\else
\def\lsty{\steppingy,\secondy,...,\dimy}
\fi
\foreach \y in \lsty
{ \ifnum\dimz=1
\def\lstz{\dimz}
\else
\def\lstz{\steppingz,\secondz,...,\dimz}
\fi
\foreach \z in \lstz
{ \pgfmathsetmacro{\lowy}{(\y-\steppingy)}
\pgfmathsetmacro{\lowz}{(\z-\steppingz)}
\filldraw[cuboid/right] (\dimx,\lowy,\lowz) -- (\dimx,\lowy,\z) -- (\dimx,\y,\z) -- (\dimx,\y,\lowz) -- cycle;
}
}
\path (0,0,\dimz) -- (0,\dimy,\dimz) node[midway,above,edgelabel]{\yedgelabel};
\path (0,0,\dimz) -- (\dimx,0,\dimz) node[midway,below,edgelabel]{\xedgelabel};
\path (\dimx,0,\dimz) -- (\dimx,0,0) node[midway,below,edgelabel]{\zedgelabel};
\ifcuboidemphedge
\draw[cuboid/emphstyle] (0,\dimy,0) -- (\dimx,\dimy,0) -- (\dimx,\dimy,\dimz) -- (0,\dimy,\dimz) -- cycle;%
\draw[cuboid/emphstyle] (0,\dimy,\dimz) -- (0,0,\dimz) -- (\dimx,0,\dimz) -- (\dimx,\dimy,\dimz);%
\draw[cuboid/emphstyle] (\dimx,\dimy,0) -- (\dimx,0,0) -- (\dimx,0,\dimz);%
\fi
\ifcuboidshade
\pgfmathsetmacro{\cstepx}{\dimx/\tikzcuboidkey{shadesamples}}
\pgfmathsetmacro{\cstepy}{\dimy/\tikzcuboidkey{shadesamples}}
\pgfmathsetmacro{\cstepz}{\dimz/\tikzcuboidkey{shadesamples}}
\foreach \s in {1,...,\tikzcuboidkey{shadesamples}}
{ \pgfmathsetmacro{\lows}{\s-1}
\pgfmathsetmacro{\cpercent}{(\lows)/(\tikzcuboidkey{shadesamples}-1)*100}
\fill[opacity=\tikzcuboidkey{shadeopacity},color=\tikzcuboidkey{shadecolorlight}!\cpercent!\tikzcuboidkey{shadecolordark}] (0,\s*\cstepy,\dimz) -- (\s*\cstepx,\s*\cstepy,\dimz) -- (\s*\cstepx,0,\dimz) -- (\lows*\cstepx,0,\dimz) -- (\lows*\cstepx,\lows*\cstepy,\dimz) -- (0,\lows*\cstepy,\dimz) -- cycle;
\fill[opacity=\tikzcuboidkey{shadeopacity},color=\tikzcuboidkey{shadecolorlight}!\cpercent!\tikzcuboidkey{shadecolordark}] (0,\dimy,\s*\cstepz) -- (\s*\cstepx,\dimy,\s*\cstepz) -- (\s*\cstepx,\dimy,0) -- (\lows*\cstepx,\dimy,0) -- (\lows*\cstepx,\dimy,\lows*\cstepz) -- (0,\dimy,\lows*\cstepz) -- cycle;
\fill[opacity=\tikzcuboidkey{shadeopacity},color=\tikzcuboidkey{shadecolorlight}!\cpercent!\tikzcuboidkey{shadecolordark}] (\dimx,0,\s*\cstepz) -- (\dimx,\s*\cstepy,\s*\cstepz) -- (\dimx,\s*\cstepy,0) -- (\dimx,\lows*\cstepy,0) -- (\dimx,\lows*\cstepy,\lows*\cstepz) -- (\dimx,0,\lows*\cstepz) -- cycle;
}
\fi
\end{scope}
}
但请注意,认真编写软件包远不止我在这里所做的。我不是一个认真编写软件包的人。认真编写软件包的人将能够使这个软件包变得更好。