Search code examples
pythonscriptingmodelingabaqusfinite-element-analysis

How to define two reference points in two edges of a Rectangular plate in the same instance using Python Scripts in Abaqus?


I want to define two Reference points in two edges of the same instance in the assembly so that I can use them for defining constraints later on in the model. My code looks like this :

myAssembly.ReferencePoint(point=(0.0,50.0,0.0))
r1=myAssembly.referencePoints
refpoints1=(r1[3],)
myAssembly.Set(referencePoints=refpoints1, name='RF-Displacement')

myAssembly.ReferencePoint(point=(10.0,50.0,0.0))
r2=myAssembly.referencePoints
refpoints2=(r2[3],)
myAssembly.Set(referencePoints=refpoints2, name='RF-Fix')

The reference points and the sets are created but both the sets refer to the first reference point. How to create two reference points and select each one as a different set?

I think I am making a mistake in accessing the second reference point. Will be glad if someone could point out my mistake.


Solution

  • when you create the point grab its index like this:

     pointid=myAssembly.ReferencePoint(point=(0.0,50.0,0.0)).id
    

    then reference it like this:

     myAssembly.Set(referencePoints=
        (myAssembly.referencePoints[pointid],),
          name='RF-Displacement')
    

    Its never a good idea to hard code indices as you were.