newhere

ABAQUS切削快速建模python程序

  1 # -*- coding: mbcs -*-
  2 #
  3 # Abaqus/CAE Release 6.14-4 replay file
  4 # Internal Version: 2015_06_12-04.41.13 135079
  5 # Run by Administrator on Wed Apr 12 08:41:02 2017
  6 #
  7 
  8 # from driverUtils import executeOnCaeGraphicsStartup
  9 # executeOnCaeGraphicsStartup()
 10 #: Executing "onCaeGraphicsStartup()" in the site directory ...
 11 #: Abaqus Error: 
 12 #: This error may have occurred due to a change to the Abaqus Scripting
 13 #: Interface. Please see the Abaqus Scripting Manual for the details of
 14 #: these changes. Also see the "Example environment files" section of 
 15 #: the Abaqus Site Guide for up-to-date examples of common tasks in the
 16 #: environment file.
 17 #: Execution of "onCaeGraphicsStartup()" in the site directory failed.
 18 from abaqus import *
 19 from abaqusConstants import *
 20 session.Viewport(name=\'Viewport: 1\', origin=(0.0, 0.0), width=414.662475585938, 
 21     height=253.647216796875)
 22 session.viewports[\'Viewport: 1\'].makeCurrent()
 23 session.viewports[\'Viewport: 1\'].maximize()
 24 from caeModules import *
 25 from driverUtils import executeOnCaeStartup
 26 executeOnCaeStartup()
 27 session.viewports[\'Viewport: 1\'].partDisplay.geometryOptions.setValues(
 28     referenceRepresentation=ON)
 29 Mdb()
 30 
 31 # set the absoluteZero
 32 mdb.models[\'Model-1\'].setValues(absoluteZero=-273)
 33 
 34 from math import *
 35 
 36 # make the cutter dimension that you want
 37 cutterLength = 0.5
 38 cutterPointPos = cutterLength/2
 39 rakeAngle = 8.0
 40 clearanceAngle = 15.0
 41 
 42 
 43 #: A new model database has been created.
 44 #: The model "Model-1" has been created.
 45 session.viewports[\'Viewport: 1\'].setValues(displayedObject=None)
 46 s = mdb.models[\'Model-1\'].ConstrainedSketch(name=\'__profile__\', sheetSize=cutterLength)
 47 g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
 48 s.setPrimaryObject(option=STANDALONE)
 49 s.rectangle(point1=(-cutterPointPos, cutterPointPos), point2=(cutterPointPos, -cutterPointPos))
 50 p = mdb.models[\'Model-1\'].Part(name=\'cutter\', dimensionality=THREE_D, 
 51     type=DISCRETE_RIGID_SURFACE)
 52 p = mdb.models[\'Model-1\'].parts[\'cutter\']
 53 p.BaseShellExtrude(sketch=s, depth=cutterLength)
 54 s.unsetPrimaryObject()
 55 
 56 # make rake angle
 57 p = mdb.models[\'Model-1\'].parts[\'cutter\']
 58 f1, e1 = p.faces, p.edges
 59 t = p.MakeSketchTransform(sketchPlane=f1[2], sketchUpEdge=e1[8], 
 60     sketchPlaneSide=SIDE1, sketchOrientation=TOP)
 61 s = mdb.models[\'Model-1\'].ConstrainedSketch(name=\'__profile__\', sheetSize=cutterLength**2, 
 62     gridSpacing=cutterLength**2/50, transform=t)
 63 g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
 64 s.setPrimaryObject(option=SUPERIMPOSE)
 65 p = mdb.models[\'Model-1\'].parts[\'cutter\']
 66 p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
 67 s.Line(point1=(cutterPointPos, -cutterPointPos), point2=(0, cutterPointPos))
 68 s.CoincidentConstraint(entity1=v[4], entity2=g[4], addUndoState=False)
 69 s.Line(point1=(0, cutterPointPos), point2=(cutterPointPos, cutterPointPos))
 70 s.HorizontalConstraint(entity=g[9], addUndoState=False)
 71 s.Line(point1=(cutterPointPos, cutterPointPos), point2=(cutterPointPos, -cutterPointPos))
 72 s.VerticalConstraint(entity=g[10], addUndoState=False)
 73 s.PerpendicularConstraint(entity1=g[9], entity2=g[10], addUndoState=False)
 74 s.AngularDimension(line1=g[3], line2=g[8], textPoint=(cutterPointPos - tan(rakeAngle*pi/180)*cutterPointPos/2, 
 75     0.0), value=rakeAngle)
 76 p = mdb.models[\'Model-1\'].parts[\'cutter\']
 77 f, e = p.faces, p.edges
 78 p.CutExtrude(sketchPlane=f[2], sketchUpEdge=e[8], sketchPlaneSide=SIDE1, 
 79     sketchOrientation=TOP, sketch=s, flipExtrudeDirection=ON)
 80 s.unsetPrimaryObject()
 81 del mdb.models[\'Model-1\'].sketches[\'__profile__\']
 82 
 83 # make clearance angle
 84 p = mdb.models[\'Model-1\'].parts[\'cutter\']
 85 f, e = p.faces, p.edges
 86 t = p.MakeSketchTransform(sketchPlane=f[0], sketchUpEdge=e[1], 
 87     sketchPlaneSide=SIDE1, sketchOrientation=TOP, origin=(cutterPointPos, 0.0, cutterPointPos))
 88 s1 = mdb.models[\'Model-1\'].ConstrainedSketch(name=\'__profile__\', 
 89     sheetSize=cutterLength**2, gridSpacing=cutterLength**2/50, transform=t)
 90 g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints
 91 s1.setPrimaryObject(option=SUPERIMPOSE)
 92 p = mdb.models[\'Model-1\'].parts[\'cutter\']
 93 p.projectReferencesOntoSketch(sketch=s1, filter=COPLANAR_EDGES)
 94 session.viewports[\'Viewport: 1\'].setValues(displayedObject=p)
 95 s1.Line(point1=(cutterPointPos, -cutterPointPos), point2=(-cutterPointPos, 0))
 96 s1.CoincidentConstraint(entity1=v[4], entity2=g[4], addUndoState=False)
 97 s1.Line(point1=(-cutterPointPos, 0), point2=(-cutterPointPos, -cutterPointPos))
 98 s1.VerticalConstraint(entity=g[9], addUndoState=False)
 99 s1.Line(point1=(-cutterPointPos, -cutterPointPos), point2=(cutterPointPos, -cutterPointPos))
100 s1.HorizontalConstraint(entity=g[10], addUndoState=False)
101 s1.PerpendicularConstraint(entity1=g[9], entity2=g[10], addUndoState=False)
102 s1.AngularDimension(line1=g[8], line2=g[5], textPoint=(0, 
103     -cutterPointPos + tan(clearanceAngle*pi/180)*cutterPointPos/2), value=clearanceAngle)
104 p = mdb.models[\'Model-1\'].parts[\'cutter\']
105 f1, e1 = p.faces, p.edges
106 p.CutExtrude(sketchPlane=f1[0], sketchUpEdge=e1[1], sketchPlaneSide=SIDE1, 
107     sketchOrientation=TOP, sketch=s1, flipExtrudeDirection=ON)
108 s1.unsetPrimaryObject()
109 del mdb.models[\'Model-1\'].sketches[\'__profile__\']
110 
111 # connect the separete faces
112 p = mdb.models[\'Model-1\'].parts[\'cutter\']
113 e = p.edges
114 p.ShellLoft(loftsections=((e[0], ), (e[7], )), startCondition=NONE, 
115     endCondition=NONE)
116 p = mdb.models[\'Model-1\'].parts[\'cutter\']
117 e1 = p.edges
118 p.ShellLoft(loftsections=((e1[4], ), (e1[11], )), startCondition=NONE, 
119     endCondition=NONE)
120 p = mdb.models[\'Model-1\'].parts[\'cutter\']
121 e = p.edges
122 p.ShellLoft(loftsections=((e[8], ), (e[11], )), startCondition=NONE, 
123     endCondition=NONE)
124 
125 # make the reference point
126 p = mdb.models[\'Model-1\'].parts[\'cutter\']
127 v1, e, d1, n = p.vertices, p.edges, p.datums, p.nodes
128 p.ReferencePoint(point=p.InterestingPoint(edge=e[1], rule=MIDDLE))
129 
130 
131 # set the reference point named cutter
132 p = mdb.models[\'Model-1\'].parts[\'cutter\']
133 r = p.referencePoints
134 refPoints=(r[7], )
135 p.Set(referencePoints=refPoints, name=\'cutter\')
136 
137 
138 # make the workpiece dimension that you want
139 workpieceLength = 0.2 #the length of the workpiece
140 workpieceHeight = 0.1 #the thickness of the workpiece
141 workpieceDepth = 0.1 #the width of the workpiece  
142 workpiecePointPosX = workpieceLength/2
143 workpiecePointPosY = workpieceHeight/2
144 cutDepth = 0.01 #the equivalent thickness of the workpiece
145 
146 
147 # make the workpiece
148 s = mdb.models[\'Model-1\'].ConstrainedSketch(name=\'__profile__\', sheetSize=workpieceLength)
149 g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
150 s.setPrimaryObject(option=STANDALONE)
151 s.rectangle(point1=(-workpiecePointPosX, workpiecePointPosY), point2=(workpiecePointPosX, -workpiecePointPosY))
152 p = mdb.models[\'Model-1\'].Part(name=\'workpiece\', dimensionality=THREE_D, 
153     type=DEFORMABLE_BODY)
154 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
155 p.BaseSolidExtrude(sketch=s, depth=workpieceDepth)
156 s.unsetPrimaryObject()
157 
158 
159 # make the seperate part
160 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
161 f, e, d1 = p.faces, p.edges, p.datums
162 t = p.MakeSketchTransform(sketchPlane=f[4], sketchUpEdge=e[10], 
163     sketchPlaneSide=SIDE1, sketchOrientation=TOP)
164 s = mdb.models[\'Model-1\'].ConstrainedSketch(name=\'__profile__\', 
165     sheetSize=workpieceLength*2, gridSpacing=workpieceLength*2/50, transform=t)
166 g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
167 s.setPrimaryObject(option=SUPERIMPOSE)
168 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
169 p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)
170 s.Line(point1=(-workpiecePointPosX, workpiecePointPosY), point2=(-workpiecePointPosX, workpiecePointPosY - cutDepth*2))
171 s.VerticalConstraint(entity=g[6], addUndoState=False)
172 s.ParallelConstraint(entity1=g[4], entity2=g[6], addUndoState=False)
173 s.CoincidentConstraint(entity1=v[4], entity2=g[4], addUndoState=False)
174 s.Line(point1=(-workpiecePointPosX, workpiecePointPosY - cutDepth*2), point2=(workpiecePointPosX, workpiecePointPosY - cutDepth*2))
175 s.HorizontalConstraint(entity=g[7], addUndoState=False)
176 s.PerpendicularConstraint(entity1=g[6], entity2=g[7], addUndoState=False)
177 s.CoincidentConstraint(entity1=v[5], entity2=g[2], addUndoState=False)
178 s.Line(point1=(workpiecePointPosX, workpiecePointPosY - cutDepth*2), point2=(workpiecePointPosX, workpiecePointPosY))
179 s.VerticalConstraint(entity=g[8], addUndoState=False)
180 s.PerpendicularConstraint(entity1=g[7], entity2=g[8], addUndoState=False)
181 s.Line(point1=(workpiecePointPosX, workpiecePointPosY), point2=(-workpiecePointPosX, workpiecePointPosY))
182 s.HorizontalConstraint(entity=g[9], addUndoState=False)
183 s.PerpendicularConstraint(entity1=g[8], entity2=g[9], addUndoState=False)
184 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
185 f = p.faces
186 pickedFaces = f.getSequenceFromMask(mask=(\'[#10 ]\', ), )
187 e1, d2 = p.edges, p.datums
188 p.PartitionFaceBySketch(sketchUpEdge=e1[10], faces=pickedFaces, 
189     sketchOrientation=TOP, sketch=s)
190 s.unsetPrimaryObject()
191 del mdb.models[\'Model-1\'].sketches[\'__profile__\']
192 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
193 c = p.cells
194 pickedCells = c.getSequenceFromMask(mask=(\'[#1 ]\', ), )
195 e, d1 = p.edges, p.datums
196 pickedEdges =(e[0], )
197 p.PartitionCellByExtrudeEdge(line=e[7], cells=pickedCells, edges=pickedEdges, 
198     sense=REVERSE)
199 
200 #give the TC4 material to the workpiece
201 #create the material
202 from material import createMaterialFromDataString
203 createMaterialFromDataString(\'Model-1\', \'Ti6Al4V-Shenyang\', \'6-14\', 
204     """{
205     \'description\': \'\', 
206     \'inelasticHeatFraction\': {\'fraction\': 0.9}, 
207     \'expansion\': {\'temperatureDependency\': OFF, \'userSubroutine\': OFF, \'zero\': 0.0, \'dependencies\': 0, \'table\': ((9.1e-06,),), \'type\': ISOTROPIC}, 
208     \'materialIdentifier\': \'\', 
209     \'johnsonCookDamageInitiation\': {\'temperatureDependency\': OFF, \'definition\': MSFLD, \'direction\': NMORI, \'fnt\': 10.0, \'position\': CENTROID, \'damageEvolution\': {\'temperatureDependency\': OFF, \'dependencies\': 0, \'softening\': LINEAR, \'power\': None, \'table\': ((0.05,),), \'mixedModeBehavior\': MODE_INDEPENDENT, \'type\': DISPLACEMENT, \'modeMixRatio\': ENERGY, \'degradation\': MAXIMUM}, \'table\': ((-0.09, 0.25, -0.5, 0.014, 3.87, 1650.0, 20.0, 1.0),), \'ks\': 0.0, \'tolerance\': 0.05, \'dependencies\': 0, \'frequency\': 1, \'feq\': 10.0, \'alpha\': 0.0, \'fnn\': 10.0, \'omega\': 1.0, \'numberImperfections\': 4}, 
210     \'conductivity\': {\'temperatureDependency\': ON, \'table\': ((6.8, 20.0), (7.4, 100.0), (8.7, 200.0), (9.8, 300.0), (10.3, 400.0), (11.8, 500.0)), \'dependencies\': 0, \'type\': ISOTROPIC}, 
211     \'name\': \'Ti6Al4V-Shenyang\', 
212     \'elastic\': {\'temperatureDependency\': ON, \'moduli\': LONG_TERM, \'noCompression\': OFF, \'noTension\': OFF, \'dependencies\': 0, \'table\': ((109000.0, 0.34, 20.0), (97000.0, 0.34, 150.0), (91000.0, 0.34, 250.0), (85000.0, 0.34, 350.0), (75000.0, 0.34, 450.0)), \'type\': ISOTROPIC}, 
213     \'density\': {\'temperatureDependency\': OFF, \'table\': ((4.44e-09,),), \'dependencies\': 0, \'fieldName\': \'\', \'distributionType\': UNIFORM}, 
214     \'plastic\': {\'temperatureDependency\': OFF, \'strainRangeDependency\': OFF, \'rate\': OFF, \'dependencies\': 0, \'hardening\': JOHNSON_COOK, \'rateDependent\': {\'temperatureDependency\': OFF, \'table\': ((0.01, 1.0),), \'dependencies\': 0, \'type\': JOHNSON_COOK}, \'dataType\': HALF_CYCLE, \'table\': ((875.0, 793.0, 0.386, 0.71, 1650.0, 20.0),), \'numBackstresses\': 1}, 
215     \'specificHeat\': {\'temperatureDependency\': ON, \'table\': ((611000000.0, 20.0), (624000000.0, 100.0), (653000000.0, 300.0), (674000000.0, 400.0), (691000000.0, 500.0), (703000000.0, 600.0)), \'dependencies\': 0, \'law\': CONSTANTVOLUME}
216     }""")
217 #: Material \'Ti6Al4V-Shenyang\' has been copied to the current model.
218 # give the material to the section
219 mdb.models[\'Model-1\'].HomogeneousSolidSection(name=\'TC4\', 
220     material=\'Ti6Al4V-Shenyang\', thickness=None)
221 # give the section to the model
222 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
223 c = p.cells
224 cells = c.getSequenceFromMask(mask=(\'[#3 ]\', ), )
225 region = regionToolset.Region(cells=cells)
226 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
227 p.SectionAssignment(region=region, sectionName=\'TC4\', offset=0.0, 
228     offsetType=MIDDLE_SURFACE, offsetField=\'\', 
229     thicknessAssignment=FROM_SECTION)
230 
231 #the size of the cutting region
232 sizeOfCutting = 0.05
233 numOfNoneCutting = 4
234 
235 
236 # mesh the workpiece
237 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
238 e = p.edges
239 pickedEdges = e.getSequenceFromMask(mask=(\'[#c2025 ]\', ), )
240 #p.seedEdgeByNumber(edges=pickedEdges, number=int(workpieceLength/sizeOfCutting), constraint=FINER)
241 p.seedEdgeByNumber(edges=pickedEdges, number=, constraint=FINER)
242 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
243 e = p.edges
244 pickedEdges = e.getSequenceFromMask(mask=(\'[#2890a ]\', ), )
245 #p.seedEdgeByNumber(edges=pickedEdges, number=int(workpieceDepth/sizeOfCutting), constraint=FINER)
246 p.seedEdgeByNumber(edges=pickedEdges, number=20, constraint=FINER)
247 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
248 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
249 e = p.edges
250 pickedEdges = e.getSequenceFromMask(mask=(\'[#14280 ]\', ), )
251 #p.seedEdgeByNumber(edges=pickedEdges, number=int(cutDepth*2/sizeOfCutting)*2, constraint=FINER)
252 p.seedEdgeByNumber(edges=pickedEdges, number=10, constraint=FINER)
253 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
254 e = p.edges
255 pickedEdges = e.getSequenceFromMask(mask=(\'[#1450 ]\', ), )
256 p.seedEdgeByNumber(edges=pickedEdges, number=numOfNoneCutting, constraint=FINER)
257 
258 # assign mesh type
259 elemType1 = mesh.ElemType(elemCode=C3D8T, elemLibrary=EXPLICIT, 
260     secondOrderAccuracy=OFF, distortionControl=DEFAULT, elemDeletion=ON)
261 elemType2 = mesh.ElemType(elemCode=C3D6T, elemLibrary=EXPLICIT)
262 elemType3 = mesh.ElemType(elemCode=C3D4T, elemLibrary=EXPLICIT)
263 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
264 c = p.cells
265 cells = c.getSequenceFromMask(mask=(\'[#3 ]\', ), )
266 pickedRegions =(cells, )
267 p.setElementType(regions=pickedRegions, elemTypes=(elemType1, elemType2, 
268     elemType3))
269 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
270 p.generateMesh()
271 
272 # creat mesh part
273 p = mdb.models[\'Model-1\'].parts[\'workpiece\']
274 p.PartFromMesh(name=\'workpiece-mesh-1\', copySets=True)
275 
276 
277 # the size of the mesh cutter
278 sizeOfCutter = 0.01
279 # mesh the cutter
280 p = mdb.models[\'Model-1\'].parts[\'cutter\']
281 p.seedPart(size=sizeOfCutter, deviationFactor=0.1, minSizeFactor=0.1)
282 p = mdb.models[\'Model-1\'].parts[\'cutter\']
283 p.generateMesh()
284 
285 
286 # assemble the parts
287 # first assemble the workpiece
288 a = mdb.models[\'Model-1\'].rootAssembly
289 a.DatumCsysByDefault(CARTESIAN)
290 p = mdb.models[\'Model-1\'].parts[\'workpiece-mesh-1\']
291 a.Instance(name=\'workpiece-mesh-1-1\', part=p, dependent=ON)
292 a = mdb.models[\'Model-1\'].rootAssembly
293 a.translate(instanceList=(\'workpiece-mesh-1-1\', ), vector=(-workpiecePointPosX, -workpiecePointPosY, -workpieceDepth/2))
294 
295 # input the inclination angle that you want to change
296 inclinationAngle = 45
297 
298 # second assemble the cutter                   
299 a = mdb.models[\'Model-1\'].rootAssembly                   
300 p = mdb.models[\'Model-1\'].parts[\'cutter\']                   
301 a.Instance(name=\'cutter-1\', part=p, dependent=ON)                   
302 a = mdb.models[\'Model-1\'].rootAssembly                   
303 a.rotate(instanceList=(\'cutter-1\', ), axisPoint=(cutterPointPos, cutterPointPos, 0.0),                    
304     axisDirection=(0.0, -cutterPointPos, 0.0), angle=90.0)                   
305 a = mdb.models[\'Model-1\'].rootAssembly                   
306 a.translate(instanceList=(\'cutter-1\', ), vector=(cutterPointPos, cutterPointPos, cutterPointPos))                   
307 a = mdb.models[\'Model-1\'].rootAssembly # move the workpiece to the cutting depth                   
308 a.translate(instanceList=(\'cutter-1\', ), vector=(0.0, -cutDepth, 0.0))                   
309 a = mdb.models[\'Model-1\'].rootAssembly # rotate the cutter to the inclination angle                
310 a.rotate(instanceList=(\'cutter-1\', ), axisPoint=(0.0, -0.0, 0.0),                    
311     axisDirection=(0.0, -0.1, 0.0), angle=inclinationAngle)                   
312 a = mdb.models[\'Model-1\'].rootAssembly # move the rutter to the safe region              
313 a.translate(instanceList=(\'cutter-1\', ), vector=(tan(inclinationAngle*pi/180)*workpieceDepth/2 + 0.005, 0.0, 0.0))
314 
315 
316 # cutting speed 
317 cuttingSpeed = 314.2
318 cuttingTime = workpieceLength/cuttingSpeed
319 
320 # set the step
321 mdb.models[\'Model-1\'].ExplicitDynamicsStep(name=\'cutting\', previous=\'Initial\', 
322     description=\'cutting the workpiece\', timePeriod=cuttingTime, adiabatic=ON)
323 
324 # set the field output
325 mdb.models[\'Model-1\'].fieldOutputRequests[\'F-Output-1\'].setValues(variables=(
326     \'S\', \'SVAVG\', \'PE\', \'PEVAVG\', \'PEEQ\', \'PEEQVAVG\', \'LE\', \'U\', \'V\', \'A\', 
327     \'RF\', \'CSTRESS\', \'EVF\', \'STATUS\'), numIntervals=500)
328 
329 # set the history output
330 regionDef=mdb.models[\'Model-1\'].rootAssembly.allInstances[\'cutter-1\'].sets[\'cutter\']
331 mdb.models[\'Model-1\'].historyOutputRequests[\'H-Output-1\'].setValues(variables=(
332     \'RF1\', \'RF2\', \'RF3\', \'ALLAE\', \'ALLCD\', \'ALLDMD\', \'ALLFD\', \'ALLIE\', \'ALLKE\', 
333     \'ALLPD\', \'ALLSE\', \'ALLVD\', \'ALLWK\', \'ETOTAL\'), region=regionDef, 
334     sectionPoints=DEFAULT, rebar=EXCLUDE, numIntervals=500)
335 
336 
337 # set the interface nodes
338 a = mdb.models[\'Model-1\'].rootAssembly
339 n = a.instances[\'workpiece-mesh-1-1\'].nodes
340 nodes = n.getByBoundingBox(xMin=-workpieceLength, xMax=0, yMin=-2*cutDepth,yMax=0,zMin=-workpieceDepth/2,zMax=workpieceDepth/2)
341 a.Set(name = \'interface\', nodes = nodes)
342 
343 # set the interation properties
344 mdb.models[\'Model-1\'].ContactProperty(\'IntProp-1\')
345 mdb.models[\'Model-1\'].interactionProperties[\'IntProp-1\'].TangentialBehavior(
346     formulation=PENALTY, directionality=ISOTROPIC, slipRateDependency=OFF, 
347     pressureDependency=OFF, temperatureDependency=OFF, dependencies=0, table=((
348     0.3, ), ), shearStressLimit=None, maximumElasticSlip=FRACTION, 
349     fraction=0.005, elasticSlipStiffness=None)
350 mdb.models[\'Model-1\'].interactionProperties[\'IntProp-1\'].NormalBehavior(
351     pressureOverclosure=HARD, allowSeparation=ON, 
352     constraintEnforcementMethod=DEFAULT)
353 mdb.models[\'Model-1\'].interactionProperties[\'IntProp-1\'].HeatGeneration(
354     conversionFraction=1.0, slaveFraction=0.5)
355 
356 # set the interaction of cutter and workpiece
357 a4 = mdb.models[\'Model-1\'].rootAssembly
358 s1 = a4.instances[\'cutter-1\'].faces
359 side1Faces1 = s1.getSequenceFromMask(mask=(\'[#6 ]\', ), )
360 side2Faces1 = s1.getSequenceFromMask(mask=(\'[#39 ]\', ), )
361 region1=regionToolset.Region(side1Faces=side1Faces1, side2Faces=side2Faces1)
362 a4 = mdb.models[\'Model-1\'].rootAssembly
363 region2=a4.sets[\'interface\']
364 mdb.models[\'Model-1\'].SurfaceToSurfaceContactExp(name =\'Int-1\', 
365     createStepName=\'cutting\', master = region1, slave = region2, 
366     mechanicalConstraint=KINEMATIC, sliding=FINITE, 
367     interactionProperty=\'IntProp-1\', initialClearance=OMIT, datumAxis=None, 
368     clearanceRegion=None)
369 
370 # set the boundary of no movement
371 a4 = mdb.models[\'Model-1\'].rootAssembly
372 n1 = a4.instances[\'workpiece-mesh-1-1\'].nodes
373 nodes = n1.getByBoundingBox(xMin=-workpieceLength, xMax=0, yMin=-workpieceHeight-0.01,yMax=-workpieceHeight+0.01,zMin=-workpieceDepth/2,zMax=workpieceDepth/2)
374 a4.Set(nodes=nodes, name=\'noMovement\')
375 
376 
377 # set the no movement boundary
378 a5 = mdb.models[\'Model-1\'].rootAssembly
379 region = a5.sets[\'noMovement\']
380 mdb.models[\'Model-1\'].EncastreBC(name=\'BC-1\', createStepName=\'Initial\', 
381     region=region, localCsys=None)
382 
383 
384 # set the cutter boundary
385 a5 = mdb.models[\'Model-1\'].rootAssembly
386 region = a5.instances[\'cutter-1\'].sets[\'cutter\']
387 mdb.models[\'Model-1\'].VelocityBC(name=\'BC-2\', createStepName=\'cutting\', 
388     region=region, v1=-cuttingSpeed, v2=0.0, v3=UNSET, vr1=0.0, vr2=0.0, vr3=0.0, 
389     amplitude=UNSET, localCsys=None, distributionType=UNIFORM, fieldName=\'\')
390 
391 # input the ultrasonic parameters
392 ultrasonicFre = 31000.0
393 frequency = 2*pi*ultrasonicFre
394 ultrasonicAmp = 0.003
395 Adata = ultrasonicAmp*frequency
396 
397 
398 # set the amplitude boundary
399 mdb.models[\'Model-1\'].PeriodicAmplitude(name=\'Amp-1\', timeSpan=STEP, 
400     frequency=frequency, start=0.0, a_0=0.0, data=((Adata, 0.0), ))
401 a7 = mdb.models[\'Model-1\'].rootAssembly
402 region = a7.instances[\'cutter-1\'].sets[\'cutter\']
403 mdb.models[\'Model-1\'].VelocityBC(name=\'BC-3\', createStepName=\'cutting\', 
404     region=region, v1=UNSET, v2=UNSET, v3=1.0, vr1=UNSET, vr2=UNSET, vr3=UNSET, 
405     amplitude=\'Amp-1\', localCsys=None, distributionType=UNIFORM, fieldName=\'\')
406 
407 # set the all workpiece
408 a5 = mdb.models[\'Model-1\'].rootAssembly
409 n1 = a5.instances[\'workpiece-mesh-1-1\'].nodes
410 nodes = n1.getByBoundingBox(xMin=-workpieceLength, xMax=0, yMin=-workpieceHeight-0.01,yMax=0.01,zMin=-workpieceDepth/2,zMax=workpieceDepth/2)
411 a4.Set(nodes=nodes, name=\'allWorkpiece\')
412 
413 # define the initial workpiece temperature
414 a6 = mdb.models[\'Model-1\'].rootAssembly
415 region = a6.sets[\'allWorkpiece\']
416 mdb.models[\'Model-1\'].Temperature(name=\'Predefined Field-1\', 
417     createStepName=\'Initial\', region=region, distributionType=UNIFORM, 
418     crossSectionDistribution=CONSTANT_THROUGH_THICKNESS, magnitudes=(20.0, ))

 

分类:

技术点:

相关文章: