pythonabaqusedges

Abaqus\Python script - edges.findAt with predefined global coordinates


I am a quite new to Abaqus-Python scripting. My goal is to script loft operation between circular sections. Circular sections are predefined based on the engineering problem.

According to .jnl file from manual using of Abaqus interface (for selecting two circular sections), the syntax is as follow;

mdb.models['Model-1'].parts['strut defected'].SolidLoft(endCondition=NONE, 
    loftsections=((mdb.models['Model-1'].parts['strut defected'].edges.findAt((
    0.012, 0.26, 0.15), ), ), (
    mdb.models['Model-1'].parts['strut defected'].edges.findAt((0.012, 0.25, 
    0.2), ), )), startCondition=NONE)

I understand that it can be formed as;

mdb.models['Model-1'].parts['strut defected'].SolidLoft(endCondition=NONE, 
    loftsections=(mytuple1), startCondition=NONE)

where mytupple1 is;

mytuple1 = (mdb.models['Model-1'].parts['strut defected'].edges.findAt(mytuple2), )

where mytuple2 is;

mytuple2 = ((0.012, 0.26, 0.15), )

I am not sure how to implement global coordinate values (mytuple2) by using loop operations.

So far I have tried to create mytupple1 data as below;

division = 3

mytuple1 = ('m','d','b','.','m','o','d','e','l','s','[',"'",'M','o','d','e','l','-','1',"'",
            ']','.','p','a','r','t','s','[',"'",'d','e','f','e','c','t','e','d',' ','s','t','r',
            'u','t',"'",']','.','e','d','g','e','s','.','f','i','n','d','A','t','(')

str1 = ''.join(mytuple1)

mylist1 = [str1] * division

mytuple2 = (',',' ',')')

str2 = ''.join(mytuple2)

mylist2 = [str2] * division

section_edge_coords_abq = ((0,0,0),(1,1,1),(2,2,2)) % random coords

for ii in range(0,3):

 loft_section_tuple = ((str(mylist1[ii]) + str(section_edge_coords_abq[ii]) + str(mylist2[ii])),)

This loop operation results in as follow;

mdb.models['Model-1'].parts['defected strut'].edges.findAt((2, 2, 2), )

It creates only one tupple data for the last coordinates. I want to pass the coordinates compatible to syntax but I can not manage it. I would be really appreciate if you help me to solve this automated lofting process in Abaqus.


Solution

  • Actually, the argument for the findAt(...) command is a sequence of sequence. This means that you provide tuple of tuple as a argument. Here, each tuple represents a single set of coordinates to select an edge (or any related entity - here edge).
    So, following way you implement your problem:

    points = (0,0,0),(1,1,1),(2,2,2) # random data points
    tuple_points = tuple([(ii,) for ii in points]) # creating a tuple of tuple
    # ==> tuple_points => (((0, 0, 0),), ((1, 1, 1),), ((2, 2, 2),))
    
    
    myEdges = mdb.models['Model-1'].parts['strut defected'].edges.findAt(*tuple_points)
    # ==> the argument must be tuple of tuple as below
    # ((0, 0, 0),), ((1, 1, 1),), ((2, 2, 2),) ==> hence we must remove the outer tuple.
    # ==> hence, we passed the argument with '*' sign which takes care of this.
    
    mdb.models['Model-1'].parts['strut defected'].SolidLoft(endCondition=NONE, 
        loftsections=myEdges, startCondition=NONE)