ABAQUS中的wireType的NameError警告 [英] Warning of NameError for wireType in ABAQUS

查看:658
本文介绍了ABAQUS中的wireType的NameError警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用脚本通过电线连接点.发生有关NameError的警告.

I tried to connect points through wires using script. A warning regarding the NameError occurred.

我试图在abaqus中运行的代码:

the code i tried to run in abaqus:

a = mdb.models['Model-1'].rootAssembly
v11 = a.instances['r-mesh-2'].vertices
v12 = a.instances['s-mesh-1'].vertices
v13 = a.instances['r-mesh-1'].vertices
v14 = a.instances['s-mesh-1-lin-2-1'].vertices
a.WirePolyLine(points=((v11.findAt(coordinates=(2.595, 0.22, -35.7)), 
    v12.findAt(coordinates=(2.595, 0.2, -35.7))), (v11.findAt(coordinates=(
    2.445, 0.22, -35.7)), v12.findAt(coordinates=(2.445, 0.2, -35.7))), (
    v13.findAt(coordinates=(1.095, 0.22, -35.7)), v12.findAt(coordinates=(
    1.095, 0.2, -35.7))), (v13.findAt(coordinates=(0.945, 0.22, -35.7)), 
    v12.findAt(coordinates=(0.945, 0.2, -35.7))), (v11.findAt(coordinates=(
    2.595, 0.22, -35.1)), v14.findAt(coordinates=(2.595, 0.2, -35.1)))), 
    mergeType=IMPRINT, meshable=OFF)
a = mdb.models['Model-1'].rootAssembly
e1 = a.edges
edges1 = e1.findAt(((2.595, 0.215, -35.1), ), ((0.945, 0.215, -35.7), ), ((
    1.095, 0.215, -35.7), ), ((2.445, 0.215, -35.7), ), ((2.595, 0.215, -35.7), 
    ))
a.Set(edges=edges1, name='Wire-1-Set-1')

这是错误: NameError:未定义名称"IMPRINT"

Here's the error: NameError: name 'IMPRINT' is not defined

又一次,我有意将代码的那部分更改为'mergeType ='IMPRINT',然后错误变为: TypeError:mergeType;找到的字符串,期望IMPRINT,MERGE或SEPARATE

Another time I purposefully changed that part of the code as 'mergeType='IMPRINT', then the error becomes: TypeError: mergeType; found string, expecting IMPRINT, MERGE or SEPARATE

如何解决问题?

谢谢

推荐答案

给出错误的模块期望来自另一个模块的某个常数.导入具有必要常量的模块:

The module giving you the error is expecting a certain constant from another module. Import the module with the necessary constants:

from abaqusConstants import *

然后使用mergeType=IMPRINT, ...进行操作.或者,您可以避免污染您的名称空间并为其取别名:

Then use mergeType=IMPRINT, ... as you are already doing. Or you could avoid polluting your namespace and alias it instead:

import abaqusConstants as ac

然后使用mergeType=ac.IMPRINT, ....

这篇关于ABAQUS中的wireType的NameError警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆