3

I have the below as output from an application which I am trying to customize using Python.

({'featureName': 'Solid extrude-1', 'index': 6, 'instanceName': None, 'isReferenceRep': False, 'pointOn': ((-71.25, 18.75, 20.0),)})

I want to get the Coordinate values ( 'pointOn' key) from this variable.

I am not sure if this is array of dictionary or something else.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Ajit C
  • 33
  • 3
  • Is the application outputting this string from a print command? It looks like the string output of a python tuple. – Simon Brahan Jan 14 '16 at 15:59
  • Yes, I am getting this after doing a print of the variable which is passed from the application. – Ajit C Jan 14 '16 at 16:01
  • 2
    Something's not quite right, because if the variable you are printing is a tuple there should be a comma before the end paren. If it isn't a tuple, where do the parenthesis come from? – jme Jan 14 '16 at 16:02
  • @jme fair point. Try using type() on the app output to see what it is; might just be a poorly formatted string. – Simon Brahan Jan 14 '16 at 16:10
  • I tried print Point1[0]['pointOn'] and got the below :TypeError : 'InterestingPoint' object has no attribute '__getitem__' – Ajit C Jan 14 '16 at 16:13

1 Answers1

2

What you got is actually an object. Abaqus just overwrites implementation of __str__ method, so that output looks like something else.

If your object is assigned to name Point1, try accessing members in the following way:

Point1.pointOn
Point1.featureName

In general, Abaqus usually either returns a repository (collection) of objects or a single objects. Rarely can you get something other than that.

hgazibara
  • 1,832
  • 1
  • 19
  • 22