Abaqus/Python - commands to find nearest node to a given point
Abaqus/Python - commands to find nearest node to a given point
(OP)
Hi,
I need to write a python comman code to find a node (in a given set), nearest to a given point.
The code now looks as follows:
import sys
sys.path.insert(10,
r'c:/SIMULIA/Abaqus/6.13-3/code/python/lib/abaqus_plugins/findNearestNode')
import nearestNodeModule
nearestNodeModule.hideTextAndArrow()
a = mdb.models['FibreModel'].rootAssembly
n1 = a.instances['Fibre0-1'].nodes
pickedSelectedNodes = n1[0:599]
g=nearestNodeModule.findNearestNode(xcoord=101, ycoord=106, zcoord=58, name='', selectedNodes=pickedSelectedNodes, instanceName="'Fibre2-1'")
ct=g[0]
And I get an error:
File "SMAPyaModules\SMAPyaPluginsPy.m\src\abaqus_plugin s\findNearestNode\nearestNodeModule.py", line 71, in findNearestNode
AttributeError: 'NoneType' object has no attribute 'instances'
Does anyone know what is wrong there?
Leon
I need to write a python comman code to find a node (in a given set), nearest to a given point.
The code now looks as follows:
import sys
sys.path.insert(10,
r'c:/SIMULIA/Abaqus/6.13-3/code/python/lib/abaqus_plugins/findNearestNode')
import nearestNodeModule
nearestNodeModule.hideTextAndArrow()
a = mdb.models['FibreModel'].rootAssembly
n1 = a.instances['Fibre0-1'].nodes
pickedSelectedNodes = n1[0:599]
g=nearestNodeModule.findNearestNode(xcoord=101, ycoord=106, zcoord=58, name='', selectedNodes=pickedSelectedNodes, instanceName="'Fibre2-1'")
ct=g[0]
And I get an error:
File "SMAPyaModules\SMAPyaPluginsPy.m\src\abaqus_plugin s\findNearestNode\nearestNodeModule.py", line 71, in findNearestNode
AttributeError: 'NoneType' object has no attribute 'instances'
Does anyone know what is wrong there?
Leon





RE: Abaqus/Python - commands to find nearest node to a given point
I made a simple test and it worked with
nearestNodeModule.findNearestNode(xcoord=31, ycoord=0, zcoord=17, name='Job-1.odb')
and
nearestNodeModule.findNearestNode(xcoord=31, ycoord=0, zcoord=17, name='Job-1.odb', instanceName='block-1')
RE: Abaqus/Python - commands to find nearest node to a given point
RE: Abaqus/Python - commands to find nearest node to a given point
nearestNodeModule.findNearestNode(xcoord=31, ycoord=0, zcoord=17, name='')
Be sure to use two ' instead of one ".
RE: Abaqus/Python - commands to find nearest node to a given point
File "SMAPyaModules\SMAPyaPluginsPy.m\src\abaqus_plugins\findNearestNode\nearestNodeModule.py", line 71, in findNearestNode
AttributeError: 'NoneType' object has no attribute 'instances.
But sometimes it works.
The code is given below.
I tried both sinlge and double quota marks, it did not change much.
-----------------------------------------
import sys
sys.path.insert(30,
r'c:/SIMULIA/Abaqus/6.13-3/code/python/lib/abaqus_plugins/findNearestNode')
import nearestNodeModule
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
meshTechnique=ON)
nearestNodeModule.hideTextAndArrow()
a = mdb.models['FibreModel'].rootAssembly
n1 = a.instances['Fibre0-1'].nodes
pickedSelectedNodes = n1[0:599]
g=nearestNodeModule.findNearestNode(xcoord=200, ycoord=220, zcoord=230, name='',
selectedNodes=pickedSelectedNodes, instanceName="'Fibre0-1'")
ct=g[0]
setName='Set-'+str(ct)
p = mdb.models['FibreModel']
setName='Set-'+str(ct)
p.rootAssembly.Set(name=setName, nodes=p.rootAssembly.instances['Fibre0-1'].nodes[ct-1:ct])
a = mdb.models['FibreModel'].rootAssembly
region1=a.sets['Sta1']
a = mdb.models['FibreModel'].rootAssembly
region2=a.sets['Set-281']
mdb.models['FibreModel'].Coupling(name='Constraint-18', controlPoint=region1,
surface=region2, influenceRadius=WHOLE_SURFACE, couplingType=KINEMATIC,
localCsys=None, u1=ON, u2=ON, u3=ON, ur1=OFF, ur2=OFF, ur3=OFF)
RE: Abaqus/Python - commands to find nearest node to a given point
RE: Abaqus/Python - commands to find nearest node to a given point
instanceName="'Fibre0-1'"
Try
instanceName='Fibre0-1'
RE: Abaqus/Python - commands to find nearest node to a given point
Can it be that this command works only with ODB files, and, thus can not help to build CAE file via Python code?
RE: Abaqus/Python - commands to find nearest node to a given point
nearestNodeModule.findNearestNode(xcoord=1, ycoord=0, zcoord=0, name='')
RE: Abaqus/Python - commands to find nearest node to a given point