cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

CREOSON: how to read table on .drw ?

Kittychen
12-Amethyst

CREOSON: how to read table on .drw ?

On this example image from a .drw :

no-table.jpg

Use this function : c.note_list(get_expanded=True)

I can read the title, e.g. "Sheet Metal . . .", "M1", "M2" but not the table contents, e.g. "+-0.05","+-0.10", etc. 

 

What I have read is like this: 

. . . snip . . .

}, {
"name": "Note_171",
"encoded": false,
"value_expanded": "Sheet Metal\nCut Feature\nOf Size"
}, {
"name": "Note_172",
"encoded": false,
"value_expanded": "Sheet Metal\nForm To Form"
}, {
"name": "Note_173",
"encoded": false,
"value_expanded": "Die Cast"
}, {
"name": "Note_174",
"encoded": false,
"value_expanded": "Plastic"
}, {
"name": "Note_175",
"encoded": false,
"value_expanded": "Warpage for\nSheet Metal"
}, {
"name": "Note_176",

. . . snip . . .

 

 

 

ACCEPTED SOLUTION

Accepted Solutions

Reading Drawing Tables is currently not supported.... yet. It is an interesting idea, but we have avoided it due to the high variability of table structures and content they can have.

 

When I ran a test using your approach (obviously you are using the CREOPYSON library) - it seems to work... which makes me wonder how your table values are put into the table.  For example:

 

2020-04-10 at 8.40 AM.png

 

Here is the same call in JavasScript that was ran in the CREOSON Playground: 

let nObj = new creo.NoteObj
nObj.get_expanded = true
nObj.list()

The result returned:

{
  "itemlist": [
    {
      "name": "Note_0",
      "encoded": false,
      "value_expanded": "test"
    },
    {
      "name": "Note_1",
      "encoded": false,
      "value_expanded": "test2"
    },
    {
      "name": "Note_2",
      "encoded": false,
      "value_expanded": "zztest3"
    },
    {
      "name": "Note_3",
      "encoded": false,
      "value_expanded": "test6"
    },
    {
      "name": "Note_4",
      "encoded": false,
      "value_expanded": "99.999"
    }
  ],
  "value": "&CUSTOM:D"
}

 As you can see - it picked up on all the data and reported the values.  But one of the values is being reported as a reference to the Parameter "CUSTOM" - so this would need to be obtained as a second step.

 

What is the type of data in your table that is not being reported?

 

 

View solution in original post

3 REPLIES 3

Reading Drawing Tables is currently not supported.... yet. It is an interesting idea, but we have avoided it due to the high variability of table structures and content they can have.

 

When I ran a test using your approach (obviously you are using the CREOPYSON library) - it seems to work... which makes me wonder how your table values are put into the table.  For example:

 

2020-04-10 at 8.40 AM.png

 

Here is the same call in JavasScript that was ran in the CREOSON Playground: 

let nObj = new creo.NoteObj
nObj.get_expanded = true
nObj.list()

The result returned:

{
  "itemlist": [
    {
      "name": "Note_0",
      "encoded": false,
      "value_expanded": "test"
    },
    {
      "name": "Note_1",
      "encoded": false,
      "value_expanded": "test2"
    },
    {
      "name": "Note_2",
      "encoded": false,
      "value_expanded": "zztest3"
    },
    {
      "name": "Note_3",
      "encoded": false,
      "value_expanded": "test6"
    },
    {
      "name": "Note_4",
      "encoded": false,
      "value_expanded": "99.999"
    }
  ],
  "value": "&CUSTOM:D"
}

 As you can see - it picked up on all the data and reported the values.  But one of the values is being reported as a reference to the Parameter "CUSTOM" - so this would need to be obtained as a second step.

 

What is the type of data in your table that is not being reported?

 

 

Thank you very much for your hints.

Now I know what's wrong: 

c.note_list(get_expanded=True)  # does not expend 'encoded' items, that's the reason!!!

 ... snip ...
 {'name': 'Note_200', 'encoded': True},
 {'name': 'Note_201', 'encoded': True},
 {'name': 'Note_202', 'encoded': False, 'value_expanded': '0.80'},
 {'name': 'Note_203', 'encoded': False, 'value_expanded': '0.60'}, 
 ... snip ...

So c.note_list() can read tables but the results need further treatments.

note_list = c.note_list() 
note_list_detail = []
for i in range(len(note_list)):
    note_list_detail.append(c.note_get(note_list[i]['name']))  # further treatment
print(note_list_detail)

... snip ...
 {'name': 'Note_200', 'value': 'ASMCMC4wNQ==', 'encoded': True},  # gotcha!!
 {'name': 'Note_201', 'value': 'ASMCMC4wNQ==', 'encoded': True},  # gotcha!!
 {'name': 'Note_202', 'value': '0.80', 'encoded': False},
 {'name': 'Note_203', 'value': '0.60', 'encoded': False},
... snip ...

Again, thank you very much 🙂 

 

 

Ah - I did not realize you were using the encoded flag in your original problem.

 

The encoded flag is only for situations where you are sending special characters where some of the characters may screw up the parsing of data ... it is a base64 encoded value instead of the raw text.  Old PTC Symbol Name Formats would be a good example when you would use that.

 

Glad you got it working!

 

Dave

Announcements


Top Tags