Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Kekec14,
You can run an external program via a mapkey using the @System command. The following will launch a python command and return control back to Creo Parametric:
mapkey dmc @MAPKEY_NAMECreate Data Matrix Code;\
mapkey(continued) @MAPKEY_LABELCreate Data Matrix Code;\
mapkey(continued) @SYSTEMstart \/min \
mapkey(continued) C:\\PTC\\scripts\\dmc.py;
The above assumes your PC has an association with the .py extension that will run the program (vs. editing it). It may be safer to run a .bat script to launch the python program instead of relying on the PC to have an association already.
If your script just needs the filename, there are many ways of exporting that data to disk that your program can then read. A simple "model information" saved to disk is one.
Since you're familiar with JavaScript, you may wish to look at the java scripting capabilities of Creo Parametric.
Regards,
Dan N.
Hello Dan!
Thank you for your solution. I compiled .py file into .exe, so now I am able to run it with your mapkey. What would be the mapkey to generate list of parts, drawings and assemblies in current session in simple .txt file. According to list of files my python script would be able to generate dxf of dmc.
Thank you,
Regards!
In Creo Parametric 4.0, you can use FILE > MANAGE SESSION > OBJECT LIST and you have the option to save the list to disk. The filename is names.inf.#. You will need to parse the file to get the necessary filenames, as well as filtering out any unwanted filenames for skeletons, generics, and such if necessary.
Regards,
Dan N.
Hello Dan!
thank you for the support. Everything works perfectly now. in the attachment is the output of python script. So far I managed to include .dxf to drawing via Insert->Import Drawing/data. Does anyone have idea how to include .dxf file in to part and make extrude future on it.
Thank you!
regards