Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

dfgsdfgfd

Mechanical
Sep 30, 2015
37
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!
 
Replies continue below

Recommended for you

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'})
 
That works like a charm. Now I can just reference to it with: datumPlane=a.rootAssembly.datums[x.id].

Thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor