Abaqus Python脚本&真正简单的GUI界面语法问题

时间:2015-04-10 14:40:36

标签: python user-interface abaqus

我已经在Abaqus中成功运行了Python脚本已经有一段时间了。

所以我很高兴找到真正简单的GUI构建器(RSGB),或者直到我尝试使用它!

我正在使用的内核脚本是一段成熟的代码,所以我认为它是在RSGB中测试的主要候选者。

所有真正需要做的事情(或者我认为)都是将小部件输入与内核函数中的变量相匹配。

但由于某些无法解释的原因Abaqus声明我的函数声明行有语法错误,看看你是否能发现它?

def setUp( modName, target, radMax, radMin, Vx, Vy, Vz, hght, wdth, zLen, numSphere ):

错误,

syntaxError :('invlid syntax',('。\ RigidPyticle.py',22,86,'def setUp(modName,target,radMax,radMin,Vx,vy,vz,hght,wdth,zLen) ,numSphere)\ n'))

我应该补充一点,我已经检查了所有的缩进& GUI发送的变量与内核函数中的变量匹配。内核函数本身是使用Abaqus CLI运行时在RSGB框架之外运行良好的相同代码段

我错过了一些非常明显的东西吗?

(或者,正如我怀疑的那样,Abaqus已经为我准备好了吗?)

部分内核代码列表,因为我不能自由披露所有内容:

# -*- coding: mbcs -*-
from part import *
from material import *
from section import *
from assembly import *
from step import *
from interaction import *
from load import *
from mesh import *
from optimization import *
from job import *
from sketch import *
from visualization import *
from connectorBehavior import *
import numpy as 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 up 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 up spheres
    for 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 would be here

    # Predefined velocity, rigid constraints
    for 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)
    return

0 个答案:

没有答案