Abaqus Python script & Really Simple GUI interface syntax issues -
Abaqus Python script & Really Simple GUI interface syntax issues -
i've been running python scripts in abaqus quite time now.
so delighted find simple gui builder (rsgb), or until tried utilize it!
the kernel script i'm using mature piece of code thought prime candidate test out in rsgb.
all needed doing (or thought) matching widget inputs variables in kernel function.
but unexplainable reason abaqus declares have syntax error on function declaration line, see if can spot it?
def setup( modname, target, radmax, radmin, vx, vy, vz, hght, wdth, zlen, numsphere ):
the error,
syntaxerror:('invlid syntax',('.\rigidpyticle.py',22,86,'def setup( modname, target, radmax, radmin, vx, vy, vz, hght, wdth, zlen, numsphere )\n'))
i should add together have checked indents & variables sent gui match in kernel function. kernel function same piece of code has been functioning outside rsgb framework when run using abaqus cli
am missing obvious?
(or it, suspect, abaqus has got in me?)
partial kernel code listing i'm not @ liberty disclose of it:
# -*- coding: mbcs -*- part import * material import * section import * assembly import * step import * interaction import * load import * mesh import * optimization import * job import * sketch import * visualization import * connectorbehavior import * import numpy np def setup( modname, target, radmax, radmin, vx, vy, vz, hght, wdth, zlen, numsphere ): # import target mdb.openauxmdb(target) mdb.copyauxmdbmodel(fromname='model-1', toname='model-1') mdb.copyauxmdbmodel(fromname='model-1', toname='model-1') mdb.closeauxmdb() # set sphere material mdb.models['model-1'].material(name='silicon') mdb.models['model-1'].materials['silicon'].density(table=((2.33e-09, ), )) mdb.models['model-1'].materials['silicon'].elastic(table=((150000.0, 0.17), )) mdb.models['model-1'].homogeneoussolidsection(material='silicon', name='spheresection', thickness=none) # set spheres sph in range(1, numsphere): sphname = 'sphere-' + str(sph) setname = 'sphereset-' + str(sph) rad = radmin + np.random.randint(radmax) * 0.1 cent = rad / 2.0 mdb.models['model-1'].constrainedsketch(name='__profile__', sheetsize=5.0) mdb.models['model-1'].sketches['__profile__'].constructionline(point1=(0.0, -2.5), point2=(0.0, 2.5)) mdb.models['model-1'].sketches['__profile__'].fixedconstraint(entity=mdb.models['model-1'].sketches['__profile__'].geometry[2]) mdb.models['model-1'].sketches['__profile__'].arcbycenterends(center=(0.0, 0.0), direction=counterclockwise, point1=(0.0, -cent), point2=(0.0, cent)) mdb.models['model-1'].part(dimensionality=three_d, name=sphname, type=discrete_rigid_surface) mdb.models['model-1'].parts[sphname].baseshellrevolve(angle=360.0, fliprevolvedirection=off, sketch=mdb.models['model-1'].sketches['__profile__']) del mdb.models['model-1'].sketches['__profile__'] # mesh spheres mdb.models['model-1'].parts[sphname].setmeshcontrols(elemshape=quad, regions=mdb.models['model-1'].parts[sphname].faces.getsequencefrommask(('[#1 ]', ), )) mdb.models['model-1'].parts[sphname].seedpart(deviationfactor=0.1, minsizefactor=0.1, size=0.33) mdb.models['model-1'].parts[sphname].generatemesh() # create set mdb.models['model-1'].parts[sphname].set(faces=mdb.models['model-1'].parts[sphname].faces.getsequencefrommask(('[#1 ]', ), ), name=setname) # reference points & inertia intname = 'inertia-' + str(sph) refpointname = 'rp-' + str(sph) mdb.models['model-1'].parts[sphname].referencepoint(point=(0.0, 0.0, 0.0)) mdb.models['model-1'].parts[sphname].set(name=refpointname, referencepoints=(mdb.models['model-1'].parts[sphname].referencepoints[5], )) mdb.models['model-1'].parts[sphname].engineeringfeatures.pointmassinertia(alpha=0.0, composite=0.0, i11=6.59e-10, i22=6.59e-10, i33=6.59e-10, mass=9.8888e-10, name=intname, region=mdb.models['model-1'].parts[sphname].sets[refpointname]) # place spheres in assembly # sphere placement routine here # predefined velocity, stiff constraints vel in range(1, numsphere): sphname = 'sphere-' + str(vel) setname = sphname + '.sphereset-' + str(vel) conname = 'constraint-' + str(vel) velname = 'rp-' + str(vel) prefieldname = 'predefined field-' + str(vel) mdb.models['model-1'].rigidbody(bodyregion=mdb.models['model-1'].rootassembly.sets[setname], name=conname, refpointregion=region(referencepoints=(mdb.models['model-1'].rootassembly.instances[sphname].referencepoints[5], ))) mdb.models['model-1'].velocity(distributiontype=magnitude, field='', name=prefieldname, omega=0.0, region=mdb.models['model-1'].rootassembly.instances[sphname].sets[velname], velocity1=vx, velocity2=vy, velocity3=vz) # general contact algorithm mdb.models['model-1'].contactproperty('intprop-1') mdb.models['model-1'].interactionproperties['intprop-1'].tangentialbehavior(formulation=frictionless) mdb.models['model-1'].interactionproperties['intprop-1'].normalbehavior(allowseparation=on, constraintenforcementmethod=default, pressureoverclosure=hard) mdb.models['model-1'].contactexp(createstepname='initial', name='int-1') mdb.models['model-1'].interactions['int-1'].contactpropertyassignments.appendinstep(assignments=((global, self, 'intprop-1'), ), stepname='initial') # explicit time step mdb.models['model-1'].explicitdynamicsstep(name='step-1', previous='initial', timeperiod=0.005) mdb.models['model-1'].interactions['int-1'].includedpairs.setvaluesinstep(stepname='initial', useallstar=on) homecoming
python user-interface abaqus
Comments
Post a Comment