Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cutting geometry issues

Status
Not open for further replies.

DrBwts

Mechanical
Nov 4, 2012
297
Hi,

I'm trying to make multiple Boolean cuts from the same part.

The issue I am having is that Abaqus insists on creating a new part for every cut I make, which is making scripting this a nightmare.

My latest attempt is the following,

Python:
def createAndCutSphere(diameter, centroid, sph):
    
    # Create sphere 
    rootSphere = 'rootSphere'   # Original sphere that is to be cut
    newRoot = 'newRootSphere'   # New root instance created by cut operation
    sphName = 'Sphere'          # Sphere that is to be removed from root sphere
    radius = diameter/2.0
    mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=100.0)
    mdb.models['Model-1'].sketches['__profile__'].ConstructionLine(point1=(0.0, -50.0), point2=(0.0, 50.0))
    mdb.models['Model-1'].sketches['__profile__'].FixedConstraint(entity=mdb.models['Model-1'].sketches['__profile__'].geometry[2])
    mdb.models['Model-1'].sketches['__profile__'].Line(point1=(0.0, radius), point2=(0.0, -radius))
    mdb.models['Model-1'].sketches['__profile__'].VerticalConstraint(addUndoState=False, entity=mdb.models['Model-1'].sketches['__profile__'].geometry[3])
    mdb.models['Model-1'].sketches['__profile__'].ParallelConstraint(addUndoState=False, entity1=mdb.models['Model-1'].sketches['__profile__'].geometry[2], entity2=mdb.models['Model-1'].sketches['__profile__'].geometry[3])
    mdb.models['Model-1'].sketches['__profile__'].CoincidentConstraint(addUndoState=False, entity1=mdb.models['Model-1'].sketches['__profile__'].vertices[0], entity2=mdb.models['Model-1'].sketches['__profile__'].geometry[2])
    mdb.models['Model-1'].sketches['__profile__'].CoincidentConstraint(addUndoState=False, entity1=mdb.models['Model-1'].sketches['__profile__'].vertices[1], entity2=mdb.models['Model-1'].sketches['__profile__'].geometry[2])
    mdb.models['Model-1'].sketches['__profile__'].ArcByCenterEnds(center=(0.0, 0.0), direction=CLOCKWISE, point1=(0.0, radius), point2=(0.0, -radius))
    mdb.models['Model-1'].sketches['__profile__'].CoincidentConstraint(addUndoState=False, entity1=mdb.models['Model-1'].sketches['__profile__'].vertices[2], entity2=mdb.models['Model-1'].sketches['__profile__'].geometry[3])
    mdb.models['Model-1'].sketches['__profile__'].EqualDistanceConstraint(addUndoState=False, entity1=mdb.models['Model-1'].sketches['__profile__'].vertices[0], entity2=mdb.models['Model-1'].sketches['__profile__'].vertices[1], midpoint=mdb.models['Model-1'].sketches['__profile__'].vertices[2])
    mdb.models['Model-1'].Part(dimensionality=THREE_D, name=sphName, type=DEFORMABLE_BODY)
    mdb.models['Model-1'].parts[sphName].BaseSolidRevolve(angle=360.0, flipRevolveDirection=OFF, sketch=mdb.models['Model-1'].sketches['__profile__'])
    
    # Place sphere to be cut    
    mdb.models['Model-1'].rootAssembly.Instance(dependent=ON, name=sphName, part=mdb.models['Model-1'].parts[sphName])
    xTrans = centroid[0]
    yTrans = centroid[1]
    zTrans = centroid[2]
    mdb.models['Model-1'].rootAssembly.translate(instanceList=(sphName, ), vector=(xTrans, yTrans, zTrans))
    
    # Cut operation
    mdb.models['Model-1'].rootAssembly.InstanceFromBooleanCut(cuttingInstances=(mdb.models['Model-1'].rootAssembly.instances[sphName], ), instanceToBeCut=mdb.models['Model-1'].rootAssembly.instances[rootSphere], name=newRoot, originalInstances=DELETE)

    # Delete unwanted parts
    del mdb.models['Model-1'].parts[sphName]
    del mdb.models['Model-1'].parts[rootSphere]

    # Rename root sphere instance
    mdb.models['Model-1'].parts.changeKey(fromName=newRoot, toName=rootSphere)
    mdb.models['Model-1'].rootAssembly.regenerate()

This works exactly once! Then it stops with, KeyError: rootSphere, even though this instance is showing up in the assembly instance list.

I have been going around in circles with this. I have tried all sorts of renaming schemes but always Abaqus doesnt recognize the instances.

Any help as always much appreciated before I have to resort to destroying Abaqus for disobedience.
 
Replies continue below

Recommended for you

Hello,
Would it be possible to cut "all cells in bounding box" with datum planes? By searching for everything within a box, maybe you don't have to care about the names that are created.

I haven't tried it myself. :/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor