标题:python编写ansys maxwell中脚本 画弧画线程序语句
只看楼主
纽特的嗅嗅
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2019-12-17
 问题点数:0 回复次数:0 
python编写ansys maxwell中脚本 画弧画线程序语句

```
#绘制转子外轮廓
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)代表什么呢,而且画弧需要三个点吧,这三个点分别是什么呢

搜索更多相关主题的帖子: append 线程 sin cos 语句 
2019-12-17 17:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-498466-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.447225 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved