Fluidmach 发表于 2016-5-20 11:22

Abaqus 利用FindAt函数根据坐标查找线(弧线)

  在ANSYS中可以通过坐标来选取对象,Abaqus虽说没有ANSYS那么方便,但是也还是可以实现的,主要是通过findAt函数,可以选择cell(体)、face(面)、edge(边)和vertex(顶点)。
  This method returns the object or objects in the EdgeArray located at the given coordinates.
  findAt initially uses the ACIS tolerance of 1E-6. As a result, findAt returns any edge that is at the arbitrary point specified or at a distance of less than 1E-6 from the arbitrary point. If nothing is found, findAt uses the tolerance for imprecise geometry (applicable only for imprecise geometric entities). The arbitrary point must not be shared by a second edge. If two edges intersect or coincide at the arbitrary point, findAt chooses the first edge that it encounters, and you should not rely on the return value being consistent.
  findAt will always try to find objects among all the edges in the part or assembly instance and will not restrict itself to a subset even if the EdgeArray represents such subset.

  Required argument
  coordinates
  A sequence of Floats specifying the X-, Y-, and Z-coordinates of the object to find.
  findAt returns either an Edge object or a sequence of Edge objects based on the type of input.
  If coordinates is a sequence of Floats, findAt returns the Edge object at that point.
  If you omit the coordinates keyword argument, findAt accepts as arguments a sequence of sequence of floats in the following format:

  edges = e.findAt(((20.19686, -169.513997, 27.798593), ),
  ((19.657627, -167.295749, 27.056402), ),
  ((18.274129, -157.144741, 25.15218), ))

  Return value
  An Edge object or a sequence of Edge objects.

  示例:
  #加载
  #一次选择一条边进行加载
  a = mdb.models['Model-1'].rootAssembly
  s1 = a.instances['Part-1-1'].edges

  #这个点的坐标只需要在这条线上即可,这个坐标位置处不一定得有关键点存在
  side1Edges1 =s1.findAt(((20.0,5.0,0.0),))

  region = a.Surface(side1Edges=side1Edges1, name='Surf-1')
  mdb.models['Model-1'].Pressure(name='Load-1', createStepName='Step-1',
  region=region, distributionType=UNIFORM, field='', magnitude=-pp,
  amplitude=UNSET)

  #####一次选择两条边进行加载
  #这个点的坐标只需要在这条线上即可,这个坐标位置处不一定得有关键点存在
  side1Edges2 =s1.findAt(((10.0,10.0,0.0),),((-10.0,10.0,0),))

  region2 = a.Surface(side1Edges=side1Edges2, name='Surf-1')
  mdb.models['Model-1'].Pressure(name='Load-1', createStepName='Step-1',
  region=region2, distributionType=UNIFORM, field='', magnitude=-pp,
  amplitude=UNSET)

  #选择一条弧线进行加载
  import math
  cood_x=5.0*math.sin(45.0/180.0*math.pi)
  cood_y=5.0*math.cos(45.0/180.0*math.pi)

  side1Edges3 =s1.findAt(((cood_x,cood_y,0.0),))

  region3 = a.Surface(side1Edges=side1Edges3, name='Surf-1')
  mdb.models['Model-1'].Pressure(name='Load-1', createStepName='Step-1',
  region=region3, distributionType=UNIFORM, field='', magnitude=-pp,
  amplitude=UNSET)

  #选择一个院的四条弧线进行加载
  cood_x=5.0*math.sin(45.0/180.0*math.pi)
  cood_y=5.0*math.cos(45.0/180.0*math.pi)

  side1Edges4 =s1.findAt(((cood_x,cood_y,0.0),),((-cood_x,cood_y,0.0),),((-cood_x,-cood_y,0.0),),((cood_x,-cood_y,0.0),))

  region4 = a.Surface(side1Edges=side1Edges4, name='Surf-1')
  mdb.models['Model-1'].Pressure(name='Load-1', createStepName='Step-1',
  region=region4, distributionType=UNIFORM, field='', magnitude=-pp,
  amplitude=UNSET)

  #######选择一条边施加约束
  a = mdb.models['Model-1'].rootAssembly
  e1 = a.instances['Part-1-1'].edges
  edges1 = e1.findAt(((-20.0,5.0,0.0),))
  region = a.Set(edges=edges1, name='Set-1')
  mdb.models['Model-1'].DisplacementBC(name='BC-1', createStepName='Step-1',
  region=region, u1=0.0, u2=0.0, ur3=UNSET, amplitude=UNSET, fixed=OFF,
  distributionType=UNIFORM, fieldName='', localCsys=None)
  mdb.models['Model-1'].boundaryConditions['BC-1'].move('Step-1', 'Initial')

  #######选择两条边施加约束
  edges1 = e1.findAt(((-20.0,5.0,0.0),),((-20.0,-5.0,0.0),))
  region = a.Set(edges=edges1, name='Set-1')
  mdb.models['Model-1'].DisplacementBC(name='BC-1', createStepName='Step-1',
  region=region, u1=0.0, u2=0.0, ur3=UNSET, amplitude=UNSET, fixed=OFF,
  distributionType=UNIFORM, fieldName='', localCsys=None)
  mdb.models['Model-1'].boundaryConditions['BC-1'].move('Step-1', 'Initial')

  #######选择一条弧线施加约束
  import math
  cood_x=5.0*math.sin(45.0/180.0*math.pi)
  cood_y=5.0*math.cos(45.0/180.0*math.pi)
  edges1 = e1.findAt(((cood_x,cood_y,0.0),))
  region = a.Set(edges=edges1, name='Set-1')
  mdb.models['Model-1'].DisplacementBC(name='BC-1', createStepName='Step-1',
  region=region, u1=0.0, u2=0.0, ur3=UNSET, amplitude=UNSET, fixed=OFF,
  distributionType=UNIFORM, fieldName='', localCsys=None)
  mdb.models['Model-1'].boundaryConditions['BC-1'].move('Step-1', 'Initial')

  #######选择圆的四条弧线施加约束
  edges1 = e1.findAt(((cood_x,cood_y,0.0),),((-cood_x,cood_y,0.0),),((-cood_x,-cood_y,0.0),),((cood_x,-cood_y,0.0),))
  region = a.Set(edges=edges1, name='Set-1')
  mdb.models['Model-1'].DisplacementBC(name='BC-1', createStepName='Step-1',
  region=region, u1=0.0, u2=0.0, ur3=UNSET, amplitude=UNSET, fixed=OFF,
  distributionType=UNIFORM, fieldName='', localCsys=None)
  mdb.models['Model-1'].boundaryConditions['BC-1'].move('Step-1', 'Initial')


转自:http://blog.sina.com.cn/s/blog_6465f2ed0102x50o.html

页: [1]
查看完整版本: Abaqus 利用FindAt函数根据坐标查找线(弧线)