Abaqus 6.142 scrip中的键错误

2024-05-15 00:41:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试运行一个Python脚本,该脚本来自softrobotics工具箱的finitemodeling部分,用于创建气动执行器的分析。但是,我不断得到以下错误:

 mdb.models['Model-1'].parts['fibers'].WireSpline(meshable=ON, points=myPoints, smoothClosedSpline=ON)
KeyError: fibers

代码附在下面:

#########################################
## import the necessary python modules ##
#########################################
from part import *
import math
import bisect
from odbAccess import * 
backwardCompatibility.setValues(includeDeprecated=OFF)
#######################
## define parameters ##
#######################
FIBER_LEN_INIT = 1.0 #length at top and bottom of the actuator which is not surrounded by fiber
RAD_EXT = 8.35 #external radius of the actuator
ALPHA = 3.0 #fiber angle in degrees
LEN_ACT=165.0

############################################################
# create list of points in a circle 
############################################################
a = 0
b = 200
f = 2*pi/b
angle_array = [x * f for x in range(a, b)]

############################################################
# define the fiber geometry 
############################################################
FIBER_SPACING = 2.0*pi*RAD_EXT/tan((90.0-ALPHA)*pi/180.0) #vertical distance between fiber loops (pitch of the helix)
LOOPS = int((LEN_ACT-2*FIBER_LEN_INIT)/FIBER_SPACING)+1 #number of fiber loops
NUMFIBERS=int(max(13.0*sin(ALPHA*pi/180.0)+0.5,1.0))
OFFSET=2.0*pi/float(NUMFIBERS)

for j in range(0,NUMFIBERS):
    point_vec=[]
    point_z=[]
    for i in range(0,len(angle_array)):
        angle=angle_array[i]
        point_vec=point_vec+[RAD_EXT*math.cos(angle+j*OFFSET),RAD_EXT*math.sin(angle+j*OFFSET),FIBER_SPACING*angle/(2.0*math.pi)]
    myPoints=()
    for i in range(0,LOOPS):
        for k in range(0,len(point_vec)/3):
            myPoints=myPoints+((point_vec[3*k],point_vec[3*k+1],point_vec[3*k+2]+i*FIBER_SPACING+FIBER_LEN_INIT),)
        point_z=point_z+[point_vec[3*k+2]+i*FIBER_SPACING+FIBER_LEN_INIT] #cut off last loop when top of actuator is reached

    index=bisect.bisect(point_z,LEN_ACT-FIBER_LEN_INIT)
    myPoints=myPoints[0:index+1]

    mdb.models['Model-1'].parts['fibers'].WireSpline(meshable=ON, points=myPoints, smoothClosedSpline=ON)

你知道是什么导致了这些问题吗?我试图删除'Model-1'和'fibers'中的引号,但似乎不起作用。这是因为Abaqus功能较旧版本有所改变吗


Tags: oftheinimportforleninitpi

热门问题