Warning of NameError for wireType in ABAQUS

2019-07-31 18:57发布

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条回答
走好不送
2楼-- · 2019-07-31 19:22

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, ....

查看更多
登录 后发表回答