Hi

I am trying to make a set of cells that are associated to one or more faces and save them in a set using python scripting for Abaqus CAE, but I cannot make it work. I have created and example that shows what I am trying to do and where it fails. Can anyone help in identifying what I should be doing instead?

from abaqus import *

from abaqusConstants import *

import section

import regionToolset

import assembly

import load

import interaction

import mesh

import section

import job

import visualization

from abaqus import getWarningReply, YES, NO

from abaqus import getInput

import mesh

import warnings

from warnings import warn

backwardCompatibility.setValues(includeDeprecated=True, reportDeprecated=False)

session.journalOptions.setValues(replayGeometry=COORDINATE, recoverGeometry=COORDINATE)

m = mdb.Model(name='getCellFromFaces')

mySketch = m.ConstrainedSketch(name='sketch01', sheetSize=200.0)

pointA=(0.0, 0.0)

pointB=(10.0,0.0)

pointC=(10.0, 4.0)

pointD=(0.0, 4.0)

mySketch.Line(point1=pointA, point2=pointB)

mySketch.Line(point1=pointB, point2=pointC)

mySketch.Line(point1=pointC, point2=pointD)

mySketch.Line(point1=pointD, point2=pointA)

part01 = m.Part(name='Part01', dimensionality=THREE_D, type=DEFORMABLE_BODY)

part01.BaseSolidExtrude(sketch=mySketch, depth=4.0)

part01.Set(faces=part01.faces.findAt(((3.333333, 4.0, 2.666667), )), name='Set-1')

#split the cell in three

part01.PartitionCellByPlanePointNormal(

cells=part01.cells.findAt(((6.666667, 0.0, 2.666667), )),

normal=part01.edges.findAt((10.0, 3.0, 4.0), ),

point=part01.InterestingPoint(part01.edges.findAt((10.0, 3.0, 4.0), ), MIDDLE))

part01.PartitionCellByPlanePointNormal(

cells=part01.cells.findAt(((0.0, 2.666667, 2.666667), )),

normal=part01.edges.findAt((2.5, 4.0, 4.0), ),

point=part01.InterestingPoint(part01.edges.findAt((7.5, 2.0, 4.0), ), MIDDLE))

# HERE IS THE PROBLEM:

# Getting the the cell id associated with one of the upper faces

cellsID= part01.faces.findAt(((3.333333, 4.0, 2.666667), ))[0].getCells()

print(cellsID)

#trying to make a set containing that cell but do not succeed.

part01.Set(cells=part01.cells[cellsID[0]], name="set of cells")

# returns: TypeError: keyword error on cells

#Also, how do I make a set of the two cells associated with the two upper faces?

# I mean basically doing the same as about but know with two surfaces and two cells

More Brian Lau Verndal Bak's questions See All
Similar questions and discussions