Zepmanbc / creopyson

Python library for Creoson (http://www.creoson.com)
MIT License
60 stars 5 forks source link

RuntimeError: The file 'abc' could not be opened #42

Closed akash9470 closed 3 years ago

akash9470 commented 3 years ago

Description

i am trying to open step file in creo using following method

INPUT- import creopyson c = creopyson.Client() c.connect() c.creo_set_creo_version(7) c.creo_cd("C:\Users\Desktop\New") c.interface_import_file("abc","STEP",)

OUTPUT-

File "C:\New folder\untitled1.py", line 13, in c.interface_import_file("abc","STEP",)

File "C:\Program Files\Spyder\pkgs\creopyson\interface.py", line 363, in import_file return client._creoson_post("interface", "import_file", data, "file")

File "C:\Program Files\Spyder\pkgs\creopyson\connection.py", line 75, in _creoson_post raise RuntimeError(error_msg)

RuntimeError: The file 'abc' could not be opened

Zepmanbc commented 3 years ago

Hi @akash9470 you need to name the file with its suffix:

import creopyson
c = creopyson.Client()
c.connect()
c.creo_set_creo_version(7)
c.creo_cd("C:\Users\Desktop\New")
created_file = c.interface_import_file("abc.stp")
c.file_open(created_file)

created_file = "abc.asm" the created_file will be an asm if you don't force new_model_type arg to prt created_file = c.interface_import_file("abc.stp", new_model_type="prt") created_file = "abc.prt"

akash9470 commented 3 years ago

Thank for the help....it worked