![螺旋线的绘制](https://linux22.com/image/260737/%E8%9E%BA%E6%97%8B%E7%BA%BF%E7%9A%84%E7%BB%98%E5%88%B6.png)
在这个博客我找到了 Thomas Söll 绘制的变压器 3D 图纸。
经过一些更改后,我得到了以下代码:
\documentclass{article}
\usepackage{pst-solides3d}
\usepackage{expl3}
% Parameters.
\def\radius{1.11}
\def\windingsOne{32}
\def\windingsTwo{64}
% Activating floating point calculation.
\ExplSyntaxOn
\cs_new_eq:NN
\calc
\fp_eval:n
\ExplSyntaxOff
% Constants.
\def\factor{\calc{5*\windingsTwo}}
\def\lengthA{\calc{2*pi*\windingsOne/\factor}}
\def\lengthB{\calc{2/5*pi}}
\def\vertDist{\calc{3/4*pi}}
\def\thickness{\calc{16/(25*\windingsTwo)}}
% Global setup.
\psset{%
viewpoint=20 5 15 rtp2xyz,
lightsrc=20 60 60 rtp2xyz,
Decran=30
}
\psset{%
solidmemory,
algebraic
}
% Objects with predefined options.
\newpsobject{core}{psSolid}{%
object=parallelepiped,
incolor=red,
fillcolor=cyan!50,
grid=false
}
\newpsobject{wire}{psSolid}{
object=courbe,
r=\thickness,
linewidth=0.5pt,
linecolor=red!60,
incolor=red!60,
fillcolor=red!60,
resolution=727,
ngrid=727 30,
action=none
}
\newpsobject{connect}{psSolid}{
object=fusion,
linecolor=gray,
grid=false,
action=draw**
}
\pagestyle{empty}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{pspicture}(-3,-3)(8,8)
% --------------- Core ---------------
\core[a=1,b=5,c=1,action=draw**,name=H1](0,1.5,-0.5)
\core[a=1,b=1,c=3,action=none,name=H2](0,-0.5,1.5)
\core[a=1,b=1,c=3,action=none,name=H3](0,3.5,1.5)
% --------------- Wire ---------------
{\defFunction{helixA}(t){\radius*cos(\factor*t)}{\radius*sin(\factor*t)}{\vertDist*t}
\wire[function=helixA,range=0 \lengthA,name=wire1](0,-0.5,0)}%
{\defFunction{helixB}(t){\radius*cos(\factor*t)}{-\radius*sin(\factor*t)}{\vertDist*t}
\wire[function=helixB,range=0 \lengthB,name=wire2](0,3.5,0)}%
% ------------- Assembly -------------
\connect[base=H2 wire1]
\connect[base=H3 wire2]
\composeSolid
\core[a=1,b=5,c=1,action=draw**,name=H4](0,1.5,3.5)
\end{pspicture}
\end{figure}
\end{document}
\factor
我的问题是,常数、\lengthA
、\lengthB
、\vertDist
和的值\thickness
是手动找到的。有人能告诉我,如果它们应该取决于变压器铁芯周围的绕组数,那么它们到底应该是多少吗?
PS 代码需要很长时间(在我的计算机上大约 1 分钟)来编译,所以如果有人可以告诉我如何缩短编译时间,请告诉我!
最终版本
\documentclass{article}
\usepackage{pst-solides3d}
%% Parameters
% Windings
\def\lWind{60}
\def\rWind{30}
% Radii
\def\rHelix{1.13}
\def\rWire{0.006}
% Constants
\def\factor{160} % \factor > \lWind,\rWind
\pstVerb{%
/left 2 \lWind\space mul \factor\space div def
/right 2 \rWind\space mul \factor\space div def
}
%% Colours
\colorlet{wireColor}{red!60}
\colorlet{coreColor}{cyan!50}
%% Wire
\newpsobject{wire}{psSolid}{%
object=courbe,
% Choose max(left,right)
% The smaller max(left,right), the larger the constant multiplied with it
ngrid=970 left mul cvi 15,
r=\rWire,
fillcolor=wireColor,
incolor=wireColor
}
\pagestyle{empty}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{pspicture}(-5,-5)(5,5)
\psset{%
algebraic,
viewpoint=20 5 10 rtp2xyz,
lightsrc=20 60 60 rtp2xyz,
Decran=30,
solidmemory,
action=none,
grid=false
}
%%--------- Core ----------
\psSolid[object=anneau,h=1.0,R=4,r=2.5,ngrid=4,RotZ=90,RotY=45,RotX=90,
fillcolor=coreColor,name=core]
%%--------- Wire ----------
% Left
\defFunction{heliceA}(t){\rHelix*cos(\factor*t)}{\rHelix*sin(\factor*t)}{t/left}
\wire[function=heliceA,range=0 Pi left mul,name=wireA](0,-2.25,-1.5)
% Right
\defFunction{heliceB}(t){\rHelix*cos(\factor*t)}{-\rHelix*sin(\factor*t)}{t/right}
\wire[function=heliceB,range=0 Pi right mul,name=wireB](0,2.25,-1.5)
%%------- Assembly --------
\psSolid[object=fusion,base=core wireA wireB,action=draw**]
\end{pspicture}
\end{figure}
\end{document}
答案1
首先:创建最小示例!在这里,您是否会说丹麦语并不重要!
\documentclass{minimal}
\pagestyle{empty}
\usepackage{pst-solides3d}
\begin{document}
\def\Ra{1} \def\Rb{0.025}
\def\F{80}
\def\Nleft{0.75 } \def\Nright{0.25 }% Max wire is 1
\begin{pspicture}(-5,-5)(5,5)
\psset{viewpoint=20 5 10 rtp2xyz,lightsrc=20 60 60 rtp2xyz,Decran=30,solidmemory,
action=none,grid=false,fillcolor=cyan!50}
%--------- iron ---------------------------------------
\psSolid[object=anneau,h=1.,R=4,r=2.5,ngrid=4,RotZ=90,RotY=45,RotX=90,name=iron]
%--------- wire -------------------------------------
\defFunction[algebraic]{heliceA}(t){\Ra*cos(\F*t)}{\Ra*sin(\F*t)}{t/\Nleft}% left
\psSolid[object=courbe,range=0 3 \Nleft mul,function=heliceA,r=\Rb,
fillcolor=red!60,incolor=red!60,ngrid=720 \Nleft mul cvi 15,name=wire1](0,-2.25,-1.5)
%
\defFunction[algebraic]{heliceB}(t){\Ra*cos(\F*t)}{-\Ra*sin(\F*t)}{t/\Nright}% right
\psSolid[object=courbe,range=0 3 \Nright mul,function=heliceB,r=\Rb,
fillcolor=red!60,incolor=red!60,ngrid=720 \Nleft mul cvi 15,name=wire2](0,2.25,-1.5)
%-------- Compose -------------------------------------
\psSolid[object=fusion,base=iron wire1 wire2,action=draw**]
\end{pspicture}
\end{document}
与
\def\Nleft{0.2 } \def\Nright{0.1 }% Max wire is 1