×
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: How to avoid using reference numbers ("Keys") -- or allocate them manually?

Python: How to avoid using reference numbers ("Keys") -- or allocate them manually?

Python: How to avoid using reference numbers ("Keys") -- or allocate them manually?

(OP)
Hi,

When I create parts, reference points, planes, etc. Abaqus allocates random reference numbers, which are addressed by following commands to e.g. change the properties. For example: a.rootAssembly.datums[10].

Question 1: Is there a way to allocate these numbers manually rather than "randomly"? Or at least find out the number that is allocated directly after creating, e.g. the datum plane? The problem is that, when I change something at the beginning of my code, all the following numbers change.

Question 2: Using findAt, BoundingBox, etc. I can avoid using these numbers and address the feature geometrically. However, some features, such as datum planes, don't have the attribute findAt. How can I allocate these features without (knowing) the number?

Thanks so much!

RE: Python: How to avoid using reference numbers ("Keys") -- or allocate them manually?

You can directly store the newly created entity in a variable an then reuse that variable.

CODE -->

>>> a = mdb.models['Model-1'].rootAssembly
>>> x = a.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=2.0)
>>> print x
({'children': '', 'id': 5, 'isOutOfDate': False, 'name': 'Datum plane-2', 'offset': 2.0, 'parents': '', 'path': 'unknown', 'sketch': 'unknown'}) 

RE: Python: How to avoid using reference numbers ("Keys") -- or allocate them manually?

(OP)
That works like a charm. Now I can just reference to it with: datumPlane=a.rootAssembly.datums[x.id].

Thank you so much!

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