Abaqus Python 'Getclosest' 命令 [英] Abaqus Python 'Getclosest' command

查看:67
本文介绍了Abaqus Python 'Getclosest' 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 getclosest 命令来查找顶点.

I'm using the getclosest command to find a vertex.

ForceVertex1 = hatInstance.vertices.getClosest(coordinates=((x,y,z,))

这是一个带有Key 0和两个值(hatInstance.vertices[1]和顶点坐标)的字典对象具体输出:

This is a dictionary object with Key 0 and two values (hatInstance.vertices[1] and the coordinates of the vertex) The specific output:

{0: (mdb.models['EXP-100'].rootAssembly.instances['hatInstance-100'].vertices[1], (62.5242172081597, 101.192447407436, 325.0))}

每当我尝试创建一个集合时,都不接受顶点

Whenever I try to create a set, the vertex isn't accepted

mainAssembly.Set(vertices=ForceVertex1[0][0],name='LoadSet1')

我也尝试了不同的方式:

I also tried a different way:

tolerance = 1.0e-3

        vertex = []
        for vertex in hatInstance.vertices:
           x = vertex.pointOn[0][0]
           print x
           y = vertex.pointOn[0][1]
           print y
           z = vertex.pointOn[0][2]
           print z
           break
           if (abs(x-xTarget)) < tolerance and abs(y-yTarget) < tolerance and abs(z-zTarget) < tolerance):
             vertex.append(hatInstance.vertices[vertex.index:vertex.index+1])

xTarget 等是我的坐标,尽管如此我仍然没有得到顶点对象

xTarget etc being my coordinates, despite this I still don't get a vertex object

推荐答案

对于那些为此苦苦挣扎的人,我解决了.

For those struggeling with this, I solved it.

尽管手册建议这样做,但不要使用 getClosest 命令,因为它返回一个字典对象.我无法转换这个字典对象,特别是一个键和一个值到一个独立的对象(顶点)

Don't use the getClosest command as it returns a dictionary object despite the manual recommending this. I couldn't convert this dictionary object, specifically a key and a value within to a standalone object (vertex)

改为使用 Instance.vertices.getByBoundingSphere(center=,radius=)中心基本上是坐标的元组,半径是公差.这将返回一个顶点数组

Instead use Instance.vertices.getByBoundingSphere(center=,radius=) The center is basically a tuple of the coordinates and the radius is the tolerance. This returns an array of vertices

这篇关于Abaqus Python 'Getclosest' 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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