使用脚本在 ABAQUS 中使用 Sketch 分割面的更快方法 [英] Faster way to partition a Face with Sketch in ABAQUS with scripting

查看:405
本文介绍了使用脚本在 ABAQUS 中使用 Sketch 分割面的更快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是在参数化模型的长矩形区域上获得过渡映射四边形网格.可以看到最终的网格如下:

My aim is to obtain a transition mapped quad meshing on a long rectangular region which is a parametrised model. The final mesh can be seen as follows:

我能实现这个最终输出网格的唯一方法是用草图分割面,然后使用足够的网格控制和在各自的边上播种.出于这个原因,我开始在几何体的左侧生成一个块,如下所示:

The only way I could realise this final output mesh was to partition the face with sketch and then, using adequate mesh controls and seeding on the respective edges. For this reason, I started with generating a block on the left hand side of the geometry like this:

此后,在从矩形面的左侧到最右端运行的 Python 脚本中使用了for"循环,最终分割的面如下所示:

Thereafter, a "for" loop was used in the Python script running from the left hand side of the rectangular face to the right-most end and the final partitioned face looks like this:

所以,我尝试了三种方法.

So, I tried doing this in three ways.

选项 1:在左侧使用 findAt 放置草绘器窗口,然后生成块并使用for"循环将草绘器窗口坐标系的原点向右逐渐向右推-最边.换句话说,块相对于原点的位置始终保持不变,因此,当原点从左向右移动时,块也随之移动.所以我不得不根据需要的块数打开和关闭Partition Face with Sketch".

Option 1: Place the sketcher window using findAt at the left hand side and then generate the block and with a "for" loop push the origin of the coordinate system of the sketcher window to the right incrementally all the way to the right-most side. In other words, the position of the block with respect to the origin stayed the same always and hence, when the origin moved from left to right, the block moved with it. So I had to open and clos "Partition Face with Sketch" as many times as the number of blocks required.

选项 2:草绘器窗口的原点保持在同一位置(即在 0.0、0.0、0.0)并且块被逐渐向右推.与选项 1 相比,这里块相对于原点的相对位置在每个增量上都发生了变化.在这里,带草图的分区面"根据需要的块数打开和关闭.

Option 2: The origin of the Sketcher window stayed at the same place (i.e. at 0.0, 0.0, 0.0) and the blocks were pushed to the right incrementally. In comparison with Option 1, here the relative position of the block with respect to the origin changed over each increment. Here also, "Partition Face with Sketch" was opened and closed as many times as the number of blocks required.

选项3:我只打开了一次带草图的分割面",原点停留在同一个地方.然后我还用for"循环绘制了所有这些水平和垂直线,从而产生了最终的分割面.

Option 3: I opened the "Partition Face with Sketch" only once and the origin stayed at the same place. Then I drew all these horizontal and vertical lines also with a "for" loop resulting in the final partitioned face.

所有这些方法都可以完美运行,但非常耗时.这些方法中的每一种都几乎需要 8-12 分钟才能完成所有块的生成,因此不适合进行收敛性研究.

All these methodologies work perfectly but are extremely time-consuming. Each of these methods takes almost from 8-12 minutes to finish generating all the blocks and hence, is not suitable for a convergence study.

谁能提出更好的解决方案来加快整个过程,比如在 3-4 分钟左右?真的很感激.提前致谢.

Can anyone suggest a better solution to make this entire process faster, like in 3-4 minutes or so? Would really appreciate it. Thanks in advance.

这是代码家伙:

# The arguments of the function "block" are the x and y coordinates of the  
# 4 corners of the rectangle where the blocks have to be generated in.
def block(x_left, x_right, y_top, y_bottom):

    # Opens the sketcher window
    p = mdb.models['TDCB'].parts['Part_TDCB']
    f, e, d = p.faces, p.edges, p.datums
    t = p.MakeSketchTransform(sketchPlane=f.findAt(coordinates=(x_left + ((x_right - x_left) / 3), y_bottom + ((y_top - y_bottom) / 3), 0.0), 
    normal=(0.0, 0.0, 1.0)), sketchPlaneSide=SIDE1, origin=(x_left, y_bottom, 0.0))             
    s = mdb.models['TDCB'].ConstrainedSketch(name='__profile__', sheetSize=500.00, 
    gridSpacing=12.00, transform=t)
    g, v, d1, c = s.geometry, s.vertices, s.dimensions, s.constraints
    s.setPrimaryObject(option=SUPERIMPOSE)
    p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)


    # The following block generates the first couple of horizontal lines 
    s.Line(point1=(block_width, 0.0), point2=(block_width, y_top))  # Line No.1

    s.Line(point1=(0.0, y_coord[-2]), point2=(block_width, y_coord[-2]))  # Line No.2

    s.Line(point1=(0.0, y_coord[-3]), point2=(block_width, y_coord[-3]))  # Line No.3

    s.Line(point1=(0.0, y_coord[-4]), point2=(block_width, y_coord[-4]))  # Line No.4

    s.Line(point1=(0.0, y_coord[-5]), point2=(block_width, y_coord[-5]))  # Line No.5

    s.Line(point1=(0.0, y_coord[-6]), point2=(block_width, y_coord[-6]))  # Line No.6

    # Closes the sketcher window
    p = mdb.models['TDCB'].parts['Part_TDCB']
    f = p.faces
    pickedFaces = f.findAt((x_left + ((x_right - x_left) / 3), y_bottom + ((y_top - y_bottom) / 3), 0.0))                     
    e1, d2 = p.edges, p.datums
    p.PartitionFaceBySketch(faces=pickedFaces, sketch=s)
    s.unsetPrimaryObject()
    del mdb.models['TDCB'].sketches['__profile__']    

    return

# Finally the blocks are generated using a "for" loop
for i in range(total_blocks):
    block(x_left, x_right, y_top, y_bottom)

推荐答案

看来您不必像在 ABAQUS Sketch 中那样重复绘制草图的过程,您可以使用 Linear Pattern 来复制/复制初始草图(第一个块在左侧).这可能会使整个过程更容易.谢谢.

It seems you don't have to iterate the process of sketching as in ABAQUS Sketch you can use Linear Pattern to copy/duplicate the initial sketch (first block on the left side). This may make the whole process easier. Thanks.

问候,龙杰

这篇关于使用脚本在 ABAQUS 中使用 Sketch 分割面的更快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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