User login

You are here

Abaqus/Python - commands to find nearest node to a given point

Leon Mishnaevsky's picture

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

Comments

Frank Richter's picture

The question was also adressed on

http://imechanica.org/comment/26355#comment-26355

I attach a script with instruction from an old Abaqus site.

 

Frank

-------------------------------------------

Find Nearest Node Plug-in

 

 

 

NOTE: This plug-in has undergone testing and is expected to work with the version of Abaqus that it is shipped with.  However, the level of testing is not as stringent as that for the Abaqus products in general.  Limited support will be available from Dassault Systemes, for this plug-in, and it may not be available with future Abaqus releases.

 

 

 

Overview

 

 

 

This plug-in locates the node in a model database (MDB) or output database (ODB) that is nearest to a specified coordinate point.  The plug-in works with meshed models (in an MDB) and undeformed plots (in an ODB); the plug-in does not work with deformed plots in an ODB. 

 

 

 

For large models, you can specify the area of the model to search by selecting a subset of nodes from the viewport.

 

                                                                                  

 

Installation

 

 

 

To install the plug-in, unzip and save the contents of the attached archive to one of the following directories:

 

  • abaqus_dir\cae\abaqus_plugins, where abaqus_dir is the ABAQUS parent directory
  • home_dir\abaqus_plugins, where home_dir is your home directory
  • current_dir\abaqus_plugins, where current_dir is the current directory

 

 

 

After installing the plug-in, start Abaqus/CAE and enter any assembly-related module or the Visualization module.  Find Nearest Node is available in the Plug-ins menu on the main menu bar (Plug-insàAbaqusàFind Nearest Node).

 

 

 

Usage

 

 

 

Enter the X, Y, and Z coordinates for the starting point.  Click Find to highlight in the viewport the node nearest to the specified starting coordinates.  Click the Select Nodes for Reduced Search button and select nodes in the viewport to limit your search to a particular area of the model.

 

 

 

Limitation

 

 

When searching in reduced mode, only nodes on one instance can be selected.

-----------------------------------

from abaqusGui import *
import _abqPluginUtils, os
thisPath = os.path.abspath(__file__)
thisDir = os.path.dirname(thisPath)

# Use package syntax to avoid possible name clashes with other plugins
#
from abq_FindNearestNode.nearestNodeForm import NearestNodeForm

# Register commands
#
version = '2.1-1'
status = _abqPluginUtils.checkCompatibility('Find Nearest Node', version)
if status == 'OK':
    toolset=getAFXApp().getAFXMainWindow().getPluginToolset()
    toolset.registerGuiMenuButton(
        object=NearestNodeForm(toolset),
        buttonText='Abaqus|Find Nearest Node...',
        messageId=AFXMode.ID_ACTIVATE,
        icon=None,
        kernelInitString='import abq_FindNearestNode.nearestNodeModule',
        applicableModules=["Assembly","Step","Interaction","Load","Mesh","Job", "Visualization"],
        version=version,
        author='Dassault Systemes',
        description='This plug-in finds the nearest node to a given point.',
        helpUrl=os.path.join(thisDir, 'abq_FindNearestNode', 'NearestNode_help.html'),
        )
else:
    getAFXApp().getAFXMainWindow().writeToMessageArea(status)
    getAFXApp().beep()

Subscribe to Comments for "Abaqus/Python - commands to find nearest node to a given point"

Recent comments

More comments

Syndicate

Subscribe to Syndicate