Warning of NameError for wireType in ABAQUS

久未见 提交于 2019-12-11 05:18:27

问题


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

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')

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

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

How to solve the problem?

thanks


回答1:


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

from abaqusConstants import *

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

import abaqusConstants as ac

And then use mergeType=ac.IMPRINT, ....



来源:https://stackoverflow.com/questions/40528369/warning-of-nameerror-for-wiretype-in-abaqus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!