SimplifiedLogic / creoson

OpenSource Automation using JSON Transactions for PTC's CREO Parametric
http://www.creoson.com
MIT License
81 stars 23 forks source link

creopyson.drawing.get_cur_model raise exception #61

Closed stekicar closed 3 years ago

stekicar commented 3 years ago

I am trying to get info on current model in drawing:

current_model = creopyson.drawing.get_cur_model(c, drawing=None)
print('current_model:', current_model)

But I get an error:

Traceback (most recent call last):
  File "c:\0_CREO_CONFIGURATION_FILES\CREO_PYTHON\CREO_python_code\drawing_add_approval_symbol.py", line 61, in <module>
    current_model = creopyson.drawing.get_cur_model(c, drawing=None)
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\creopyson\drawing.py", line 390, in get_cur_model
    return client._creoson_post("drawing", "get_cur_model", data, "drawing")
  File "C:\Users\user\AppData\Roaming\Python\Python39\site-packages\creopyson\connection.py", line 87, in _creoson_post
    raise MissingKey("Missing `{}` in creoson result".format(key_data))
creopyson.exceptions.MissingKey: Missing `drawing` in creoson result

Is this a bug?

adama2000 commented 3 years ago

Is there a current model in the drawing?

stekicar commented 3 years ago

Yes. Its an assembly. And drawing is active.

adama2000 commented 3 years ago

This may be a creopyson bug - the return value for "get_cur_model" is a "file", not a "drawing".

adama2000 commented 3 years ago

image

stekicar commented 3 years ago

Ok. Thank you. I was trying to get info for current model in active drawing so I can extract some parameters and use them in symbol creation. I guess I will have to wait for it to get fixed first.

Zepmanbc commented 3 years ago

correction in v0.6.2 you can close