【问题标题】:Abaqus/Python suppress warningAbaqus/Python 抑制警告
【发布时间】:2018-03-03 22:19:51
【问题描述】:

这是 abaqus/python 的一个最小示例,它创建一个长方体和分区

from abaqus import *
from abaqusConstants import *
import __main__

model=mdb.models['Model-1']

# Sketch
s = model.ConstrainedSketch(name='__profile__', sheetSize=10.0)
s.setPrimaryObject(option=STANDALONE)
s.rectangle(point1=(0.0, 0.0), point2=(5.0, 5.0))

# Part
p = model.Part(name='Part-1', dimensionality=THREE_D, type=DEFORMABLE_BODY)
p.BaseSolidExtrude(sketch=s, depth=0.1)
s.unsetPrimaryObject()
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del model.sketches['__profile__']

# Partition
c = p.cells
pickedCells = c.findAt(((0., 0., 0.), ))
e = p.edges
p.PartitionCellByPlanePointNormal(normal=e.findAt(coordinates=(2.5, 0.0, 
        0.0)), cells=pickedCells, point=p.InterestingPoint(edge=e.findAt(
        coordinates=(2.5, 0.0, 0.0)), rule=MIDDLE))
p.PartitionCellByPlanePointNormal(normal=e.findAt(coordinates=(0.0, 2.5, 
        0.0)), cells=pickedCells, point=p.InterestingPoint(edge=e.findAt(
        coordinates=(0.0, 2.5, 0.0)), rule=MIDDLE))

执行此操作时,每个分区都会出现以下警告:

警告:给定的边缘指示点位于边缘的中心。 对于某些特征操作,隐含的边缘感觉会很模糊。

我怎样才能抑制这个警告或让它只出现一次?都没有

import warnings 
warnings.filterwarnings('once', 
      '.*The given edge indicative point is at the center of the edge.*',)

有效,也不

warnings.filterwarnings('ignore')

【问题讨论】:

  • 不错,他们没有使用标准的 python 警告系统。我在 abaqus 脚本文档中没有看到任何内容:警告控制。在这里,我认为可以安全地忽略该警告,因为正常意义不应影响分区。如果它真的让你烦恼,你当然可以使用不同的分区方法。

标签: python warnings abaqus


【解决方案1】:

不要使用“p.InterestingPoint”命令。直接作为顶点ID使用会更好。您目前收到警告,这意味着相关兴趣点没有顶点。您可以尝试创建一个平面然后将其切断。

【讨论】:

  • 这个答案没有提供太多信息。应该对其进行编辑以更详细地解释如何实现它。最好有代码示例。
猜你喜欢
  • 1970-01-01
  • 2019-10-05
  • 2011-03-31
  • 2019-10-22
  • 2014-12-19
  • 2021-12-27
  • 1970-01-01
  • 2011-12-28
相关资源
最近更新 更多