×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

python scripting accessing a Datum in a feature

python scripting accessing a Datum in a feature

python scripting accessing a Datum in a feature

(OP)
I'm trying to write a script that applies a load to a surface to a couple of instances.
This is the script:

CODE --> python

from abaqus import *
from abaqusConstants import *
import displayGroupMdbToolset as dgm
import part
import material
import assembly
from abaqus import getInput
    
def apply_force(my,mn):
    i=1
    a = mdb.models[mn].rootAssembly
    inst = a.instances
    for key in inst.keys():
        if(key.startswith(myname)):
            print key
            region = a.instances[key].surfaces['mysurf']
            #leaf = dgm.LeafFromInstance(a.instances[key]) # leaf noch unbenutzt
            datumAxis= mdb.models[mn].rootAssembly.instances[key].datums[2]
            mdb.models[mn].BoltLoad(name='BL-'+str(i),             createStepName='PRE',region=region, magnitude=kraft,            boltMethod=APPLY_FORCE,datumAxis=datumAxis)
            i=i+1

viewportName = session.currentViewportName

mn = session.sessionState[viewportName]['modelName']

myname = getInput('Namen eingeben:')
kraft = float(getInput('Vorspannkraft:'))
apply_force(myname,mn) 

The problem is to me that I don't know how to access the axis of the specific part.
In the Model it looks like
Models(1)
     - Model-1
         - Parts(1)
             - mybolt
                - Features(4)
                   + Solid extrude-1
                   - Datum plane-1
                   - Partition cell-1
                   - myaxis 

At the moment datum[2] seems to be an arbitrary point in the surface. What I wish is to access the item 'myaxis'

How can I achieve this?

Thanks in advance for helping.






RE: python scripting accessing a Datum in a feature

I could answer in german, but lets stay in english...

You have to ask for the feature id and use that id to access the datum object.

myaxis_id=mdb.models[mn].parts['Part-1'].features['myaxis'].id

mdb.models[mn].rootAssembly.instances['Part-1-1].datums[myaxis_id]

RE: python scripting accessing a Datum in a feature

(OP)
Thanks,

I was already at that id while poking around when I did:

mdb.models['Model-1'].rootAssembly.instances['mybolt-1']

CODE --> python

k=inst['mybolt-1'].__members__
>>> print k
['analysisType', 'cells', 'datums', 'dependent', 'edges', 'elemEdges', 'elemFaces', 'elementEdges', 'elementFaces', 'elements', 'excludedFromSimulation', 'faces', 'geometryValidity', 'ignoredEdges', 'ignoredVertices', 'ips', 'name', 'nodes', 'part', 'partName', 'referencePoints', 'sets', 'skins', 'stringers', 'surfaces', 'vertices']
>>> k=inst['mybolt-1'].__members__
 print inst['mybolt-1'].datums
{2: 'DatumPlane object', 4: 'DatumAxis object'}
>>> print inst['mybolt-1'].datums[4]
({'direction': (0.0, 3.06161699786838e-17, -1.0), 'pointOn': (0.0, 200.0, 20.0)}) 
>>> print inst['mybolt-1'].datums[2]
({'normal': (-0.0, -0.0, -1.0), 'pointOn': (0.0, 200.0, 20.0)})

Now the result of your suggestion:

CODE --> python

myaxis_id=mdb.models[mn].parts['mybolt'].features['myaxis'].id
print myaxis_id
4
print mdb.models[mn].rootAssembly.instances['mybolt-1'].datums[myaxis_id] 
({'direction': (0.0, 3.06161699786838e-17, -1.0), 'pointOn': (0.0, 200.0, 20.0)}) 

One can see that 'myaxis' is nealy identical to the 'normal'.

So it actually doesn't seem to matter whether I use myaxis or normal.

The only thing desireable would be that the axis (myaxis) also gets highlighted when applyinf the load.

How could I achieve that?

Thanks.

Christoph

RE: python scripting accessing a Datum in a feature

(OP)
Something got garbled in my post:

Wanted to say ..gets highlightet when applying the load.

And the first code box should lokk like:

CODE --> python

k=inst['mybolt-1'].__members__
>>> print k
['analysisType', 'cells', 'datums', 'dependent', 'edges', 'elemEdges', 'elemFaces', 'elementEdges', 'elementFaces', 'elements', 'excludedFromSimulation', 'faces', 'geometryValidity', 'ignoredEdges', 'ignoredVertices', 'ips', 'name', 'nodes', 'part', 'partName', 'referencePoints', 'sets', 'skins', 'stringers', 'surfaces', 'vertices']
>>> k=inst['mybolt-1'].__members__
 print inst['mybolt-1'].datums
{2: 'DatumPlane object', 4: 'DatumAxis object'}
>>> print inst['mybolt-1'].datums[4]
({'direction': (0.0, 3.06161699786838e-17, -1.0), 'pointOn': (0.0, 200.0, 20.0)}) 
>>> print inst['mybolt-1'].datums[2]
({'normal': (-0.0, -0.0, -1.0), 'pointOn': (0.0, 200.0, 20.0)}) 

RE: python scripting accessing a Datum in a feature

What's the question? How you can highlight the axis that is used for a bolt load?

RE: python scripting accessing a Datum in a feature

(OP)
Yes, that's exactly what I'm looking for. I would like the axis ('myaxis' which is also the normal) to get highlighted (red for instance) too. At the moment I see three little arrows in
seemingly arbitrary points in the plane 'MYSURF'. These arrows also seem to disappear when a certain zoomlevel is exceeded.

I would prefer to see at one glance which items got the load applied.

Thanks,

Christoph

RE: python scripting accessing a Datum in a feature

(OP)
No idea? Anyone having a starting point for me?
Thnx,

Christoph

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources