注册 登录
编程论坛 Python论坛

python编写ansys maxwell中脚本 画弧画线程序语句

纽特的嗅嗅 发布于 2019-12-17 17:09, 1902 次点击

```
#绘制转子外轮廓
def _rotor(self, funcLib, OD, YD, Le, Poles, NA, NOA1, NOA2, ND, NFL1,NFL2,NFL3):        
        thePointArray = []
        #pp = Poles/2
        point0_x = 0.0
        point0_y = 0.5*OD
        
        point1_x = 0.5*OD*sin(pi*((NA-NOA1)/180.0)/Poles/2.0)
        point1_y = 0.5*OD*cos(pi*((NA-NOA1)/180.0)/Poles/2.0)

        point2_x = 0.5*OD*sin(pi*((NA-NOA1)/180.0)/Poles)
        point2_y = 0.5*OD*cos(pi*((NA-NOA1)/180.0)/Poles)
        
        point3_x = 0.5*(OD-2.0*ND)*sin(pi*(NA/180.0)/Poles)
        point3_y = 0.5*(OD-2.0*ND)*cos(pi*(NA/180.0)/Poles)
        
        point4_x = 0.5*OD*sin(pi*((NA+NOA2)/180.0)/Poles)
        point4_y = 0.5*OD*cos(pi*((NA+NOA2)/180.0)/Poles)   
        
        point5_x = 0.5*OD*sin((pi*((NA+NOA2)/180.0)/Poles+pi/Poles)/2.0)
        point5_y = 0.5*OD*cos((pi*((NA+NOA2)/180.0)/Poles+pi/Poles)/2.0)   

        point6_x = 0.5*OD*sin(pi/Poles)
        point6_y = 0.5*OD*cos(pi/Poles)
   
        point7_x = 0.5*YD*sin(pi/Poles)
        point7_y = 0.5*YD*cos(pi/Poles)   
        
        point8_x = 0.5*YD*sin(pi/Poles/2.0)
        point8_y = 0.5*YD*cos(pi/Poles/2.0)   
        
        point9_x = 0.0
        point9_y = 0.5*YD   
        #生成点阵列
        thePointArray = []
        thePointArray.append(UDPPosition(point0_x,point0_y,0.0))
        thePointArray.append(UDPPosition(point1_x,point1_y,0.0))
        thePointArray.append(UDPPosition(point2_x,point2_y,0.0))
        thePointArray.append(UDPPosition(point3_x,point3_y,0.0))
        thePointArray.append(UDPPosition(point4_x,point4_y,0.0))
        thePointArray.append(UDPPosition(point5_x,point5_y,0.0))        
        thePointArray.append(UDPPosition(point6_x,point6_y,0.0))
        thePointArray.append(UDPPosition(point7_x,point7_y,0.0))
        thePointArray.append(UDPPosition(point8_x,point8_y,0.0))
        thePointArray.append(UDPPosition(point9_x,point9_y,0.0))
        thePointArray.append(UDPPosition(point0_x,point0_y,0.0))   
        #把点连起来,生成线阵列
        theSegArray = []
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.ArcSegment,0,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.LineSegment,2,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.LineSegment,3,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.ArcSegment,4,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.LineSegment,6,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.ArcSegment,7,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
        theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.LineSegment,9,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)
        theSegArray.append(theSegDefinition)
```
程序大概意思明白,是先生成点阵列,x y坐标表示出来,但不明白连线的语句是什么意思,如:
theSegDefinition = UDPPolylineSegmentDefinition(PolylineSegmentType.ArcSegment,0,0,0.0,UDPPosition(0,0,0),CoordinateSystemPlane.XYPlane)


只有本站会员才能查看附件,请 登录

画的是蓝线圈出的轮廓,的确是七个点连起来,用到的是point0,2,3,4,6,7,9

这是画弧的语句,其中0,0,0.0第一个0是point0的意思的话,后两个0,0.0是什么意思呢,UDPPosition(0,0,0)代表什么呢,而且画弧需要三个点吧,这三个点分别是什么呢

0 回复
1