Faster way to partition a Face with Sketch in ABAQUS with scripting

倾然丶 夕夏残阳落幕 提交于 2019-12-25 08:49:32

问题


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:

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.

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.

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.

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.

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.

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.

EDIT: Here is the code guys:

# 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)

回答1:


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.

Regards, Longjie



来源:https://stackoverflow.com/questions/38625874/faster-way-to-partition-a-face-with-sketch-in-abaqus-with-scripting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!